Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions swift/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
swift 6
34 changes: 20 additions & 14 deletions swift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
However, you're free to organise your code as you like.
7 changes: 7 additions & 0 deletions swift/script/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

swift package resolve
7 changes: 7 additions & 0 deletions swift/script/start
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

swift run
7 changes: 7 additions & 0 deletions swift/script/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(dirname "${BASH_SOURCE[0]}")/.."

swift test
Loading