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. --- Hutch/Models/Meta.swift | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Hutch/Models/Meta.swift') diff --git a/Hutch/Models/Meta.swift b/Hutch/Models/Meta.swift index f52fc76..e0a09de 100644 --- a/Hutch/Models/Meta.swift +++ b/Hutch/Models/Meta.swift @@ -3,7 +3,7 @@ import Foundation // MARK: - User Profile (full) /// Extended user profile from meta.sr.ht with all fields from the `me` query. -struct UserProfile: Codable, Sendable { +nonisolated struct UserProfile: Codable, Sendable { let username: String let canonicalName: String let email: String @@ -20,7 +20,7 @@ struct UserProfile: Codable, Sendable { // MARK: - SSH Key -struct SSHKey: Codable, Sendable, Identifiable { +nonisolated struct SSHKey: Codable, Sendable, Identifiable { let id: Int let comment: String? let created: Date @@ -34,27 +34,27 @@ struct SSHKey: Codable, Sendable, Identifiable { } } -struct SSHKeyPage: Codable, Sendable { +nonisolated struct SSHKeyPage: Codable, Sendable { let results: [SSHKey] let cursor: String? } // MARK: - PGP Key -struct PGPKey: Codable, Sendable, Identifiable { +nonisolated struct PGPKey: Codable, Sendable, Identifiable { let id: Int let fingerprint: String let created: Date } -struct PGPKeyPage: Codable, Sendable { +nonisolated struct PGPKeyPage: Codable, Sendable { let results: [PGPKey] let cursor: String? } // MARK: - Subscription -struct Subscription: Codable, Sendable { +nonisolated struct Subscription: Codable, Sendable { let status: String? let autorenew: Bool? let interval: String? @@ -62,7 +62,7 @@ struct Subscription: Codable, Sendable { // MARK: - Personal Access Token -struct PersonalAccessToken: Codable, Sendable, Identifiable { +nonisolated struct PersonalAccessToken: Codable, Sendable, Identifiable { let id: Int let issued: Date let expires: Date? @@ -72,7 +72,7 @@ struct PersonalAccessToken: Codable, Sendable, Identifiable { /// One entry in meta.sr.ht's audit log: a security-relevant action on the /// account, with the address it came from. -struct AuditLogEntry: Codable, Sendable, Identifiable { +nonisolated struct AuditLogEntry: Codable, Sendable, Identifiable { let id: Int let created: Date let ipAddress: String -- cgit v1.2.3