{"id":20868,"date":"2018-03-13T15:35:47","date_gmt":"2018-03-13T19:35:47","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=20868"},"modified":"2018-05-01T14:35:20","modified_gmt":"2018-05-01T18:35:20","slug":"swift-4-1-conditional-conformance-is-amazing","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2018\/03\/13\/swift-4-1-conditional-conformance-is-amazing\/","title":{"rendered":"Swift 4.1 Conditional Conformance Is Amazing"},"content":{"rendered":"<p><a href=\"https:\/\/twitter.com\/stephencelis\/status\/971818140169629696\">Stephen Celis<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/stephencelis\/status\/971818140169629696\">\n<p>Here&rsquo;s a <a href=\"https:\/\/github.com\/pointfreeco\/swift-prelude\/blob\/2a383bd280f331e48da4361dd8ad604b18186276\/Sources\/NonEmpty\/NonEmpty.swift#L51-L115\">non-empty collection type<\/a> that works with any collection.<\/p>\n<p>Wrapping a <code>MutableCollection<\/code> type gives the non-empty type all those methods for free!<\/p>\n<\/blockquote>\n<p>Previously: <a href=\"https:\/\/mjtsai.com\/blog\/2018\/01\/08\/conditional-conformance-in-the-standard-library\/\">Conditional Conformance in the Standard Library<\/a>.<\/p>\n\n<p>Update (2018-03-23): See also: <a href=\"https:\/\/spec.fm\/podcasts\/swift-unwrapped\/125759\">Swift Unwrapped<\/a>.<\/p>\n\n<p>Update (2018-03-27): See also: <a href=\"https:\/\/spec.fm\/podcasts\/swift-unwrapped\/125760\">Swift Unwrapped<\/a>.<\/p>\n\n<p>Update (2018-05-01): See also: <a href=\"https:\/\/oleb.net\/blog\/2018\/04\/swift-4-1\/\">Ole Begemann<\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Stephen Celis: Here&rsquo;s a non-empty collection type that works with any collection. Wrapping a MutableCollection type gives the non-empty type all those methods for free! Previously: Conditional Conformance in the Standard Library. Update (2018-03-23): See also: Swift Unwrapped. Update (2018-03-27): See also: Swift Unwrapped. Update (2018-05-01): See also: Ole Begemann.<\/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":"2018-05-01T18:35:22Z","apple_news_api_id":"fbbe4de2-6729-49b4-8ed2-df2ad0fe813d","apple_news_api_modified_at":"2018-05-01T18:35:23Z","apple_news_api_revision":"AAAAAAAAAAD\/\/\/\/\/\/\/\/\/\/w==","apple_news_api_share_url":"https:\/\/apple.news\/A-75N4mcpSbSO0t8q0P6BPQ","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":[],"tags":[46,71,901],"class_list":["post-20868","post","type-post","status-publish","format-standard","hentry","tag-languagedesign","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20868","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=20868"}],"version-history":[{"count":4,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20868\/revisions"}],"predecessor-version":[{"id":21391,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/20868\/revisions\/21391"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=20868"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=20868"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=20868"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}