I am trying to convert an ObjC class that uses Facebook\'s pop library to Swift. Pop uses quite a bit of C.
In ObjC, I have a block that looks like this...
EDIT: Just wanted to clarify a few things after learning a bit more from the online documentation (PDF).
There are a few commonly used pointer types in Swift, here is how they map to C equivalents:
CConstVoidPointer => const void *
CMutableVoidPointer => void *
CConstPointer => const Type *
CMutablePointer => Type *
COpaquePointer => void *
UnsafePointer => Type *
NOTE: Arguments follow this rule only when they are more than one pointer level deep, otherwise see above.
CConstPointer => Type * const *
CMutablePointer => Type * __strong *
AutoreleasingUnsafePointer => Type **
When using the CConstPointer pointer in Swift, you may pass any one of these:
nil, which will be evaluated as a NULL pointerCConstPointer valueCConstVoidPointer valueCMutablePointer valueCMutableVoidPointerAutoreleasingUnsafePointer value which will be converted to CConstPointer if necessaryType value passed by address (& operator)Type[] arrayNOTE:CConstVoidPointer can take any of the above values as well.
When using the CMutablePointer pointer in Swift, you may pass any one of these:
nil, which will be evaluated as a NULL pointerCMutablePointer valueType value passed by address (& operator)Type[] array passed by address (& operator) NOTE:CMutableVoidPointer can take any of the above in addition to CMUtableVoidPointer values.
So it would seem in your case that a CMutablePointer could also be a pointer to an array of CGFloat values. Though I am not completely sure how to dereference that in Swift. (Perhaps the as operator?)