- iOS 2.0+
- macOS 10.0+
- tvOS 9.0+
- watchOS 2.0+
A CFCharacterSet object represents a set of Unicode compliant characters. CFString uses CFCharacterSet objects to group characters together for searching operations, so that they can find any of a particular set of characters during a search. The two opaque types, CFCharacterSet and CFMutableCharacterSet, define the interface for static and dynamic character sets, respectively. The objects you create using these opaque types are referred to as character set objects (and when no confusion will result, merely as character sets).
CFCharacterSet's principal function,
CFCharacter, provides the basis for all other functions in its interface. You create a character set using one of the
CFCharacter functions. You may also use any one of the predefined character sets using the
CFCharacterSet is “toll-free bridged” with its Cocoa Foundation counterpart,
NSCharacter. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an
NSCharacter parameter, you can pass in a
CFCharacter, and in a function where you see a
CFCharacter parameter, you can pass in an NSCharacterSet instance. This capability also applies to concrete subclasses of NSCharacterSet. See Toll-Free Bridged Types for more information on toll-free bridging.