Skip to content

Commit 806a4c3

Browse files
committed
Attribute functions take one convertible and return one.
This removes the Array parameters, instead, use join().
1 parent 40af125 commit 806a4c3

14 files changed

+63
-67
lines changed

Attributed/AttributedStringConvertible.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import Foundation
1313
// MARK: - Function Types
1414

1515
/// An attribute function.
16-
public typealias AttributeFunction = [AttributedStringConvertible] -> AttributedStringConvertible
16+
public typealias AttributeFunction = AttributedStringConvertible -> AttributedStringConvertible
1717

1818
// MARK: - Protocol
1919

Attributed/ColorType+Attributes.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ public extension ColorType
2323

2424
The foreground color will not override a foreground color set deeper in the hierarchy.
2525

26-
- parameter strings: The attributed strings to apply the foreground color to.
26+
- parameter string: The attributed string convertible to apply the foreground color to.
2727
*/
28-
public func foregroundAttribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
28+
public func foregroundAttribute(string: AttributedStringConvertible) -> AttributedStringConvertible
2929
{
30-
return Attributed.attribute(NSForegroundColorAttributeName, self, strings)
30+
return Attributed.attribute(NSForegroundColorAttributeName, self, string)
3131
}
3232

3333
// MARK: - Background Color
@@ -37,11 +37,11 @@ public extension ColorType
3737

3838
The background color will not override a background color set deeper in the hierarchy.
3939

40-
- parameter strings: The attributed strings to apply the background color to.
40+
- parameter string: The attributed string convertible to apply the background color to.
4141
*/
42-
public func backgroundAttribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
42+
public func backgroundAttribute(string: AttributedStringConvertible) -> AttributedStringConvertible
4343
{
44-
return Attributed.attribute(NSBackgroundColorAttributeName, self, strings)
44+
return Attributed.attribute(NSBackgroundColorAttributeName, self, string)
4545
}
4646

4747
// MARK: - Underline Color
@@ -51,11 +51,11 @@ public extension ColorType
5151

5252
The underline color will not override an underline color set deeper in the hierarchy.
5353

54-
- parameter strings: The attributed strings to apply the underline color to.
54+
- parameter string: The attributed string convertible to apply the underline color to.
5555
*/
56-
public func underlineAttribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
56+
public func underlineAttribute(string: AttributedStringConvertible) -> AttributedStringConvertible
5757
{
58-
return Attributed.attribute(NSUnderlineColorAttributeName, self, strings)
58+
return Attributed.attribute(NSUnderlineColorAttributeName, self, string)
5959
}
6060

6161
// MARK: - Strikethrough Color
@@ -65,10 +65,10 @@ public extension ColorType
6565

6666
The strikethrough color will not override an strikethrough color set deeper in the hierarchy.
6767

68-
- parameter strings: The attributed strings to apply the strikethrough color to.
68+
- parameter string: The attributed string convertible to apply the strikethrough color to.
6969
*/
70-
public func strikethroughAttribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
70+
public func strikethroughAttribute(string: AttributedStringConvertible) -> AttributedStringConvertible
7171
{
72-
return Attributed.attribute(NSStrikethroughColorAttributeName, self, strings)
72+
return Attributed.attribute(NSStrikethroughColorAttributeName, self, string)
7373
}
7474
}

Attributed/FontType+Attributes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public extension FontType
2323

2424
The font will not override a font set deeper in the hierarchy.
2525

26-
- parameter strings: The attributed strings to apply the font to.
26+
- parameter string: The attributed string convertible to apply the font to.
2727
*/
28-
public func attribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
28+
public func attribute(string: AttributedStringConvertible) -> AttributedStringConvertible
2929
{
30-
return Attributed.attribute(NSFontAttributeName, self, strings)
30+
return Attributed.attribute(NSFontAttributeName, self, string)
3131
}
3232
}

Attributed/Functions.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
- parameter attributes: The attributes to apply.
1717
- parameter strings: The convertible strings.
1818
*/
19-
public func attributes(attributes: [String:AnyObject?], _ strings: [AttributedStringConvertible])
19+
public func attributes(attributes: [String:AnyObject?], _ string: AttributedStringConvertible)
2020
-> AttributedStringConvertible
2121
{
22-
return NestedAttributedString(attributes: attributes, children: strings)
22+
return NestedAttributedString(attributes: attributes, children: [string])
2323
}
2424

2525
/**
@@ -31,8 +31,8 @@ public func attributes(attributes: [String:AnyObject?], _ strings: [AttributedSt
3131
- parameter value: The attribute value to apply.
3232
- parameter strings: The convertible strings.
3333
*/
34-
public func attribute(attribute: String, _ value: AnyObject?, _ strings: [AttributedStringConvertible])
34+
public func attribute(attribute: String, _ value: AnyObject?, _ string: AttributedStringConvertible)
3535
-> AttributedStringConvertible
3636
{
37-
return Attributed.attributes([attribute: value], strings)
37+
return Attributed.attributes([attribute: value], string)
3838
}

