chore: initial ui wiring, swiftlint

Signed-off-by: Alan Brault <alan.brault@visus.io>
This commit is contained in:
2026-08-09 11:10:09 -04:00
parent e1da561ff6
commit 461c516016
19 changed files with 140 additions and 42 deletions
@@ -16,22 +16,23 @@ public enum WeatherCode: Sendable, Hashable, Decodable {
case thunderstormWithHail
case unknown(code: Int)
private static let codeMapping: [Int: WeatherCode] = [
0: .clearSky,
1: .mainlyClear,
2: .partlyCloudy,
3: .overcast,
45: .fog, 48: .fog,
51: .drizzle, 53: .drizzle, 55: .drizzle, 56: .drizzle, 57: .drizzle,
61: .rain, 63: .rain, 65: .rain,
66: .freezingRain, 67: .freezingRain,
71: .snow, 73: .snow, 75: .snow, 755: .snow,
85: .snowShowers, 86: .snowShowers,
95: .thunderstorm,
96: .thunderstormWithHail, 99: .thunderstormWithHail
]
public static func from(code: Int) -> WeatherCode {
switch code {
case 0: .clearSky
case 1: .mainlyClear
case 2: .partlyCloudy
case 3: .overcast
case 45, 48: .fog
case 51, 53, 55, 56, 57: .drizzle
case 61, 63, 65: .rain
case 66, 67: .freezingRain
case 71, 73, 75, 755: .snow
case 85, 86: .snowShowers
case 95: .thunderstorm
case 96, 99: .thunderstormWithHail
default: .unknown(code: code)
}
codeMapping[code] ?? .unknown(code: code)
}
public init(from decoder: Decoder) throws {
@@ -16,7 +16,10 @@ public struct DateOnly: Sendable, Hashable, Comparable, Codable {
calendar.timeZone = timeZone
let components = calendar.dateComponents([.year, .month, .day], from: date)
self.init(year: components.year!, month: components.month!, day: components.day!)
guard let year = components.year, let month = components.month, let day = components.day else {
preconditionFailure("Calendar failed to compute year/month/day components")
}
self.init(year: year, month: month, day: day)
}
public static func < (lhs: DateOnly, rhs: DateOnly) -> Bool {
@@ -1,5 +1,5 @@
import Testing
@testable import TempestasDomain
import Testing
@Test func example() async throws {
// Write your test here and use APIs like `#expect(...)` to check expected conditions.