Posts

Showing posts from 2019

What's new in Swift 5.1

Already under its beta version, Swift 5.1 has introduced many of the  keystone features. Let's begin with the list: I mproved synthesized memberwise initializers SE-0242  introduces major improvements to one of Swift’s most commonly used features: memberwise initializers for structs. In earlier versions of Swift, a memberwise initializer was automatically created to accept parameters matching the properties of a struct, like this: struct User { var name : String var address : String = "Not found" } let obj = User ( name : "Darshan Joshi" , address : " myblog " ) With Swift 5.1 this has been enhanced so that the memberwise initializer now uses default parameter values for any properties that have them. In the  User  struct, we’ve given  address  a default value of "Not found", which means we can either specify it or leave it to the memberwise initializer: Implicit returns from single-expressio