Skip to content

Commit 8c576b5

Browse files
committed
Add documentation to AttributedStringConvertible
1 parent 051a1f2 commit 8c576b5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Attributed/AttributedStringConvertible.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,35 @@ public protocol AttributedStringConvertible
2727
}
2828

2929
// MARK: - String
30+
31+
/// Swift's `String` is extended to conform to `AttributedStringConvertible`.
3032
extension String: AttributedStringConvertible
3133
{
34+
/// Required to conform to `AttributedStringConvertible`.
3235
public var attributedString: NSAttributedString
3336
{
3437
return NSAttributedString(string: self)
3538
}
3639

40+
/// Required to conform to `AttributedStringConvertible`.
3741
public func attributedStringWithAddedAttributes(attributes: [String : AnyObject]) -> NSAttributedString
3842
{
3943
return NSAttributedString(string: self, attributes: attributes)
4044
}
4145
}
4246

4347
// MARK: - NSAttributedString
48+
49+
/// Foundation's `NSAttributedString` is extended to conform to `AttributedStringConvertible`.
4450
extension NSAttributedString: AttributedStringConvertible
4551
{
52+
/// Required to conform to `AttributedStringConvertible`.
4653
public var attributedString: NSAttributedString
4754
{
4855
return self
4956
}
5057

58+
/// Required to conform to `AttributedStringConvertible`.
5159
public func attributedStringWithAddedAttributes(attributes: [String : AnyObject]) -> NSAttributedString
5260
{
5361
let mutable = NSMutableAttributedString(attributedString: self)

0 commit comments

Comments
 (0)