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
stringsWithStyle
array of tuples (string, color)
separator
string
-
Initialize from an array of strings with styles, joining with the separator
Declaration
Swift
convenience init(stringsWithStyle: [(String, UIFont.TextStyle)], separator: String)
Parameters
stringsWithStyle
array of tuples (string, style)
separator
string
-
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
stringsWithStyle
array of tuples (string, style)
separator
string
weight
font weight, e.g. .thin
-
Initialize from a string using the fgColor
Declaration
Swift
convenience init(string: String, fgColor: UIColor)
Parameters
string
input string
color
foreground color
-
Initialize from a string using the textStyle
Declaration
Swift
convenience init(string: String, textStyle: UIFont.TextStyle)
Parameters
string
input string
textStyle
input 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
string
input string
textStyle
input font text style
weight
font weight, e.g. .thin
-
Initialize from an array of NSAttributedString, joining with the separator
Declaration
Swift
convenience init(from nsaStrings: [NSAttributedString], separator: String)
Parameters
nsaStrings
array of attributes strings
separator
input separator