Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 621
Dean Smith Avatar asked Apr 30 '09 09:04

Dean Smith


People also ask

Is the Williamsburg bridge free?

Currently the bridge transports about 140,000 motorists, 92,000 transit riders, 600 bikers and 500 pedestrians between the two boroughs. The bridge is toll free.

Is the Manhattan Bridge free?

The Manhattan Bridge is a suspension bridge that crosses the East River connecting Lower Manhattan at Canal Street with Downtown Brooklyn at the Flatbush Avenue Extension. It is a toll-free bridge.


1 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.

like image 67
Chuck Avatar answered Sep 26 '22 07:09

Chuck