CFBridgingRetain(_:)
Casts an Objective-C pointer to a Core Foundation pointer and also transfers ownership to the caller.
Declaration
func CFBridgingRetain(_ X: Any?) -> CFTypeRef?Discussion
You use this function to cast an Objective-C object as Core Foundation-style object and take ownership of the object so that you can manage its lifetime. You are responsible for subsequently releasing the object, as illustrated in this example:
NSString *string = <#Get a string#>;
CFStringRef cfString = (CFStringRef)CFBridgingRetain(string);
// Use the CF string.
CFRelease(cfString);