Text
public final class Text : BaseText
extension Text: Equatable
Stores string, styles and substyles for attributed string.
-
Undocumented
Declaration
Swift
public let value: String
-
Undocumented
Declaration
Swift
public let style: TextStyle
-
Returns attributed string.
Declaration
Swift
public var attributed: NSAttributedString { get }
-
Initialize the text with passed string and style.
Declaration
Swift
public init(value: String, style: TextStyle)
Parameters
value
The string for style and substyles.
style
The style for passed string.
-
Initialize the text with passed string and style. Returns nil if there is no value.
Declaration
Swift
public convenience init?(value: String?, style: TextStyle)
Parameters
value
The string for style and substyles.
style
The style for passed string.
-
Returns a new text by concatenating the passed text.
Declaration
Swift
public func concat(_ text: Text) -> Text
Parameters
text
The text for concatenation.
-
Adds the substyle for passed range.
Declaration
Swift
public func add(_ substyle: TextStyle, at range: Range<String.Index>)
Parameters
substyle
The substyle for passed range.
range
The range for substyle applying.
-
Adds the substyle for passed range.
Declaration
Swift
public func add(_ substyle: TextStyle, at range: NSRange)
Parameters
substyle
The substyle for passed range.
range
The range for substyle applying.
-
Convenient method for adding the substyle for substring. This method finds all occurrences of string in text and applies the substyle to it.
Declaration
Swift
public func add(_ substyle: TextStyle, for substring: String)
Parameters
substyle
The substyle for passed string.
substring
The string value.
-
Returns the bounding rectangle required to draw the string.
Declaration
Swift
public func boundingRect(with size: CGSize, options: NSStringDrawingOptions = [.usesLineFragmentOrigin, .usesFontLeading], context: NSStringDrawingContext? = nil) -> CGRect
Parameters
size
The width and height constraints to apply when computing the string’s bounding rectangle.
options
Additional drawing options to apply to the string during rendering.
context
A context object with information about how to adjust the font tracking and scaling information. On return, the specified object contains information about the actual values used to render the string. This parameter is nil by default.
Return Value
A rectangle which size component indicates the width and height required to draw the entire contents of the string.
-
Undocumented
Declaration
Swift
public func copy() -> Text
-
Undocumented
Declaration
Swift
static func + (lhs: Text, rhs: String) -> Text
-
Undocumented
Declaration
Swift
static func + (lhs: String, rhs: Text) -> Text
-
Declaration
Swift
public static func == (lhs: Text, rhs: Text) -> Bool