# Swift language support

**URL:** <https://forum.codecrafters.io/t/swift-language-support/2044>\
**Category:** Feature Requests\
**Created:** [September 28, 2024, 6:42pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044 "2024-09-28T18:42:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![JWShroyer](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jwshroyer/32/1908_2.png) [@JWShroyer](https://forum.codecrafters.io/u/JWShroyer)\
**Post date:** [September 28, 2024, 6:42pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/1 "2024-09-28T18:42:01Z")

</div>

Hello 👋

I recently stumbled upon the CodeCrafters platform and have really enjoyed my time with it so far - really fun and engaging way to learn interesting technologies!

I’ve got an extensive background in Swift and noticed that Swift isn’t enabled anywhere on the site at the moment. From digging around the [language support dashboard](https://github.com/codecrafters-io/language-dashboard), [frontend challenge language release status](https://github.com/codecrafters-io/frontend/blob/0ed1d24de2e547843c66d592298ff5594a7d90d2/mirage/course-fixtures/sqlite.js#L34), and some other links I can’t provide because I’m a new user, I can see a couple of the challenges have the code and resource files necessary to support the language, but are not presented to the user due to it being flagged as an Alpha status (instead of Beta or Live).

What is still needed to move these out of an Alpha status for general availability when choosing challenges? If there’s anything I can do to help with the ones already in an Alpha status to move them forward, I would be happy to. @rohitpaulk, I saw that you were in quite a few conversations surrounding language support on the forums - perhaps you know?

Secondly, are there any general guidelines or recommendations for the language versions we should be using? The dashboard I linked above seems to suggest it’s preferred to be on the latest release version where possible.

Otherwise, it seems like I could help by providing the necessary code files and resources for some of the other projects if I’d like to see Swift availability. So I can focus some of my free time there in the meantime.

Thanks for any clarifications that can be provided.

---

<div class="post-metadata">

**Author:** ![JWShroyer](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jwshroyer/32/1908_2.png) [@JWShroyer](https://forum.codecrafters.io/u/JWShroyer)\
**Post date:** [September 29, 2024, 2:05am UTC](https://forum.codecrafters.io/t/swift-language-support/2044/2 "2024-09-29T02:05:38Z")

</div>

I opened a couple PRs to help get the ball rolling and to make things easier for adding Swift to other challenges as they begin to support the new build system overhaul.

- [Swift 6 Language Template](https://github.com/codecrafters-io/language-templates/pull/2)
- [BYO Interpreter Swift Support](https://github.com/codecrafters-io/build-your-own-interpreter/pull/49)

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [September 29, 2024, 12:48pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/3 "2024-09-29T12:48:22Z")

</div>

Hey @JWShroyer – thanks so much for these! The `language-templates` repo has zero documentation so I can imagine this’d have been a pain to figure out 😅

The last time we looked at Swift, we ran into issues with caching dependencies ([Swift language added to Redis Course by bobvoorneveld · Pull Request #148 · codecrafters-io/build-your-own-redis · GitHub](https://github.com/codecrafters-io/build-your-own-redis/pull/148#issuecomment-2008100199)). I’d like to figure this out before shipping starter code that makes it look like users can add dependencies.

Could you try adding a sample dependency (swift-nio maybe, since it’s large) and see if you can get caching working? The Redis challenge could be a good place to test this since swift-nio will be required to pass the first stage. Once we’ve got dependencies working on at least one challenge, should be straightforward to add support to all - only the code file needs to change, `language-templates` should automate the rest.

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [September 29, 2024, 12:55pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/4 "2024-09-29T12:55:08Z")

</div>

Realized that our docs on test runner performance were out-of-date, updated here: [Update test runner documentation to reflect changes in script paths a… · codecrafters-io/docs@ee9738f · GitHub](https://github.com/codecrafters-io/docs/commit/ee9738f043c87a5a9cc0cbaa0f82f4c81b52bb41).

Updated docs should be here: [Test Runner Image Interface - CodeCrafters](https://docs.codecrafters.io/contributors/adding-language-support/test-runner-image-interface)

---

<div class="post-metadata">

**Author:** ![JWShroyer](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jwshroyer/32/1908_2.png) [@JWShroyer](https://forum.codecrafters.io/u/JWShroyer)\
**Post date:** [September 29, 2024, 2:01pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/5 "2024-09-29T14:01:12Z")

</div>

@rohitpaulk, got it. I’ll take a look sometime today or tomorrow to see if I can’t get that working well. Thanks for the callout.

---

<div class="post-metadata">

**Author:** ![JWShroyer](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jwshroyer/32/1908_2.png) [@JWShroyer](https://forum.codecrafters.io/u/JWShroyer)\
**Post date:** [September 30, 2024, 2:43am UTC](https://forum.codecrafters.io/t/swift-language-support/2044/6 "2024-09-30T02:43:29Z")

</div>

@rohitpaulk, I updated the language-templates repo to address the dependency caching and used this to test the build-your-own-redis repo with Swift support. I opened a PR for it (for some reason the forum is blocking me from linking to it - [PR #261](https://github.com/codecrafters-io/build-your-own-redis/pull/261) in that repo)

With swift-nio as a dependency, I was able to run the starter program and the solution program in 12 seconds combined when invoked from the `course-sdk test swift` command.

I also went ahead and updated the BYO interpreter PR linked in a previous message to use the script changes I made to the language-templates PR.

Let me know if there’s anything else I can help with so we can easily bring Swift to the other challenges.

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [September 30, 2024, 6:03pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/7 "2024-09-30T18:03:51Z")

</div>

Thanks so much for the PRs @JWShroyer! I’ve merged both in alpha status and added you as a tester so you should be able to start using them.

I’m still running into long build times with Redis when testing on production, I’ll look into this in more detail tomorrow. I think we might be running into the inodes changing issue described here: [Incremental builds with Swift Package Manager and Linux / Docker - Using Swift - Swift Forums](https://forums.swift.org/t/incremental-builds-with-swift-package-manager-and-linux-docker/26538).

---

<div class="post-metadata">

**Author:** ![JWShroyer](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jwshroyer/32/1908_2.png) [@JWShroyer](https://forum.codecrafters.io/u/JWShroyer)\
**Post date:** [September 30, 2024, 6:12pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/8 "2024-09-30T18:12:52Z")

</div>

@rohitpaulk - Hmm. I saw that yesterday, but when digging into the problem, I saw mention that the issue [should be resolved in Swift 5.10+](https://github.com/swiftlang/swift-package-manager/pull/7189).

Even so, perhaps the right approach is to mount a volume with the cached build data like shown in your link.

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [September 30, 2024, 6:27pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/9 "2024-09-30T18:27:57Z")

</div>

The mounting volume thing actually might not be feasible for us (we use firecracker VMs, so the whole image gets stuffed into a rootfs before executing). I’m sure there’s some way out here though.

Got a minimal repro setup to start with: [Trigger swift cache bust by rohitpaulk · Pull Request #263 · codecrafters-io/build-your-own-redis · GitHub](https://github.com/codecrafters-io/build-your-own-redis/pull/263/files). Will dig deeper tomo!

---

<div class="post-metadata">

**Author:** ![JWShroyer](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jwshroyer/32/1908_2.png) [@JWShroyer](https://forum.codecrafters.io/u/JWShroyer)\
**Post date:** [September 30, 2024, 6:36pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/10 "2024-09-30T18:36:43Z")

</div>

Appreciate it, @rohitpaulk!

In the meantime, what else would be needed to help bring Swift officially to CodeCrafters? Sounds like you’ll be looking into the existing caching issue soon when in a production environment.

I could potentially help with bringing swift to some of the other challenges using what we have in the meantime.

What’s still unclear to me, is what would be needed to get any of these alpha status Swift challenges promoted to Beta for general availability. Do we just need to solve the caching problem or are there other criteria you look for?

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [September 30, 2024, 7:25pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/11 "2024-09-30T19:25:30Z")

</div>

Just caching! Nothing else I can think of that’d be a blocker.

There’s no strict criteria, it’s just that we don’t want to falsely advertise that something works (people often make purchase decisions based on language availability) when we aren’t sure it does 🙂

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [October 3, 2024, 10:34am UTC](https://forum.codecrafters.io/t/swift-language-support/2044/12 "2024-10-03T10:34:43Z")

</div>

Okay, no luck so far with caching - will look at this again next week with a clear head!

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [October 28, 2024, 4:57pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/13 "2024-10-28T16:57:49Z")

</div>

Stumbled upon a bug that might be related to this… When copying over assets from `/app-cached`, our production test runners end up changing the file modification times, but CI doesn’t. We ran into this with builds for C using vcpkg, and just deployed an update to fix this.

In my minimal repro too, I was able to replicate this: adding `-p` to `cp` doesn’t trigger the bug: [Trigger swift cache bust by rohitpaulk · Pull Request #263 · codecrafters-io/build-your-own-redis · GitHub](https://github.com/codecrafters-io/build-your-own-redis/pull/263/commits/ada7d2a001745ae36f0158a5b51d03fa55f7ef6c).

Will give this a go on our test runners soon!

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [October 28, 2024, 5:25pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/14 "2024-10-28T17:25:03Z")

</div>

Argh, that didn’t turn out to be the fix. Looks like we aren’t using `/app-cached` at all here, hmm. Must be something else going on!

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [October 28, 2024, 5:54pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/15 "2024-10-28T17:54:56Z")

</div>

Just noting some observations for later:

- Edit the `.codecrafters/compile.sh` script to add `ls -lah /tmp/codecrafters-build-redis-swift` and we can see the files that were modified:
  - `build.db` has changed
  - `release.yaml` has changed

- Diffing these files might yield more insight into why this happens
- If we run swift build twice within `compile.sh`, the second step is cached. So this definitely implies some kind of difference between the docker build environment and the final runtime env.
  - Within `compile.sh`, using `mv /tmp/codecrafters-build-redis-swift /tmp/old && cp -R /tmp/old /tmp/codecrafters-build-redis-swift` triggers a rebuild
  - Within `compile.sh`, using `mv /tmp/codecrafters-build-redis-swift /tmp/old && cp -p -R /tmp/old /tmp/codecrafters-build-redis-swift` does NOT trigger a rebuild

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [October 28, 2024, 5:59pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/16 "2024-10-28T17:59:17Z")

</div>

Additionally, doesn’t look like any permissions have changed for the root files at least:

 ![Screenshot 2024-10-28 at 17.58.44](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/2X/2/2acd8090ad044df967e2de832c569c5c47849e91.png)

---

<div class="post-metadata">

**Author:** ![JWShroyer](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/jwshroyer/32/1908_2.png) [@JWShroyer](https://forum.codecrafters.io/u/JWShroyer)\
**Post date:** [October 31, 2024, 2:07am UTC](https://forum.codecrafters.io/t/swift-language-support/2044/17 "2024-10-31T02:07:07Z")

</div>

Hey, sorry. Just wanted to give an update that I started a new job so I’ve been a bit busy getting ramped up. Will try to find some time this weekend to help out if possible.

---

<div class="post-metadata">

**Author:** ![defmacro-jam](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/defmacro-jam/32/21906_2.png) [@defmacro-jam](https://forum.codecrafters.io/u/defmacro-jam)\
**Post date:** [January 5, 2026, 8:57pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/18 "2026-01-05T20:57:06Z")

</div>

Could I be added as a tester for Swift?

---

<div class="post-metadata">

**Author:** ![rohitpaulk](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/rohitpaulk/32/6_2.png) [@rohitpaulk](https://forum.codecrafters.io/u/rohitpaulk)\
**Post date:** [January 5, 2026, 9:06pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/19 "2026-01-05T21:06:42Z")

</div>

@defmacro-jam [added](https://github.com/codecrafters-io/build-your-own-redis/commit/3fbbfcee56833d4080c7f6ab5b85d47983d99c93)!

If you reload your challenge page, you should now see Swift as an option here:

 ![Screenshot 2026-01-06 at 02.35.48](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/d/2/d232e018a3e40abddc60a3851516447df24e7253.png)

If you manage to make any headway on the caching stuff mentioned above please let us know!

---

<div class="post-metadata">

**Author:** ![thibault-ml](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/thibault-ml/32/24416_2.png) [@thibault-ml](https://forum.codecrafters.io/u/thibault-ml)\
**Post date:** [March 27, 2026, 6:42pm UTC](https://forum.codecrafters.io/t/swift-language-support/2044/20 "2026-03-27T18:42:17Z")

</div>

Hello team! I’d love to be added as a tester for Swift, but also to help bring Swift to reality. I’m going to dig a little bit into the details of what’s needed, but at a high level right now I’m finding it a bit difficult to understand what exactly needs to work — I know we say caching, but what sort of caching? Just rebuilding/incremental building? Is the issue local or only on codecrafters’ servers?

Basically, is there a little bit of TL;DR of what commands/suite of actions need to work + how I can reproduce the issue myself + what we’ve tried so far, what’s not worked?

I’m happy to jump on a call with anybody if it’s easier!

[Next page](https://forum.codecrafters.io/t/swift-language-support/2044.md?page=2)
