LawTze-Kun
LawTze-Kun

Reputation: 67

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?

Upvotes: 0

Views: 716

Answers (1)

user887210
user887210

Reputation:

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

Interacting with C APIs

C Syntax          | Swift Syntax
------------------+----------------------------
char, signed char | CChar
const Type *      | UnsafePointer<Type>

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

Upvotes: 1

Related Questions