NSAttributedString
class NSAttributedString
class NSAttributedString
import Foundation
class NSObject
The root class of most Foundation class hierarchies.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol NSCoding
The NSCoding
protocol declares the two methods that a class must implement so that instances of that class can be encoded and decoded. This capability provides the basis for archiving (where objects and other structures are stored on disk) and distribution (where objects are copied to different address spaces).
protocol NSCopying
The NSCopying
protocol declares a method for providing functional copies of an object. The exact meaning of “copy” can vary from class to class, but a copy must be a functionally independent object with values identical to the original at the time the copy was made.
protocol NSMutableCopying
The NSMutableCopying
protocol declares a method for providing mutable copies of an object. Only classes that define an “immutable vs. mutable” distinction should adopt this protocol. Classes that don’t define such a distinction should adopt NSCopying
instead.
protocol NSObjectProtocol : AnyObject
The NSObjectProtocol
groups methods that are fundamental to all Foundation objects.
protocol NSSecureCoding : NSCoding
Conforming to the NSSecureCoding
protocol indicates that an object handles encoding and decoding instances of itself in a manner that is robust against object substitution attacks.
init(attributedString: NSAttributedString)
Returns an NSAttributedString object initialized with the characters and attributes of another given attributed string.
required init?(coder aDecoder: NSCoder)
init(string: String)
Returns an NSAttributedString object initialized with the characters of a given string and no attribute information.
init(string: String, attributes attrs: [NSAttributedString.Key : Any]? = nil)
Returns an NSAttributedString object initialized with a given string and attributes.
static var supportsSecureCoding: Bool { get }
override var description: String { get }
var length: Int { get }
The length of the receiver’s string object.
var string: String { get }
The character contents of the receiver as an NSString object.
func attribute(_ attrName: NSAttributedString.Key, at location: Int, effectiveRange range: NSRangePointer?) -> Any?
Returns the value for an attribute with a given name of the character at a given index, and by reference the range over which the attribute applies.
func attribute(_ attrName: NSAttributedString.Key, at location: Int, longestEffectiveRange range: NSRangePointer?, in rangeLimit: NSRange) -> Any?
Returns the value for the attribute with a given name of the character at a given index, and by reference the range over which the attribute applies.
func attributedSubstring(from range: NSRange) -> NSAttributedString
Returns an NSAttributedString object consisting of the characters and attributes within a given range in the receiver.
func attributes(at location: Int, effectiveRange range: NSRangePointer?) -> [NSAttributedString.Key : Any]
Returns the attributes for the character at a given index.
func attributes(at location: Int, longestEffectiveRange range: NSRangePointer?, in rangeLimit: NSRange) -> [NSAttributedString.Key : Any]
Returns the attributes for the character at a given index, and by reference the range over which the attributes apply.
override func copy() -> Any
func copy(with zone: NSZone? = nil) -> Any
func encode(with aCoder: NSCoder)
func enumerateAttribute(_ attrName: NSAttributedString.Key, in enumerationRange: NSRange, options opts: NSAttributedString.EnumerationOptions = [], using block: (Any?, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void)
Executes the block for the specified attribute run in the specified range.
func enumerateAttributes(in enumerationRange: NSRange, options opts: NSAttributedString.EnumerationOptions = [], using block: ([NSAttributedString.Key : Any], NSRange, UnsafeMutablePointer<ObjCBool>) -> Void)
Executes the block for each attribute in the range.
override func isEqual(_ object: Any?) -> Bool
func isEqual(to other: NSAttributedString) -> Bool
Returns a Boolean value that indicates whether the receiver is equal to another given attributed string.
override func mutableCopy() -> Any
func mutableCopy(with zone: NSZone? = nil) -> Any
struct EnumerationOptions
struct Key
class NSMutableAttributedString