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
valueThe string for style and substyles.
styleThe 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
valueThe string for style and substyles.
styleThe style for passed string.
-
Returns a new text by concatenating the passed text.
Declaration
Swift
public func concat(_ text: Text) -> TextParameters
textThe text for concatenation.
-
Adds the substyle for passed range.
Declaration
Swift
public func add(_ substyle: TextStyle, at range: Range<String.Index>)Parameters
substyleThe substyle for passed range.
rangeThe range for substyle applying.
-
Adds the substyle for passed range.
Declaration
Swift
public func add(_ substyle: TextStyle, at range: NSRange)Parameters
substyleThe substyle for passed range.
rangeThe 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
substyleThe substyle for passed string.
substringThe 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) -> CGRectParameters
sizeThe width and height constraints to apply when computing the string’s bounding rectangle.
optionsAdditional drawing options to apply to the string during rendering.
contextA 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
View on GitHub
Text Class Reference