This is an advanced data type for use with macOS and iOS API calls to handle OS strings.


CFStringRef implicitly converts to String when assigned to a String variable.

Memory management

The Xojo framework handles memory management of CFStringRefs smartly. Based on rules explained under Apple's Create Rule, a call to a declared function will either retain (CFRetain) the retrieved value or not. Once the CFStringRef object goes out of scope (i.e. it's no longer referenced by Xojo code), it will be released by calling CFRelease. That means that you usually do not have to worry about proper Retain/Release calls for CFStringRef objects you retrieve using declares.


All project types on all supported operating systems.

See also

Declare statements; String data type