Posts

Showing posts from July, 2017

What’s New in Swift

This article is just a short overview of this WWDC session. Here are the few things that were discussed as part of the session: 1.) Private variables are now accessible to all the extensions of the class in the same file. 2.) Composing a class with any number of protocols. Example :   protocol  Shakeable {      func  shake() } extension   UIButton :  Shakeable  {} extension   UISlider :  Shakeable  {} func  shakeControls(controls: [ UIControl  &  Shakeable ] ) {      for  control  in  controls  where  control.state.isEnabled {          control.shake()      } } 3.) Swift Versions: Swift 4 is source-compatible with Swift3. Swift3.2 introduced that contains most of the Swift4 syntax changes. So, there will be 2 Swift versions in Xcode9: Swift3.2   & Swift4. The end result is: If you open a Swift 3 project in Xcode9 and build the project with Swift3.2, it should work as it is, i.e., without any code changes. This is mainl