Skip to content

yukim17/swift-aoc-2023

Repository files navigation

🎄 Advent of Code in Swift

Language

My solutions to daily programming puzzles at Advent of Code, by Eric Wastl.

Usage

You can open this project by choosing File / Open and select the parent directory.

Challenges

The challenges assume three files (replace 00 with the day of the challenge).

  • Sources/Data/Day00.txt: the input data provided for the challenge
  • Sources/Day00.swift: the code to solve the challenge
  • Tests/Day00.swift: any unit tests that you want to include

To start a new day's challenge, make a copy of these files, updating 00 to the day number.

// Add each new day implementation to this array:
let allChallenges: [any AdventDay] = [
-  Day00()
+  Day00(),
+  Day01(),
]

Then implement part 1 and 2.

The AdventOfCode.swift file controls which challenge is run with swift run. Add your new type to its allChallenges array. By default it runs the most recent challenge.

Templates

You can use file template to easily create files for new challenges. Copy given template into the folder ~/Library/Developer/Xcode/Templates and you can find it in menu File -> New File -> Advent Of Code File.