{"id":20375,"date":"2018-01-31T14:38:57","date_gmt":"2018-01-31T19:38:57","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=20375"},"modified":"2018-01-31T14:38:57","modified_gmt":"2018-01-31T19:38:57","slug":"swift-tip-opaquepointer-vs-unsafepointer","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/01\/31\/swift-tip-opaquepointer-vs-unsafepointer\/","title":{"rendered":"Swift Tip: OpaquePointer vs. UnsafePointer"},"content":{"rendered":"<p><a href=\"https:\/\/www.objc.io\/blog\/2018\/01\/30\/opaque-vs-unsafe-pointers\/\">objc.io<\/a>:<\/p>\n<blockquote cite=\"https:\/\/www.objc.io\/blog\/2018\/01\/30\/opaque-vs-unsafe-pointers\/\">\n<p>When a struct <code>person<\/code> is completely defined in the header file, any pointers to it will be imported by Swift as <code>UnsafePointer&lt;person&gt;<\/code>. This means we can also dereference the pointers, and look at the contents by calling <code>.pointee<\/code> on the pointer.<\/p>\n<p>[&#8230;]<\/p>\n<p>Because <code>account<\/code> is only in the [implementation] file, it&rsquo;s called an opaque (or sometimes: incomplete) type: from the outside, we don&rsquo;t know anything about it.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>objc.io: When a struct person is completely defined in the header file, any pointers to it will be imported by Swift as UnsafePointer&lt;person&gt;. This means we can also dereference the pointers, and look at the contents by calling .pointee on the pointer. [&#8230;] Because account is only in the [implementation] file, it&rsquo;s called an opaque [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[45,46,71,901],"class_list":["post-20375","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-c","tag-languagedesign","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=20375"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20375\/revisions"}],"predecessor-version":[{"id":20376,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20375\/revisions\/20376"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=20375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=20375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=20375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}