From 283fbf00fdffd64c924b6cb22c84e803b718f078 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Fri, 7 Aug 2026 17:33:46 -0500 Subject: 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. --- HutchWidgetExtension/ContributionGraphWidget.swift | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'HutchWidgetExtension') diff --git a/HutchWidgetExtension/ContributionGraphWidget.swift b/HutchWidgetExtension/ContributionGraphWidget.swift index 2fc07f2..bc56a03 100644 --- a/HutchWidgetExtension/ContributionGraphWidget.swift +++ b/HutchWidgetExtension/ContributionGraphWidget.swift @@ -28,12 +28,16 @@ struct ContributionGraphTimelineProvider: TimelineProvider { } func getSnapshot(in _: Context, completion: @escaping (ContributionGraphEntry) -> Void) { + // WidgetKit's completion is safe to call from the task; rebind as + // nonisolated(unsafe) so it can cross into the `sending` Task closure. + nonisolated(unsafe) let completion = completion Task { completion(await loadEntry()) } } func getTimeline(in _: Context, completion: @escaping (Timeline) -> Void) { + nonisolated(unsafe) let completion = completion Task { let entry = await loadEntry() let refreshDate = Calendar.contributionCalendar.date(byAdding: .hour, value: 1, to: Date()) ?? Date().addingTimeInterval(3600) -- cgit v1.2.3