4
  1. Can any one explain me what is '__bridge_transfer' and '_bridge' & when to use '_bridge_transfer' and '__bridge'
  2. I read something like its deals with ARC, So what is the main function of these both

Thanks,

user2361155
  • 83
  • 1
  • 9

1 Answers1

9

These keywords are used to tell to ARC system how to handle your non-objective-c pointers. In essence, if you use __bridge, you are telling to ARC not to deal with the ownership of the converted pointer because you will free it from non-objective-c code, most likely with a free() or a CFRelease... type function. __bridge_transfer, on the other hand, transfers the ownership to ARC and ARC will free your objective-c (and thus also the original non-objective-c) object via the standard release mechanism when the references to that object hits zero.

MrTJ
  • 13,064
  • 4
  • 41
  • 63