diff --git a/swift/.tool-versions b/swift/.tool-versions new file mode 100644 index 0000000..61f5544 --- /dev/null +++ b/swift/.tool-versions @@ -0,0 +1 @@ +swift 6 diff --git a/swift/README.md b/swift/README.md index 78ea463..cedecbc 100644 --- a/swift/README.md +++ b/swift/README.md @@ -2,22 +2,28 @@ Skeleton project for Swift. -## Usage -- Follow instructions at https://www.swift.org/install/ to install the Swift SDK -- `swift test` to run the tests -- `swift run` to run the code +## Prerequisites -## Structure -- Tests located in [`CodingExerciseTests.swift`](./Tests/CodingExerciseTests/CodingExerciseTests.swift) -- Runtime code located in [`CodingExercise.swift`](./Sources/CodingExercise/CodingExercise.swift) +The toolchain this project needs is declared in [`.tool-versions`](./.tool-versions): + +``` +swift 6 +``` -However, feel free to organise your code as you like. +Install those however you prefer, as long as they end up on your `PATH`. The quickest route is +[mise](https://mise.jdx.dev/), which reads the file for you: -## IDE +```sh +mise install +``` -The pairing test is a generic problem solving exercise and you can use any code editor you like so long as you can run swift code and write unit tests. +## Usage +- `./script/setup` to resolve dependencies +- `./script/test` to run the tests +- `./script/start` to run the app + +## Structure +- Tests located in [`CodingExerciseTests.swift`](./Tests/CodingExerciseTests/CodingExerciseTests.swift) +- Code located in [`CodingExercise.swift`](./Sources/CodingExercise/CodingExercise.swift) -However we suggest any of the following as they're the easiest to get started with: -- [XCode](https://developer.apple.com/xcode/) -- [VSCode](https://code.visualstudio.com/) or [VSCodium](https://vscodium.com/) with the [Swift extension](https://marketplace.visualstudio.com/items?itemName=swiftlang.swift-vscode) -- [XCode Swift Playground](https://www.apple.com/uk/swift/playgrounds/) \ No newline at end of file +However, you're free to organise your code as you like. \ No newline at end of file diff --git a/swift/script/setup b/swift/script/setup new file mode 100755 index 0000000..0b980ee --- /dev/null +++ b/swift/script/setup @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +swift package resolve diff --git a/swift/script/start b/swift/script/start new file mode 100755 index 0000000..8e37626 --- /dev/null +++ b/swift/script/start @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +swift run diff --git a/swift/script/test b/swift/script/test new file mode 100755 index 0000000..c9a1f5a --- /dev/null +++ b/swift/script/test @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +swift test