Wednesday, January 31, 2018

Swift Tip: OpaquePointer vs. UnsafePointer

objc.io:

When a struct person is completely defined in the header file, any pointers to it will be imported by Swift as UnsafePointer<person>. This means we can also dereference the pointers, and look at the contents by calling .pointee on the pointer.

[…]

Because account is only in the [implementation] file, it’s called an opaque (or sometimes: incomplete) type: from the outside, we don’t know anything about it.

Comments RSS · Twitter

Leave a Comment