Swift 6
The Swift track has finally been upgraded to Swift 6.1 from 5.8, introducing the brand-new test framework Swift-Testing. I have worked on this project since November, and I am very glad to finally see it being released.
To not be shunned away next week by WWDC 25, so I release this, this week.
Summery:
- Swift 6.1
- Swift-Testing
- Test-Runner overhaul
- CI improvements
- Analyzer
- 2 Brand new concept exercises and one new concept
- Overhauled large parts of the concept tree (syllabus rework phase 2 sorta)
- Micallious improvements and fixes
Swift 6.1
Note: This may lead to some current solutions breaking.
This means you can now use the latest tools in the test runner, Swift introduced in Swift 5.10 and Swift 6.0 large changes in concurrency. Even if most exercises don’t focus on this. So do these changes affect some typing in the language. This is another reason why these changes are needed to reflect the current language. However, most solutions for Swift 5 is compatible with Swift 6.
As will be detailed below, we will now use Swift-Testing, which means that with Swift 5.x, you can’t any longer run the exercises locally and instead you have to upgrade to at least Swift 6. To mitigate this transition period, I have prepared a 5.x
branch on github which uses XCTest instead (it was branched of before these changes discussed here were merged). This branch will not receive further updates.
This makes so the supported versions are: Swift 6.0 and Swift 6.1.
Swift-Testing
At WWDC 24 Apple announced the new testing framework Swift-Testing. This framework introduced a brand new syntax and workflow. This framework will be the future of testing with Swift, thereby, this is an important step both for students to be accustomed to this kind of syntax and for keeping the track maintainable for the future.
This was a tedious task since it required all 100 exercises to receive new test files, which was a core reason why this work took as long as it did, and since the test runner wasn’t compatible with Swift 6 nor the Swift testing framework, careful planning was required to make the update smooth.
Test-Runner overhaul
The test runner has been rewritten from scratch, with Swift 6 and Swift-Testing in mind. The old test-runners architecture meant that the test-runner became version-locked, which became an issue since wanting to update the test-runner meant a large body of work. This new design has been rethought with maintainability in mind and should make it so that version updates can happen more often than every other year. This has already been tested in practice, the test runner was written for Swift 6.0, but with no/small changes, it can now run Swift 6.1. Unfortunately, this has meant that some features have been removed, namely, user output and tasks for concept exercises. However, with Swift-Testings expanding, this is something which can be brought back.
CI improvements
We have now introduced a new CI that will test on Linux as well as macOS. This is partly done just Linux CI is faster, and Linux and macOS Swift can behave a bit differently sometimes, and considering our test runner runs Linux so does it make sense to also test for Linux. The ci will also new test multiple versions, and the versions will now be pinned as well. For now, we are testing Swift 6 and 6.1.
Analyzer
This has not yet been released. I am hoping for a release next week.
A basic analyzer has been added, which simply uses the Swift-format library by calling the analyzer command. This means it is currently quite limited in the comments it will make, mostly focusing on the way of typing.
Two Brand new concept exercises and one new concept
This update sees the introduction of the new concept exercise ranges. Before, the concept was a bit loosely integrated into the loops concept. But considering it is a standalone datatype did I felt like it did belong in its concept. With this is a brand new exercise is introduced, ChessBoard, which will branced on arrays. It will focus on what you can use ranges for outside of loops.
The other new concept exercise is bird-watcher, which, for folks who have gone through other concept trees, should feel familiar. This exercise will be connected with for-loops and will branch directly from the new range concept. This puts the looping concept a lot higher up in the syllabus tree.
Overhauled large parts of the concept tree
The latter part of the syllabus tree have received some significant changes. For folks been around for a while may remember I announced for two years ago that I were making a rework of the syllabus tree (Swift syllabus rework - Searching Feedback - Exercism - Exercism), later that Summer phase 1 came out but since then there were never a phase 2. I decided in 2024 that the project had to be canceled due to I did not have the time nor motivation for continued work. However, I never felt a feeling of completeness, so this update, even if it isn’t as large as I originally hoped, is phase ,2, kind of.
Some exercises have got smaller changes and some larger, so here is a quick list:
Reworks:
- Arrays
- Tuples
- String-methods
Medium:
- Classes
- Optionals
- Dictionaries
- While-loops
- Clousers
- Lasagna Master (and its concept)
Tiny:
- Enum
- higher-order-functions & escaping-functions
Compatibility:
- Basics
- Boolean
- Numerics
- Strings & Characters
- Conditionals
Reworks means the exercise and concept have been significantly updated. For Tuples, the exercises have been changed to not use looping. For String-methods, it has been renamed from string-components and has been rewritten to have more methods than just components.
Medium means the exercises or concept have been significantly updated (or both have been updated but not to a very significant point). Noteworthy here is while loops, which exercise have been renamed from master-mixlogist to expert-mixologist, and while loops have been merged with repeat loops into a single concept. The class exercise has had many complaints for not being intuitive. This is hopefully resolved with the latest changes.
Tiny means smaller changes, this has generally included fixes, adding more links for more references. Noteworthy here are higher-order higher-order-functions & escaping-functions, these concepts were at the top of the tree, they are now at the bottom since I find themdo not need to be taught very early on.
Compatibility means they have only been updated with Swift-Testing, no other changes.
Worth mentioning as well is that Clousers exercises have a planned post-update patch which will focus on changing to make it more accessible for folks who have not studied bit-mathematics.
Micallious improvements and fixes
I have also taken a sweep through the tracks docs, and they have been updated to reflect the current landscape of the language. This includes a brand new installation doc that features the new language installer swiftly.
The Swift-Testing library can’t do some types of testing that the XCTest framework could, the Swift-Numerics library has been added to selected exercises. As a pre-trial one practice exercise has been given to this library for users to be able to try out.
All practice exercises have been synced (as of December 2024), and some have been reworked and templated. This means that most exercises are now templated.
There have been two depreciations as well, namely accumulate
and scale-generator
.
The last thing I want to wish is for you to have a nice WWDC next week.