TextStyle

open class TextStyle
extension TextStyle: Equatable

Generates attributes according to stored parameters.

  • Use this attribute to change the font for a range of text. If you do not specify this attribute, the string uses a 12-point system font by default.

    Declaration

    Swift

    public var font: UIFont { get set }
  • Use this attribute to specify the color of the text during rendering. If you do not specify this attribute, the text is rendered in black.

    Declaration

    Swift

    public var color: UIColor { get set }
  • Use this attribute to specify the color of the background area behind the text. If you do not specify this attribute, no background color is drawn.

    Declaration

    Swift

    public var backgroundColor: UIColor { get set }
  • Ligatures cause specific character combinations to be rendered using a single custom glyph that corresponds to those characters. The value 0 indicates no ligatures. The value 1 indicates the use of the default ligatures.

    Declaration

    Swift

    public var ligature: Int? { get set }
  • This value specifies the number of points by which to adjust kern-pair characters. Kerning prevents unwanted space from occurring between specific characters and depends on the font. The value 0 means kerning is disabled. If you do not specify this attribute, the string uses zero kerning.

    Declaration

    Swift

    public var kerning: Float? { get set }
  • This value represents the amount to change the stroke width and is specified as a percentage of the font point size. Specify 0 (the default) for no additional changes. Specify positive values to change the stroke width alone. Specify negative values to stroke and fill the text. For example, a typical value for outlined text would be 3.0.

    Declaration

    Swift

    public var strokeWidth: Float? { get set }
  • Use this style to specify the shadow.

    Declaration

    Swift

    public var shadowStyle: ShadowStyle? { get set }
  • Use this attribute to specify a text effect, such as letterpressStyle. If you do not specify this attribute, the string uses has no text effect.

    Declaration

    Swift

    public var effectStyle: NSAttributedString.TextEffectStyle? { get set }
  • Use this attribute to specify the character’s offset from the baseline, in points. If you do not specify this attribute, the string uses zero baseline offset.

    Declaration

    Swift

    public var baselineOffset: Float? { get set }
  • Use this attribute to specify a skew to be applied to glyphs. If you do not specify this attribute, the string uses zero obliqueness, indicating no skew.

    Declaration

    Swift

    public var obliqueness: Float? { get set }
  • Use this attribute to specify a log of the expansion factor to be applied to glyphs. If you do not specify this attribute, the string uses zero expansion.

    Declaration

    Swift

    public var expansion: Float? { get set }
  • This value indicates whether the text has a line through it. The default value for this attributes is styleNone for the style nil for the color, indicating same as foreground color.

    Declaration

    Swift

    public var strikeThroughLine: LineAttributes? { get set }
  • Undocumented

    Declaration

    Swift

    public var underlineLine: LineAttributes? { get set }
  • otherwise, it describes the outline color.

    Declaration

    Swift

    public var strokeColor: UIColor? { get set }
  • The default value of this property is nil, indicating no attachment.

    Declaration

    Swift

    public var attachment: NSTextAttachment? { get set }
  • The default value of this property is nil, indicating no link.

    Declaration

    Swift

    public var link: NSURL? { get set }
  • Natural text alignment is realized as left or right alignment depending on the line sweep direction of the first script contained in the paragraph. For a list of alignment constants, see the “Constants” section of NSString UIKit Additions Reference. Default value is .natural.

    Declaration

    Swift

    public var alignment: NSTextAlignment { get set }
  • This property contains the line break mode to be used laying out the paragraph’s text. For a list of line break constants, see the “Constants” section of NSParagraphStyle. Default value is .byTruncatingTail.

    Declaration

    Swift

    public var lineBreakMode: NSLineBreakMode { get set }
  • This value is always nonnegative. This value is included in the line fragment heights in the layout manager.

    Declaration

    Swift

    public var lineSpacing: Float? { get set }
  • This property contains the space (measured in points) added at the end of the paragraph to separate it from the following paragraph. This value must be nonnegative. The space between paragraphs is determined by adding the previous paragraph’s paragraphSpacing and the current paragraph’s paragraphSpacingBefore.

    Declaration

    Swift

    public var paragraphSpacing: Float? { get set }
  • This property contains the space (measured in points) between the paragraph’s top and the beginning of its text content. If you do not specify this attribute, the string uses zero paragraph spacing before.

    Declaration

    Swift

    public var paragraphSpacingBefore: Float? { get set }
  • This property contains the minimum and maximum height in points that any line in the receiver will occupy, regardless of the font size or size of any attached graphic. This value must be nonnegative.

    Declaration

    Swift

    public var lineHeight: Float? { get set }
  • Use this attribute to apply multiple attributes to a range of text. If you do not specify this attribute, the string uses the default paragraph attributes, as returned by the default method of NSParagraphStyle.

    Declaration

    Swift

    public var paragraphStyle: NSParagraphStyle? { get set }
  • Undocumented

    Declaration

    Swift

    public init()
  • Undocumented

    Declaration

    Swift

    public func copy() -> TextStyle
  • Applies center to alignment attribute.

    Declaration

    Swift

    @discardableResult
    public func centerAligned() -> TextStyle

    Return Value

    The style with updated alignment attribute.

  • Applies left to alignment attribute.

    Declaration

    Swift

    public func leftAligned() -> TextStyle

    Return Value

    The style with updated alignment attribute.

  • Applies right to alignment attribute.

    Declaration

    Swift

    public func rightAligned() -> TextStyle

    Return Value

    The style with updated alignment attribute.

  • Applies natural to alignment attribute.

    Declaration

    Swift

    public func naturalAligned() -> TextStyle

    Return Value

    The style with updated alignment attribute.

  • Applies justified to alignment attribute.

    Declaration

    Swift

    public func justifiedAligned() -> TextStyle

    Return Value

    The style with updated alignment attribute.

  • Applies 0 to lineHeight attribute.

    Declaration

    Swift

    public func lineHeightReseted() -> TextStyle

    Return Value

    The style with updated lineHeight attribute.

Equatable

  • Declaration

    Swift

    public static func == (lhs: TextStyle, rhs: TextStyle) -> Bool