{"id":24594,"date":"2019-03-13T15:57:12","date_gmt":"2019-03-13T19:57:12","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=24594"},"modified":"2019-03-13T15:57:12","modified_gmt":"2019-03-13T19:57:12","slug":"exhaustive-swift-properties-with-tuples","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2019\/03\/13\/exhaustive-swift-properties-with-tuples\/","title":{"rendered":"Exhaustive Swift Properties With Tuples"},"content":{"rendered":"<p><a href=\"http:\/\/www.figure.ink\/blog\/2019\/3\/3\/exhaustive-properties-with-tuples\">Joshua Emmons<\/a>:<\/p>\n<blockquote cite=\"http:\/\/www.figure.ink\/blog\/2019\/3\/3\/exhaustive-properties-with-tuples\">\n<p>How can we get <code>switch<\/code>-like exhaustiveness when dealing with the properties of a type? The first step (and our first clue) is to treat the properties as a set. What if we put them in a tuple?<\/p>\n<p>[&#8230;]<\/p>\n<p>So, to be clear, habitually shoving all properties into a tuple won&rsquo;t scale well. But it <em>is<\/em> a useful tactic to employ when dealing with models, mocks or anything that has: <\/p>\n<ol>\n<li>naturally constrained state, <\/li>\n<li>logic that depends on the shape of said state, and<\/li>\n<li>a strong affinity towards change in the face of shifting requirements<\/li>\n<\/ol>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Joshua Emmons: How can we get switch-like exhaustiveness when dealing with the properties of a type? The first step (and our first clue) is to treat the properties as a set. What if we put them in a tuple? [&#8230;] So, to be clear, habitually shoving all properties into a tuple won&rsquo;t scale well. But [&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":"2019-03-13T19:57:15Z","apple_news_api_id":"808a1b56-8d92-4f2a-bcf5-5a8dcb002b78","apple_news_api_modified_at":"2019-03-13T19:57:16Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/AgIobVo2STyq89VqNywAreA","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":[71,901],"class_list":["post-24594","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24594","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=24594"}],"version-history":[{"count":1,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24594\/revisions"}],"predecessor-version":[{"id":24595,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/24594\/revisions\/24595"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=24594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=24594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=24594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}