LawTze-Kun LawTze-Kun - 9 months ago 51
Objective-C Question

Objective-C equivalent of UnsafePointer<CChar>

I try to write on Objective-C the Swift codes written on this tutorial.

I almost written all of it to Objective-C except for this part:

let tokenChars = UnsafePointer<CChar>(deviceToken.bytes)

My question is how can I write that part from Swift to Objective-C?


Remember that Objective-C is a superset of C so you can look here to find out the answer:

Interacting with C APIs: Pointers

C Syntax     | Swift Syntax
const Type * | UnsafePointer<Type>
Type *       | UnsafeMutablePointer<Type>

So a Swift UnsafePointer<CChar> is a Objective-C const CChar *