Toll free bridges

As a newcomer to iPhone development and Objective-C in general over the last few weeks I have come across numerous mentions of 'Toll free bridges' between CF and NS frameworks.

One particular example would be CFStream and NSStream.

Does a resource exists documenting all of these bridges and how to use them ? Is it just as simple as casting from an object of one type to another ?

I ask as at the moment I am using NSStream calls that are not stricly allowed within the iPhone SDK and understand that I should be using CFStream calls.

EDIT: A useful article about how TFB works

Answers


Toll-free bridging means that the data structures are interchangeable. It is just as simple as casting — that's the "toll-free" part. Anyplace you can use the type on one side of the bridge, you can use the other. So, for example, you can create a CFString and then send NSString messages to it, or you can create an NSArray and pass the array to CFArray functions.

Apple keeps a list of the supported toll-free bridged types on its site.


Toll-free-bridging, although a funny name, is a very cool feature of the CoreFoundation classes. Essentially it boils down to the fact that you can cast between CoreFoundation and NextStep classes of the same name (CFString<->NSString, CFData<->NSData, CFDictionary<->NSDictionary... just to name some of the most commonly used.)

|K<


Need Your Help

how make float to integer in awk

awk

I have a variable in my awk code . after some arithmatic operation on this variable and printing (print $1,$2,variable) the result is made like below:

Disabling Hibernate Validation on save/update with Hibernate 3.6.0.Final

hibernate validation

I just started upgrading an application that used Hibernate 3.5.6.Final to 3.6.0.Final, and there has been several hickups. The last hickup I can't find a solution for.