TollFreeBridging

last edited March 22, 2006 06:47:31 (67.42.156.234)
CocoaDev is sponsored by: Panic: Shockingly good Mac software!

CocoaGlossary:Concepts (Cocoa)

TollFreeBridging is what allows you to take CoreFoundation types and typecast them to Cocoa types (and vice versa).

So, if you have to call a CoreFoundation function that takes a CFString, but you have an NSString, you can just pass it your NSString with:

CFStringRef myCFString = (CFStringRef)someNSString;

And if you need to get an NSString from a CFString, you can do this:

NSString* myNSString = (NSString*)someCFString;

see also: HowToCreateTollFreeBridgedClass

See which classes are TollFreeBridged.