Swift 4 . Swift 4.0 json () NSAttributedStringKey
. [String : Any]
[NSAttributedStringKey : Any]
AttributedString
Swift 4.0 [NSAttributedStringKey : Any]?
/ Swift 4.0
public init(string str: String, attributes attrs: [NSAttributedStringKey : Any]? = nil)
.
let label = UILabel()
let labelText = "String Text"
let strokeTextAttributes = [
NSAttributedStringKey.strokeColor : UIColor.black,
NSAttributedStringKey.foregroundColor : UIColor.white,
NSAttributedStringKey.strokeWidth : -2.0,
NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 18)
] as [NSAttributedStringKey : Any]
label.attributedText = NSAttributedString(string: labelText, attributes: strokeTextAttributes)
Apple: NSAttributedString - NSAttributedString