NSAttributedString

class NSAttributedString

A string object that contains style attributes associated to portions of its text.

  • The attributed strings text.

    Declaration

    var string: String { get }
  • The number of characters in a string.

    Declaration

    var length: Double { get }
  • A list of attribute runs which are applied to string.

    Declaration

    var runs: Array { get }
  • The number of lines in string.

    Declaration

    var lineCount: Double { get }
  • The object’s description

    Declaration

    var description: String { get }
  • Compares two values for equality.

    The equals function is invoked using infix notation as in the following code snippet: lhs == rhs.

    Declaration

    func equals(_ lhs: NSAttributedString) -> Bool

    Parameters

    lhs

    A value.

    rhs

    Another value.

    Return Value

    true if the lhs and rhs are equal, false otherwise.

  • Seperates the string into components using the specified seperator. For example, “1,2,3”.components(separatedBy: “,”) yields [“1”, “2”, “3”]

    Declaration

    func components(seperatedBy seperator: String) -> Array

    Parameters

    seperator

    The seperator used seperate the string into components.

    Return Value

    An array of strings containing the components of the original string.