(DIR) Home
 (DIR) Blog posts
       
       Conditional conformance in Swift 4.2
       
       7 June, 2018
       
       QUOTE
       This post was translated from HTML, inevitably some things will have changed or no longer apply - July 2025
       END QUOTE
       
       Exciting new stuff coming out of WWDC this week, including info on what's new in Swift 4.2.
       
       Swift 4.2 comes with Xcode 10.0 beta, and among other goodies includes some changes to how protocols apply to arrays. I've just updated an earlier post on this (Is serializable really a word?), but it's worth repeating here: this is exciting stuff. Now, with the single line:
       
 (DIR) Is serializable really a word?
       CODE
       extension Array: Serializable where Element: Serializable {}
       END CODE
       
       ...the Serializable protocol I wrote applies to all arrays of Serializable elements. That is so clean it is to my eyes simply beautiful. Testament to a lot of hard work.
       
       This info come via the talk "What's new in Swift?", worth watching as as ever are all the other WWDC videos.
       
 (HTM) WWDC videos