Open ClassFoundation5.9.0
NSAttributedString
class NSAttributedString
Superclasses
class NSObject
The root class of most Foundation class hierarchies.
Citizens in Foundation
Conformances
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
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 adoptNSCopying
instead.protocol NSObjectProtocol
The
NSObjectProtocol
groups methods that are fundamental to all Foundation objects.protocol NSSecureCoding
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.
Members
convenience init(AttributedString
) convenience init<S>(AttributedString, including: KeyPath<AttributeScopes, S.Type>
) throws convenience init<S>(AttributedString, including: S.Type
) throws convenience init<S>(AttributedString, includingOnly: KeyPath<AttributeScopes, S.Type>
) throws convenience init<S>(AttributedString, includingOnly: S.Type
) throws init(attributedString: NSAttributedString
) Returns an NSAttributedString object initialized with the characters and attributes of another given attributed string.
init?(coder: NSCoder
) init(string: String
) Returns an NSAttributedString object initialized with the characters of a given string and no attribute information.
init(string: String, attributes: [NSAttributedString.Key : Any]?
) Returns an NSAttributedString object initialized with a given string and attributes.
static var supportsSecureCoding: Bool
var description: String
var length: Int
The length of the receiver’s string object.
var string: String
The character contents of the receiver as an NSString object.
func attribute(NSAttributedString
.Key, at: Int, effectiveRange: 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(NSAttributedString
.Key, at: Int, longestEffectiveRange: NSRangePointer?, in: 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: NSRange
) -> NSAttributedString Returns an NSAttributedString object consisting of the characters and attributes within a given range in the receiver.
func attributes(at: Int, effectiveRange: NSRangePointer?
) -> [NSAttributedString.Key : Any] Returns the attributes for the character at a given index.
func attributes(at: Int, longestEffectiveRange: NSRangePointer?, in: NSRange
) -> [NSAttributedString.Key : Any] Returns the attributes for the character at a given index, and by reference the range over which the attributes apply.
func copy(
) -> Any func copy(with: NSZone?
) -> Any func encode(with: NSCoder
) func enumerateAttribute(NSAttributedString
.Key, in: NSRange, options: NSAttributedString.EnumerationOptions, using: (Any?, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void) Executes the block for the specified attribute run in the specified range.
func enumerateAttributes(in: NSRange, options: NSAttributedString.EnumerationOptions, using: ([NSAttributedString.Key : Any], NSRange, UnsafeMutablePointer<ObjCBool>) -> Void
) Executes the block for each attribute in the range.
func isEqual(Any
?) -> Bool func isEqual(to: NSAttributedString
) -> Bool Returns a Boolean value that indicates whether the receiver is equal to another given attributed string.
func mutableCopy(
) -> Any func mutableCopy(with: NSZone?
) -> Any struct EnumerationOptions
struct Key