{"id":16418,"date":"2016-11-17T10:59:09","date_gmt":"2016-11-17T15:59:09","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=16418"},"modified":"2016-11-17T11:00:14","modified_gmt":"2016-11-17T16:00:14","slug":"mixing-swift-initializers","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2016\/11\/17\/mixing-swift-initializers\/","title":{"rendered":"Mixing Swift Initializers"},"content":{"rendered":"<p><a href=\"http:\/\/www.russbishop.net\/mixing-initializers\">Russ Bishop<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.russbishop.net\/mixing-initializers\">\n<p>Let&rsquo;s say you have a type with a failable initializer. Now you want to extend that type to support deserializing from JSON. You throw nice detailed errors if JSON parsing fails and you&rsquo;d like to throw if anything goes wrong[&#8230;] There are two problems here. One is that we can&rsquo;t delegate to a failable initializer. [&#8230;] The second is there is no syntax to checking the result of calling the failable initializer even if we could; <code>self<\/code> is only optional in the context of a failable initializer.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Russ Bishop: Let&rsquo;s say you have a type with a failable initializer. Now you want to extend that type to support deserializing from JSON. You throw nice detailed errors if JSON parsing fails and you&rsquo;d like to throw if anything goes wrong[&#8230;] There are two problems here. One is that we can&rsquo;t delegate to a [&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":[46,71,901],"class_list":["post-16418","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-languagedesign","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16418","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=16418"}],"version-history":[{"count":3,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16418\/revisions"}],"predecessor-version":[{"id":16421,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/16418\/revisions\/16421"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=16418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=16418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=16418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}