There once was a language called Swift
Proposals and fix-its caused drift
to existing code bases,
if statements, switch cases;
But newsletters help bridge the rift
I don’t know about you but I’m still recovering from all the WWDC excitement. 😓
Keeping us on our toes, the folks at Apple have released a second round of OS betas and Xcode seeds. Check out the developer portal and the Xcode 9 Beta 2 release notes in particular for the latest on improvements and known issues in the bundled Swift 4.
Sponsored Link
Advanced Swift Workshops
Sharpen your Swift skills and learn in depth topics in this one day workshop. World renowned guy and occasional Swift expert Mike Ash will lead you through an exploration of protocols, generics, reflection, and C bridging. July 13th in Washington, DC, and July 24th in New York City.
Starter tasks
Writing tests is a great way to learn about the standard library and language, and also helps the project by preventing future regressions.
- SR-4824: Add tests to check Collection constraints are being enforced
- SR-5040: Convert “exclude” related functional tests to unit test
Submit a task by sending a pull request or opening an issue.
Swift Unwrapped
In Episode 16: Error Handling in Swift — A History, your hosts say the words “rethrows” and “types” many times, reminisce about Objective-C, and uncover the history of error handling in Swift.
News and community
Swift team superstar Joe Groff is taking a Twitter break. Joe has always been helpful and responsive to the community over Twitter, and we wish him a good break and safe return! 🚣
Speaking of Joe, his former intern Chris Lattner (who you might have heard of) is back on the job market. While he has an impressive seven years of Swift experience, I suspect most companies will be looking for someone with ten. ¯\_(ツ)_/¯
Now that Xcode 9 and Swift 4 are in beta, it’s good to look back at all the proposals that made it into the language. Check out What’s New in Swift 4? by Eric Cerney for an excellent summary.
Ankit Aggarwal wrote a post on the Swift blog, Swift Package Manager Manifest API Redesign, describing the new manifest API. Swift package descriptions are written in Swift, and the new API / format now follows the language design guidelines.
Commits and pull requests
Philippe Hausler noted some feedback about SE-0170: NSNumber bridging and Numeric types with respect to floats and doubles. If you’ve been burned by floating-point precision in the past, check out the commit helping “Double and Float bridges to be more lenient”.
The Swift migrator library was merged into the repository! At its core, the migrator takes a source file as input and producs a remap file describing the proposed changes. Check out all the details in the Swift migrator library folder.
Everyone’s favorite Swift 4 protocol Encodable
gets some upgrades to support non-strong (weak, unowned, unmanaged) properties.
The second bug ever filed in the Swift issue tracker has been fixed! 🎉 SR-2 and SR-4196 describe how wrapping switch cases in conditional #if
/#endif
blocks doesn’t work properly, and this has been fixed in a recent commit.
Xcode 9 lets you Sanitize All The Things with the new Undefined Behavior Sanitizer and the Main Thread Checker joining the existing address sanitizer and thread sanitizer. Code for these new features was merged into swift-lldb, so have a look at how they work if you’re curious. 🔍
Proposal news
Following up on a post from last year, Erica Sadun and associates Olivier Halligon, Caleb Davenport, and Brian King submitted a draft proposal to add “role keywords” for protocol extension methods.
SE-0110 was meant to make obvious the difference between multiple parameters to a function (String, Int)
and a single tuple parameter (String, Int)
. They sure do look the same, don’t they? As Doug Gregor noted on the mailing list, this change to the compiler led to some complications:
Swift 4 implemented more of SE-0110, which caused a fairly serious usability regression, particularly with closures.
[…]
The Swift core team feels that these usability regressions are unacceptable for Swift 4. There are a number of promising solutions that would provide a better model for closures and address the usability regression, but fully designing and implementing those are out of scope for Swift 4. Therefore, we will “back out” the SE-0110 change regarding function arguments from Swift 4.
No one can tell the future and it’s hard to know the effect of a proposal on all the Swift code out there in the world — but that’s why we have snapshot builds and betas. As for the fallout around SE-0110, I think we all join the community in encouraging contributor Austin Zheng to stick around. ❤️
No new proposals but as always, you can check out the Swift Evolution status page for all the details.
Mailing lists
Remember SE-0104: Protocol-oriented integers? Xiaodi Wu posted some thoughtful notes and suggestions on improving the implementation.
Halen Wooten kicked off a great thread on swift-dev on how to be an effective contributor. I know the mailing list interface can be a bit gnarly, but check out the entire thread for some good tips. From documentation to avoiding clean builds to save time, I hope these tips get collected into some kind of Getting Started guide?
Finally
What kind of language would you build after learning the lessons of Swift? A very simple one, perhaps even without access control? 😱