{"id":17430,"date":"2017-03-15T15:19:51","date_gmt":"2017-03-15T19:19:51","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=17430"},"modified":"2017-03-15T15:19:51","modified_gmt":"2017-03-15T19:19:51","slug":"that-one-optional-property","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2017\/03\/15\/that-one-optional-property\/","title":{"rendered":"That One Optional Property"},"content":{"rendered":"<p><a href=\"http:\/\/khanlou.com\/2017\/03\/that-one-optional-property\/\">Soroush Khanlou<\/a>:<\/p>\n<blockquote cite=\"http:\/\/khanlou.com\/2017\/03\/that-one-optional-property\/\">\n<p>Other code in the view controller switched on the message&rsquo;s existence to determine which views to allocate, how to lay them out, and so on. The optionality of the property represents more than existence of a simple string. It had implications in the rest of the view controller and the rest of the view layer.<\/p>\n<p>The more essential point here is that the string now no longer represents a string that might be there or might not &mdash; it now represents the <em>presentation style<\/em> or <em>mode<\/em> that the view controller is in. Was it created in the context of a push notification or through normal browsing? The answer is in this barely related property!<\/p>\n<\/blockquote>\n<p>His solution is to replace it with an enum or a promise, both of which have other benefits besides clarity.<\/p>","protected":false},"excerpt":{"rendered":"<p>Soroush Khanlou: Other code in the view controller switched on the message&rsquo;s existence to determine which views to allocate, how to lay them out, and so on. The optionality of the property represents more than existence of a simple string. It had implications in the rest of the view controller and the rest of the [&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":[69,31,1380,30,1381,71,901],"class_list":["post-17430","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-cocoa","tag-ios","tag-ios-10","tag-mac","tag-macos-10-12","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17430","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=17430"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17430\/revisions"}],"predecessor-version":[{"id":17431,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/17430\/revisions\/17431"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=17430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=17430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=17430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}