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:
let contentString = listItemView.stringValue.stringByTrimmingCharactersInSet( NSCharacterSet.whitespaceAndNewlineCharacterSet())
With Swift 3, the call will look as follows:
let content = listItem.stringValue.trimming(.whitespaceAndNewlines)
It looks much more “Swifty”. However, it also means that imported API of Objective-C will change massively, so that existing code will break.
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 )”.
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.
[thrive_text_block color=”blue” headline=”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.[/thrive_text_block]