Instance Method

attributedSubstring(from:)

Returns an NSAttributedString object consisting of the characters and attributes within a given range in the receiver.

Declaration

func attributedSubstring(from range: NSRange) -> NSAttributedString

Parameters

aRange

The range from which to create a new attributed string. aRange must lie within the bounds of the receiver.

Return Value

An NSAttributedString object consisting of the characters and attributes within aRange in the receiver.

Discussion

Raises an rangeException if any part of aRange lies beyond the end of the receiver’s characters. This method treats the length of the string as a valid range value that returns an empty string.