@@ -5,6 +5,19 @@ extension StringProtocol {
55} 
66
77extension  Sequence  where  Element ==  Text  { 
8+ 
9+     /// Returns a new `Text` by concatenating the elements of the sequence,
10+     ///
11+     /// The following example shows how an array of `Text` views can be joined to a
12+     /// single `Text` view with comma-separated string:
13+     ///
14+     ///     let cast = [Text("Vivien"), Text("Marlon"), Text("Kim")]
15+     ///     let list = cast.joined(separator: Text(", "))
16+     ///     // Gives Text("Vivien, Marlon, Kim")
17+     ///
18+     /// - Parameter separator: A `Text` view to insert between each of the elements
19+     ///   in this sequence. By default there is no separator.
20+     /// - Returns: A single, concatenated `Text` view.
821    public  func  joined( separator:  Text  =  Text ( " " ) )  ->  Text  { 
922        var  isInitial  =  true 
1023        return  reduce ( Text ( " " ) )  {  ( result,  text)  in 
@@ -18,10 +31,24 @@ extension Sequence where Element == Text {
1831} 
1932
2033extension  Text  { 
34+ 
35+     /// Creates a  combined text view based on the given `content` by inserting
36+     /// `separator` text views between each received text component.
37+     ///
38+     /// - Parameters:
39+     ///   - separator: The text to use as a separator between received text components.
40+     ///     By default there is no separator.
41+     ///   - content: A text builder that creates text components.
2142    public  init ( separator:  Text  =  Text ( " " ) ,  @BasicTextBuilder   content:  ( )  ->  [ Text ] )  { 
2243        self  =  content ( ) . joined ( separator:  separator) 
2344    } 
2445
46+     /// Creates a  combined text view based on the given `content` by inserting
47+     /// `separator` string between each received text component.
48+     ///
49+     /// - Parameters:
50+     ///   - separator: The string to use as a separator between received text components.
51+     ///   - content: A text builder that creates text components.
2552    public  init < Separator:  StringProtocol > ( separator:  Separator ,  @BasicTextBuilder   content:  ( )  ->  [ Text ] )  { 
2653        self . init ( separator:  Text ( separator) ,  content:  content) 
2754    } 
0 commit comments