diff options
| author | Christian Cleberg <[email protected]> | 2026-08-07 17:33:46 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-08-07 17:33:46 -0500 |
| commit | 283fbf00fdffd64c924b6cb22c84e803b718f078 (patch) | |
| tree | f6603518ba62134faa699d864003b90464930ab9 /Hutch/Models/ContributionCalendar.swift | |
| parent | b2a1265cadccc34cbdab71b9ed638b908cac9f62 (diff) | |
| download | hutch-283fbf00fdffd64c924b6cb22c84e803b718f078.tar.gz hutch-283fbf00fdffd64c924b6cb22c84e803b718f078.tar.bz2 hutch-283fbf00fdffd64c924b6cb22c84e803b718f078.zip | |
Adopt Swift 6 language mode
Flip SWIFT_VERSION to 6.0 (keeping SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor)
and resolve every resulting diagnostic. Mechanical, no behaviour change:
- Models: pure value types in Models/ and utility extensions (Date, DateFormatter,
SRHTWebURL) marked nonisolated so the nonisolated networking layer can use them.
- App Intents: stored 'static var' (title/description/openAppWhenRun/
typeDisplayRepresentation/defaultQuery/caseDisplayRepresentations) -> 'static let';
drop the invalid @retroactive on the in-module LookupType: AppEnum.
- Sendable dicts: 'nil as String? as Any' -> 'nil as String? as any Sendable'.
- UserDefaults: retroactive @unchecked Sendable (documented thread-safe).
- WidgetKit completion handlers rebound nonisolated(unsafe) to cross into Task {};
TipStoreViewModel task handle is @ObservationIgnored nonisolated(unsafe) for
its nonisolated deinit.
- Tests run on @MainActor; a few constant fixtures marked nonisolated for use in
@Sendable stub closures.
Builds and the full suite are clean in Swift 6 mode. Roadmap updated.
Diffstat (limited to 'Hutch/Models/ContributionCalendar.swift')
| -rw-r--r-- | Hutch/Models/ContributionCalendar.swift | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/Hutch/Models/ContributionCalendar.swift b/Hutch/Models/ContributionCalendar.swift index a429fa2..cf87ca7 100644 --- a/Hutch/Models/ContributionCalendar.swift +++ b/Hutch/Models/ContributionCalendar.swift @@ -1,6 +1,6 @@ import Foundation -struct ContributionCalendarResponse: Decodable, Sendable, Hashable { +nonisolated struct ContributionCalendarResponse: Decodable, Sendable, Hashable { let actor: String let from: Date let to: Date @@ -9,7 +9,7 @@ struct ContributionCalendarResponse: Decodable, Sendable, Hashable { let indexingState: ContributionIndexingState let days: [ContributionDay] - enum CodingKeys: String, CodingKey { + nonisolated enum CodingKeys: String, CodingKey { case actor case from case to @@ -59,14 +59,14 @@ struct ContributionCalendarResponse: Decodable, Sendable, Hashable { } } -struct ContributionDay: Decodable, Sendable, Hashable, Identifiable { +nonisolated struct ContributionDay: Decodable, Sendable, Hashable, Identifiable { var id: Date { date } let date: Date let count: Int let score: Double - enum CodingKeys: String, CodingKey { + nonisolated enum CodingKeys: String, CodingKey { case date case count case score @@ -90,7 +90,7 @@ struct ContributionDay: Decodable, Sendable, Hashable, Identifiable { } } -struct ContributionStatsResponse: Decodable, Sendable, Hashable { +nonisolated struct ContributionStatsResponse: Decodable, Sendable, Hashable { let actor: String let from: Date let to: Date @@ -103,7 +103,7 @@ struct ContributionStatsResponse: Decodable, Sendable, Hashable { let longestStreak: Int let currentStreak: Int - enum CodingKeys: String, CodingKey { + nonisolated enum CodingKeys: String, CodingKey { case actor case from case to @@ -117,7 +117,7 @@ struct ContributionStatsResponse: Decodable, Sendable, Hashable { case currentStreak = "current_streak" } - struct StatsWindow: Sendable, Hashable { + nonisolated struct StatsWindow: Sendable, Hashable { let actor: String let from: Date let to: Date @@ -126,7 +126,7 @@ struct ContributionStatsResponse: Decodable, Sendable, Hashable { let indexingState: ContributionIndexingState } - struct StatsTotals: Sendable, Hashable { + nonisolated struct StatsTotals: Sendable, Hashable { let totalEvents: Int let totalScore: Double let activeDays: Int @@ -181,13 +181,13 @@ struct ContributionStatsResponse: Decodable, Sendable, Hashable { } } -enum ContributionIndexingState: String, Codable, Sendable, Hashable { +nonisolated enum ContributionIndexingState: String, Codable, Sendable, Hashable { case pending case indexed case error } -enum ContributionIntensity: Int, Sendable, CaseIterable { +nonisolated enum ContributionIntensity: Int, Sendable, CaseIterable { case empty = 0 case level1 = 1 case level2 = 2 @@ -210,12 +210,12 @@ enum ContributionIntensity: Int, Sendable, CaseIterable { } } -struct ContributionWeek: Sendable, Hashable { +nonisolated struct ContributionWeek: Sendable, Hashable { let startDate: Date let days: [ContributionDay] } -enum ContributionCalendarLayout { +nonisolated enum ContributionCalendarLayout { static func weekColumns( from days: [ContributionDay], calendar: Calendar = .contributionCalendar @@ -241,7 +241,7 @@ enum ContributionCalendarLayout { } } -enum ContributionDateParser { +nonisolated enum ContributionDateParser { static func parse(_ rawValue: String) -> Date? { let parts = rawValue.split(separator: "-", omittingEmptySubsequences: false) guard @@ -348,7 +348,7 @@ enum ContributionDateParser { } } -extension Calendar { +nonisolated extension Calendar { static var contributionCalendar: Calendar { var calendar = Calendar(identifier: .gregorian) calendar.firstWeekday = 1 |