Attributed/Ligature+Attributes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public extension Ligature
2323

2424
The ligature setting will not override a ligature setting set deeper in the hierarchy.
2525

26-
- parameter strings: The attributed strings to apply the ligature setting to.
26+
- parameter string: The attributed string convertible to apply the ligature setting to.
2727
*/
28-
public func attribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
28+
public func attribute(string: AttributedStringConvertible) -> AttributedStringConvertible
2929
{
30-
return Attributed.attribute(NSLigatureAttributeName, self.rawValue, strings)
30+
return Attributed.attribute(NSLigatureAttributeName, self.rawValue, string)
3131
}
3232
}

Attributed/NSCursor+Attributes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ extension NSCursor
2121

2222
The cursor will not override a cursor set deeper in the hierarchy.
2323

24-
- parameter strings: The attributed strings to apply the cursor to.
24+
- parameter string: The attributed string convertible to apply the cursor to.
2525
*/
26-
public func attribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
26+
public func attribute(string: AttributedStringConvertible) -> AttributedStringConvertible
2727
{
28-
return Attributed.attribute(NSCursorAttributeName, self, strings)
28+
return Attributed.attribute(NSCursorAttributeName, self, string)
2929
}
3030
}
3131

Attributed/NSNumberConvertible+Attributes.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ public extension NSNumberConvertible
2323

2424
The baseline offset value will not override a baseline offset value set deeper in the hierarchy.
2525

26-
- parameter strings: The attributed strings to apply the baseline offset to.
26+
- parameter string: The attributed string convertible to apply the baseline offset to.
2727
*/
28-
public func baselineOffsetAttribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
28+
public func baselineOffsetAttribute(string: AttributedStringConvertible) -> AttributedStringConvertible
2929
{
30-
return Attributed.attribute(NSBaselineOffsetAttributeName, self.NSNumberValue, strings)
30+
return Attributed.attribute(NSBaselineOffsetAttributeName, self.NSNumberValue, string)
3131
}
3232

3333
// MARK: - Kern
@@ -37,10 +37,10 @@ public extension NSNumberConvertible
3737

3838
The kerning value will not override a kerning value set deeper in the hierarchy.
3939

40-
- parameter strings: The attributed strings to apply the kerning attribute to.
40+
- parameter string: The attributed string convertible to apply the kerning attribute to.
4141
*/
42-
func kernAttribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
42+
func kernAttribute(string: AttributedStringConvertible) -> AttributedStringConvertible
4343
{
44-
return Attributed.attribute(NSKernAttributeName, self.NSNumberValue, strings)
44+
return Attributed.attribute(NSKernAttributeName, self.NSNumberValue, string)
4545
}
4646
}

Attributed/NSParagraphStyle+Attributes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public extension NSParagraphStyle
2323

2424
The paragraph style will not override a paragraph style set deeper n the hierarchy.
2525

26-
- parameter strings: The attributed strings to apply the paragraph style to.
26+
- parameter string: The attributed string convertible to apply the paragraph style to.
2727
*/
28-
public func attribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
28+
public func attribute(string: AttributedStringConvertible) -> AttributedStringConvertible
2929
{
30-
return Attributed.attribute(NSParagraphStyleAttributeName, self, strings)
30+
return Attributed.attribute(NSParagraphStyleAttributeName, self, string)
3131
}
3232
}

Attributed/NSShadow+Attributes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public extension NSShadow
2323

2424
The shadow will not override a shadow set deeper n the hierarchy.
2525

26-
- parameter strings: The attributed strings to apply the shadow to.
26+
- parameter string: The attributed string convertible to apply the shadow to.
2727
*/
28-
public func attribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
28+
public func attribute(string: AttributedStringConvertible) -> AttributedStringConvertible
2929
{
30-
return Attributed.attribute(NSShadowAttributeName, self, strings)
30+
return Attributed.attribute(NSShadowAttributeName, self, string)
3131
}
3232
}

Attributed/NSTextAttachment+Attributes.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public extension NSTextAttachment
2323

2424
The text attachment value will not override a text attachment value set deeper in the hierarchy.
2525

26-
- parameter strings: The attributed strings to apply the text attachment to.
26+
- parameter string: The attributed string convertible to apply the text attachment to.
2727
*/
28-
public func attribute(strings: [AttributedStringConvertible]) -> AttributedStringConvertible
28+
public func attribute(string: AttributedStringConvertible) -> AttributedStringConvertible
2929
{
30-
return Attributed.attribute(NSAttachmentAttributeName, self, strings)
30+
return Attributed.attribute(NSAttachmentAttributeName, self, string)
3131
}
3232
}

0 commit comments

Comments
 (0)