Better Programming

Advice for programmers.

Follow publication

Member-only story

Preparing My App for Swift 6

Cihat Gündüz
Better Programming
Published in
6 min readApr 18, 2023

What is “Swift 6 mode”?

Swift 6 won’t be released in 2023 anymore, that has been made clear by Doug Gregor from the Swift Language Workgroup. But did you know that Apple has already shipped parts of Swift 6 in 5.8? Yes, it’s true. Some parts of Swift that shipped with Xcode 14.3 a few weeks ago are turned off by default. They will be turned on once Swift 6 comes out, which might take another year, or even longer.

These features introduce some breaking changes to Swift, for example by renaming known APIs, adjusting their behavior, or adding new safety checks to the compiler. But they will all get turned on at some point to help improve our code bases. And we will have to update our projects to play nicely with those changes.

I figured it’s a good idea to turn on all features in my projects to see if there’s any breaking change for my codebase that I should know of. And of course, I could also make use of some new features, such as BareSlashRegexLiterals, which makes the /.../ regex literal syntax available for concise Regex initialization.

Thankfully, with Swift 5.8 there’s now a unified way of enabling these options: We just need to pass -enable-upcoming-feature to Swift by providing it in the OTHER_SWIFT_FLAGS in our projects build settings in Xcode. But we need to know also what features are available, and I couldn't find any place with a good overview (yet). The proposal that introduced this unified option does contain such a list, but it doesn't get updated with newer options added later on, such as the one from SE-0384. So, where can we currently reliably get a list of all supported options?

✨ UPDATE: You can now filter by upcoming flags directly on Swift.org.

Swift is open source, so the most reliable place seems the Swift GitHub repository! It includes a Features.def file which contains entries (link to release/5.8 branch) named UPCOMING_FEATURE including both the related Swift Evolution proposal number and the Swift version they will be turned on:

UPCOMING_FEATURE(ConciseMagicFile…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Cihat Gündüz
Cihat Gündüz

Written by Cihat Gündüz

📱Indie iOS Developer, 🎬Content Creator for 👨🏻‍💻Developers. Apps: RemafoX, Twoot it!. More in the works.

Write a response