Swift 3 And Beyond

On December 3, 2015, the Swift language was released as open source. It also involves a roadmap for Swift 3, which will be released in fall 2016.

API Design Guidelines And Swift’s Objective-C Importer

Swift 3 will have API design guidelines that are different to the Cocoa guidelines for Objective-C.  This also means that Objective-C API will be mapped differently to Swift than before. There is one example on the corresponding GitHub page. Take a look at this method call that you would use with the existing Objective-C to Swift mapping:

With Swift 3, the call will look as follows:

It looks much more “Swifty”. However, it also means that imported API of Objective-C will change massively, so that existing code will break.

Complete Generics

Swift has Generics, but the goal is to introduce new features for generics, like “recursive protocol constraints, the ability to make a constrained extension conform to a new protocol (i.e., an array of Equatable elements is Equatable )”.

Refined Language

There will also be some small changes to language features that “don’t fit well with the language as a whole” – whatever this means. Again, it is very likely that this will break existing code.

Beyond Swift 3

  • Swift doesn’t have language support for concurrency yet. Instead, you have to use objects like NSOpertion or dispatch queues. This will not change with Swift 3. However, in the future (Swift 4?) there could be a complete language support for concurrency.
  • Swift has a very good interoperability with C and especially Objective-C. However, it lacks interoperability with C++. This will not change with Swift 3, but it is a long term goal to introduce it.

Conclusion

First of all, it is very good news that Swift will improve massively in the future. On the other hand, it will also break existing Swift 2 code so you’ll have to do some migration work.

References

Swift.org
Swift Programming Language Evolution
Image: @ chrisdorney / shutterstock.com

Book Tip

Big Nerd Range Guide: iOS Programming: Excellent introduction to iOS development. Some programming experience is recommended.

Amazon