Swift Track Update for July 2023

Swift blog post 2023/8/3

I know we are a bit in August, but there were quite a bit of last minutes pr that needed to be merged. But that in turn means a lot has been happening, so lets get into it.

Swift Syllabus rework phase #1

A plan was laid out for a while ago to rework the Swift syllabus to make it more solid and have a stronger foundation and streamline the syllabus. The Swift syllabus is rather large and thereby is this project taking a while and thereby separated into phases, and phase one is now released. Which aimed to make the first exercises focus more on specific concepts, make the start of the tree more linear, and overall improve the experience:

It Features:

  • Reduced the number of concepts from 43 to 35
  • 6 concepts (Basics, Booleans, Numbers, Characters & Strings, Conditionals, Ternary Operator) that have received a major overhaul in both style and information, focusing more on what is important for the exercise and concept.
  • 4 exercises have received instructions changes and the addition of new tests.
  • One brand new exercise for Booleans, called Wings Quest
  • All of the 5 exercises now use the v3 spec test runner ui.

2 concepts (switches, guard) have been temporarily removed and are planned to return further down in the tree.

I forgot to take a picture before I started merging but this image is before merging all out of the basics concept:



The track has received a custom-built generator to be able to template exercises and in turn, make it easier to keep the track tests up to date with the problem spec. The generator uses the libraries Stencil together with swift formatter to produce the result.

The generator has also received its own ci, one for testing the actual generator and another script that makes sure that the test files are the actually generated file.

Practice Exercises

As exercises have to be templated they are also receiving several changes at the same time, which also mean :warning: Breaking Changes :warning: :

  • The most noticeable is that tests will be synced to problem spec and that other data like instructions will also be.
  • We are also formatting all files, this is a part of the generator having its formatter and us formatting other files.
  • Most exercises have also received stub files to make them easier to get started with.
  • Some exercises have received changes in their paradigm, this mostly involves simpler exercises, being purely functional, to show Swift being a multiparadigm language, but also to make them easier to start with.
  • Test Driven development, we have implemented so on local machines will only the first test run, when first running, this was discussed here.

Currently 32 (4 of these will be merged soon) exercises is templated:

  • All your bases
  • Anagram
  • Allergies
  • Acronym
  • Atbash-cipher
  • Binary-Search
  • Bob
  • Bowling
  • Collatz Conjecture
  • Difference of Squares
  • Etl
  • Isogram
  • Diamond
  • Dominos
  • FlattenArray
  • Food Chain
  • Grains
  • Hamming
  • Isbn Verifier
  • Leap
  • Luhn
  • Matching brackets
  • Minesweeper
  • Matrix
  • LargestSeriesProduct
  • NucleotideCount
  • NthPrime
  • Pangram

Not merged:

  • Roman Numerals
  • Raindrops
  • PrimeFactors
  • Pig-Latin

My goal is to most exercises templated by the end of the month.

2 Indent

The track has been in a bit of a special situation, there the syllabus used 2 indent and the practice exercises used 4. I have decided to streamline this to being 2 everywhere, it is nothing wrong with using 4, I have decided to opt for 2 because the swift formatter has that as default. I will soon make so the web editor will also be using 2 indentions.

Opening up contributions

I have decided to open up contributions on the track and to make so prs can be opened on the repo, this is mostly done to make it easier for contributions to get started contributing. And because sometimes prs came in which were not linked to a repo which in turn means they cant be reopened.

Testing file changes

@kytrinyx, helped out with removing some syntax that was only needed for backward compatibility for older Swift versions. This helps out with making the test files less cluttered and being able to focus on the tests cases.

Minimum version

The Swift track has a new minimum version which is Swift 5.3, this is a hard limit, which forces the use of at least using that version, this is done to keep compatibility with testing changes.


  • The concept Exercises are now recorded to make them appear in the exercises tab in more expected order based on the concept tree.
  • Made so the ci don’t run twice (thanks to @ErikSchierboom for implementing this)
  • A tool that allows for automatic updating the minimum version.
  • Various smaller fixes, like spell fixes etc.