Creates an attributed string with specified string and attributes.


func CFAttributedStringCreate(_ alloc: CFAllocator!, _ str: CFString!, _ attributes: CFDictionary!) -> CFAttributedString!



The allocator to use to allocate memory for the new attributed string. Pass NULL or kCFAllocatorDefault to use the current default allocator.


A string that specifies the characters to use in the new attributed string. This value is copied.


A dictionary that contains the attributes to apply to the new attributed string. This value is copied.

Return Value

An attributed string that contains the characters from str and the attributes specified by attributes. The result is NULL if there was a problem in creating the attributed string. Ownership follows the The Create Rule.


Note that both the string and the attributes dictionary are copied. The specified attributes are applied to the whole string. If you want to apply different attributes to different ranges of the string, you should use a mutable attributed string.

See Also

Creating a CFAttributedString