NSAttributedString

class NSAttributedString : NSObject, NSCopying, NSMutableCopying, NSSecureCoding
  • SwifterSwift: Bolded string.

    Declaration

    Swift

    public var bolded: NSAttributedString { get }
  • SwifterSwift: Underlined string.

    Declaration

    Swift

    public var underlined: NSAttributedString { get }
  • SwifterSwift: Italicized string.

    Declaration

    Swift

    public var italicized: NSAttributedString { get }
  • SwifterSwift: Struckthrough string.

    Declaration

    Swift

    public var struckthrough: NSAttributedString { get }
  • SwifterSwift: Dictionary of the attributes applied across the whole string

    Declaration

    Swift

    public var attributes: [NSAttributedStringKey : Any] { get }
  • SwifterSwift: Add color to NSAttributedString.

  • SwifterSwift: Add color to NSAttributedString.

    Declaration

    Swift

    public func colored(with color: UIColor) -> NSAttributedString

    Parameters

    color

    text color.

    Return Value

    a NSAttributedString colored with given color.

  • SwifterSwift: Apply attributes to substrings matching a regular expression

    Declaration

    Swift

    public func applying(attributes: [NSAttributedStringKey : Any], toRangesMatching pattern: String) -> NSAttributedString

    Parameters

    attributes

    Dictionary of attributes

    pattern

    a regular expression to target

    Return Value

    An NSAttributedString with attributes applied to substrings matching the pattern

  • SwifterSwift: Apply attributes to occurrences of a given string

    Declaration

    Swift

    public func applying<T>(attributes: [NSAttributedStringKey : Any], toOccurrencesOf target: T) -> NSAttributedString where T : StringProtocol

    Parameters

    attributes

    Dictionary of attributes

    target

    a subsequence string for the attributes to be applied to

    Return Value

    An NSAttributedString with attributes applied on the target string

  • SwifterSwift: Add a NSAttributedString to another NSAttributedString.

    Declaration

    Swift

    public static func += (lhs: inout NSAttributedString, rhs: NSAttributedString)

    Parameters

    lhs

    NSAttributedString to add to.

    rhs

    NSAttributedString to add.

  • SwifterSwift: Add a NSAttributedString to another NSAttributedString and return a new NSAttributedString instance.

    Declaration

    Swift

    public static func + (lhs: NSAttributedString, rhs: NSAttributedString) -> NSAttributedString

    Parameters

    lhs

    NSAttributedString to add.

    rhs

    NSAttributedString to add.

    Return Value

    New instance with added NSAttributedString.

  • SwifterSwift: Add a NSAttributedString to another NSAttributedString.

    Declaration

    Swift

    public static func += (lhs: inout NSAttributedString, rhs: String)

    Parameters

    lhs

    NSAttributedString to add to.

    rhs

    String to add.

  • SwifterSwift: Add a NSAttributedString to another NSAttributedString and return a new NSAttributedString instance.

    Declaration

    Swift

    public static func + (lhs: NSAttributedString, rhs: String) -> NSAttributedString

    Parameters

    lhs

    NSAttributedString to add.

    rhs

    String to add.

    Return Value

    New instance with added NSAttributedString.