Toll free bridges

前端 未结 2 1141
感动是毒
感动是毒 2020-12-08 04:34

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 framew

相关标签:
2条回答
  • 2020-12-08 05:07

    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.

    0 讨论(0)
  • 2020-12-08 05:20

    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<

    0 讨论(0)
提交回复
热议问题