NSAttributedString
public extension NSAttributedString
-
Initialize from an array of strings with color, joining with the separator
Declaration
Swift
convenience init(stringsWithColor: [(String, UIColor)], separator: String = " ")Parameters
stringsWithStylearray of tuples (string, color)
separatorstring
-
Initialize from an array of strings with styles, joining with the separator
Declaration
Swift
convenience init(stringsWithStyle: [(String, UIFont.TextStyle)], separator: String)Parameters
stringsWithStylearray of tuples (string, style)
separatorstring
-
Initialize from an array of strings with styles and weights, joining with the separator
Declaration
Swift
convenience init(stringsWithStyleAndWeight: [(String, UIFont.TextStyle, weight: UIFont.Weight)], separator: String)Parameters
stringsWithStylearray of tuples (string, style)
separatorstring
weightfont weight, e.g. .thin
-
Initialize from a string using the fgColor
Declaration
Swift
convenience init(string: String, fgColor: UIColor)Parameters
stringinput string
colorforeground color
-
Initialize from a string using the textStyle
Declaration
Swift
convenience init(string: String, textStyle: UIFont.TextStyle)Parameters
stringinput string
textStyleinput font text style
-
Initialize from a string using the textStyle and weight
Declaration
Swift
convenience init(string: String, textStyle: UIFont.TextStyle, weight: UIFont.Weight)Parameters
stringinput string
textStyleinput font text style
weightfont weight, e.g. .thin
-
Initialize from an array of NSAttributedString, joining with the separator
Declaration
Swift
convenience init(from nsaStrings: [NSAttributedString], separator: String)Parameters
nsaStringsarray of attributes strings
separatorinput separator