One Logo Pool Ball
Foundation · IOS API REFERENCE

NSAttributedString

class · iOS 3.2+ · SDK 27.1

class NSAttributedString

Members (18)

method

attribute

TypeScript
attributeAtEffectiveRange(attrName: NSAttributedString_Key, location: number, range?: (SDKHandle) | null): (unknown) | null
Swift declaration
func attribute(_ attrName: NSAttributedString.Key, at location: Int, effectiveRange range: NSRangePointer?) -> Any?
method

attribute

TypeScript
attributeAtLongestEffectiveRangeIn(attrName: NSAttributedString_Key, location: number, range: (SDKHandle) | null, rangeLimit: SDKHandle): (unknown) | null
Swift declaration
func attribute(_ attrName: NSAttributedString.Key, at location: Int, longestEffectiveRange range: NSRangePointer?, in rangeLimit: NSRange) -> Any?
method · iOS 15.0+

inflecting

TypeScript
inflecting(): NSAttributedString
Swift declaration
func inflecting() -> NSAttributedString
method

attributedSubstring

TypeScript
attributedSubstring(range: SDKHandle): NSAttributedString
Swift declaration
func attributedSubstring(from range: NSRange) -> NSAttributedString
method · iOS 3.2+

attributes

TypeScript
attributesAtEffectiveRange(location: number, range?: (SDKHandle) | null): NativeMap<NSAttributedString_Key, unknown>
Swift declaration
func attributes(at location: Int, effectiveRange range: NSRangePointer?) -> [NSAttributedString.Key : Any]
method

attributes

TypeScript
attributesAtLongestEffectiveRangeIn(location: number, range: (SDKHandle) | null, rangeLimit: SDKHandle): NativeMap<NSAttributedString_Key, unknown>
Swift declaration
func attributes(at location: Int, longestEffectiveRange range: NSRangePointer?, in rangeLimit: NSRange) -> [NSAttributedString.Key : Any]
method · iOS 4.0+

enumerateAttribute

TypeScript
enumerateAttribute(attrName: NSAttributedString_Key, enumerationRange: SDKHandle, opts: NSAttributedString_EnumerationOptions, block: ((arg0: (unknown) | null, arg1: SDKHandle, arg2: NativeOut<boolean>) => void)): void
Swift declaration
func enumerateAttribute(_ attrName: NSAttributedString.Key, in enumerationRange: NSRange, options opts: NSAttributedString.EnumerationOptions = [], using block: (Any?, NSRange, UnsafeMutablePointer<ObjCBool>) -> Void)
method · iOS 4.0+

enumerateAttributes

TypeScript
enumerateAttributes(enumerationRange: SDKHandle, opts: NSAttributedString_EnumerationOptions, block: ((arg0: NativeMap<NSAttributedString_Key, unknown>, arg1: SDKHandle, arg2: NativeOut<boolean>) => void)): void
Swift declaration
func enumerateAttributes(in enumerationRange: NSRange, options opts: NSAttributedString.EnumerationOptions = [], using block: ([NSAttributedString.Key : Any], NSRange, UnsafeMutablePointer<ObjCBool>) -> Void)
init

init

TypeScript
static initAttributedString(attrStr: NSAttributedString): NSAttributedString
Swift declaration
init(attributedString attrStr: NSAttributedString)
init

init

TypeScript
static initString(str: string): NSAttributedString
Swift declaration
init(string str: String)
init

init

TypeScript
static initStringAttributes(str: string, attrs?: (NativeMap<NSAttributedString_Key, unknown>) | null): NSAttributedString
Swift declaration
init(string str: String, attributes attrs: [NSAttributedString.Key : Any]? = nil)
method

isEqual

TypeScript
isEqual(other: NSAttributedString): boolean
Swift declaration
func isEqual(to other: NSAttributedString) -> Bool
get

length

TypeScript
get length(): number
Swift declaration
var length: Int { get }
get · iOS 3.2+

string

TypeScript
get string(): string
Swift declaration
var string: String { get }
init · iOS 15.0+

init

TypeScript
static initContentsOfOptionsBaseURL(url: string, options?: AttributedString_MarkdownParsingOptions, baseURL?: (string) | null): NSAttributedString
Swift declaration
convenience init(contentsOf url: URL, options: AttributedString.MarkdownParsingOptions = .init(), baseURL: URL? = nil) throws

Creates an attributed string from the contents of a specified URL that contains Markdown-formatted data using the provided options. - Parameters: - url: The URL to load Markdown-formatted data from. - options: Options that affect how the initializer interprets formatting in the Markdown string. This parameter defaults to no options. - baseURL: The base URL to use when resolving Markdown URLs. If this value is `nil`, the initializer doesn't resolve URLs. The default is `nil`.

init · iOS 15.0+

init

TypeScript
static initMarkdownOptionsBaseURL(markdown: string, options?: AttributedString_MarkdownParsingOptions, baseURL?: (string) | null): NSAttributedString
Swift declaration
convenience init(markdown: String, options: AttributedString.MarkdownParsingOptions = .init(), baseURL: URL? = nil) throws

Creates an attributed string from a Markdown-formatted string using the provided options. - Parameters: - markdown: The string that contains the Markdown formatting. - options: Options that affect how the initializer interprets formatting in the Markdown string. This parameter defaults to no options. - baseURL: The base URL to use when resolving Markdown URLs. If this value is `nil`, the initializer doesn't resolve URLs. The default is `nil`.

init · iOS 15.0+

init

TypeScript
static initMarkdownOptionsBaseURL61257(markdown: ArrayBuffer, options?: AttributedString_MarkdownParsingOptions, baseURL?: (string) | null): NSAttributedString
Swift declaration
convenience init(markdown: Data, options: AttributedString.MarkdownParsingOptions = .init(), baseURL: URL? = nil) throws

Creates an attributed string from Markdown-formatted data using the provided options. - Parameters: - markdown: The data that contains the Markdown formatting. - options: Options that affect how the initializer interprets formatting in the Markdown string. This parameter defaults to no options. - baseURL: The base URL to use when resolving Markdown URLs. If this value is `nil`, the initializer doesn't resolve URLs. The default is `nil`.

init · iOS 15.0+

init

TypeScript
static init(attrStr: AttributedString): NSAttributedString
Swift declaration
convenience init(_ attrStr: AttributedString)

Creates a reference-type attributed string from the specified value-type attributed string. This initializer includes all attribute scopes defined by the SDK, such as `FoundationAttributes`, `SwiftUIAttributes`, and `AccessibilityAttributes`. To use third-party attribute scopes, use the initializers that accept an `including` parameter. - Parameters: - attrStr: The value type attributed string that provides the text and attributes of the new object.

Skipped declarations

3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

NSAttributedString.init(_:including:)

Passing a Swift type itself is not supported.

NSAttributedString.init(_:including:)

Passing a Swift type itself is not supported.

NSAttributedString.init()

inherited init: cannot prove legal (class declares 9 custom initializers)

All Foundation types →