Wednesday, January 31, 2018 [Tweets] [Favorites]

Swift Tip: OpaquePointer vs. UnsafePointer

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.


Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment