From 31ed3c203955b6fc5a5c52c30d70d8b75df16735 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Wed, 23 Nov 2022 16:51:02 +0100 Subject: [PATCH] Add workspace --- AoC.xcworkspace/contents.xcworkspacedata | 318 ++++++++++++++++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 + Utils/Utils.swift | 38 +++ 3 files changed, 364 insertions(+) create mode 100644 AoC.xcworkspace/contents.xcworkspacedata create mode 100644 AoC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Utils/Utils.swift diff --git a/AoC.xcworkspace/contents.xcworkspacedata b/AoC.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..18eef6b --- /dev/null +++ b/AoC.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,318 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AoC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/AoC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/AoC.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Utils/Utils.swift b/Utils/Utils.swift new file mode 100644 index 0000000..883b80b --- /dev/null +++ b/Utils/Utils.swift @@ -0,0 +1,38 @@ +import Foundation + +extension Scanner { + @discardableResult + func string(_ string: String) -> Bool { + return scanString(string) != nil + } + + func integers() -> [Int] { + var numbers: [Int] = [] + while let num = scanInt() { + numbers.append(num) + } + return numbers + } +} + + +extension String { + func lines() -> [String] { + var result: [String] = [] + enumerateLines { line, _ in result.append(line) } + return result + } +} + +extension Sequence { + func print(_ prefix: String = "") -> Self { + Swift.print(prefix, Array(self)) + return self + } +} + +extension Collection where Element: Collection { + func flatten() -> [Element.Element] { + flatMap { $0 } + } +}