From 8e3584ee79f4bdfc1d8640da772c23f80258f790 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Fri, 15 Sep 2023 12:46:15 +0200 Subject: [PATCH] Upgrade to Swift tools version 5.9 + strict Swift concurrency everywhere --- .../IceCubesActionExtension.xcscheme | 96 +++++++++++++++++++ .../xcschemes/IceCubesNotifications.xcscheme | 96 +++++++++++++++++++ .../xcschemes/IceCubesShareExtension.xcscheme | 96 +++++++++++++++++++ .../NotificationService.swift | 2 +- .../ShareViewController.swift | 10 +- .../xcshareddata/xcschemes/Account.xcscheme | 66 +++++++++++++ .../xcschemes/AccountTests.xcscheme | 53 ++++++++++ Packages/Account/Package.swift | 5 +- .../xcschemes/AppAccount.xcscheme | 66 +++++++++++++ Packages/AppAccount/Package.swift | 5 +- .../xcschemes/Conversations.xcscheme | 66 +++++++++++++ Packages/Conversations/Package.swift | 5 +- Packages/DesignSystem/Package.swift | 5 +- .../DesignSystem/Views/AvatarView.swift | 2 +- .../Views/StatusEditorToolbarItem.swift | 10 +- .../xcode/xcshareddata/xcschemes/Env.xcscheme | 66 +++++++++++++ Packages/Env/Package.swift | 5 +- Packages/Env/Sources/Env/HapticManager.swift | 1 + .../Env/PushNotificationsService.swift | 3 + Packages/Env/Sources/Env/QuickLook.swift | 2 +- .../xcshareddata/xcschemes/Explore.xcscheme | 66 +++++++++++++ Packages/Explore/Package.swift | 5 +- .../xcshareddata/xcschemes/Lists.xcscheme | 66 +++++++++++++ Packages/Lists/Package.swift | 5 +- .../xcshareddata/xcschemes/Models.xcscheme | 66 +++++++++++++ .../xcschemes/ModelsTests.xcscheme | 53 ++++++++++ Packages/Models/Package.swift | 5 +- .../Models/Alias/DateFormatterCache.swift | 26 +++++ .../Sources/Models/Alias/ServerDate.swift | 27 +----- Packages/Models/Sources/Models/Language.swift | 3 +- .../xcshareddata/xcschemes/Network.xcscheme | 66 +++++++++++++ .../xcschemes/NetworkTests.xcscheme | 53 ++++++++++ Packages/Network/Package.swift | 5 +- .../xcschemes/Notifications.xcscheme | 66 +++++++++++++ Packages/Notifications/Package.swift | 5 +- .../xcshareddata/xcschemes/Status.xcscheme | 17 +--- Packages/Status/Package.swift | 5 +- .../Sources/Status/List/ReblogCache.swift | 2 +- .../Status/Media/VideoPlayerView.swift | 14 ++- .../xcshareddata/xcschemes/Timeline.xcscheme | 66 +++++++++++++ .../xcschemes/TimelineTests.xcscheme | 53 ++++++++++ Packages/Timeline/Package.swift | 5 +- 42 files changed, 1272 insertions(+), 67 deletions(-) create mode 100644 IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesActionExtension.xcscheme create mode 100644 IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesNotifications.xcscheme create mode 100644 IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesShareExtension.xcscheme create mode 100644 Packages/Account/.swiftpm/xcode/xcshareddata/xcschemes/Account.xcscheme create mode 100644 Packages/Account/.swiftpm/xcode/xcshareddata/xcschemes/AccountTests.xcscheme create mode 100644 Packages/AppAccount/.swiftpm/xcode/xcshareddata/xcschemes/AppAccount.xcscheme create mode 100644 Packages/Conversations/.swiftpm/xcode/xcshareddata/xcschemes/Conversations.xcscheme create mode 100644 Packages/Env/.swiftpm/xcode/xcshareddata/xcschemes/Env.xcscheme create mode 100644 Packages/Explore/.swiftpm/xcode/xcshareddata/xcschemes/Explore.xcscheme create mode 100644 Packages/Lists/.swiftpm/xcode/xcshareddata/xcschemes/Lists.xcscheme create mode 100644 Packages/Models/.swiftpm/xcode/xcshareddata/xcschemes/Models.xcscheme create mode 100644 Packages/Models/.swiftpm/xcode/xcshareddata/xcschemes/ModelsTests.xcscheme create mode 100644 Packages/Models/Sources/Models/Alias/DateFormatterCache.swift create mode 100644 Packages/Network/.swiftpm/xcode/xcshareddata/xcschemes/Network.xcscheme create mode 100644 Packages/Network/.swiftpm/xcode/xcshareddata/xcschemes/NetworkTests.xcscheme create mode 100644 Packages/Notifications/.swiftpm/xcode/xcshareddata/xcschemes/Notifications.xcscheme create mode 100644 Packages/Timeline/.swiftpm/xcode/xcshareddata/xcschemes/Timeline.xcscheme create mode 100644 Packages/Timeline/.swiftpm/xcode/xcshareddata/xcschemes/TimelineTests.xcscheme diff --git a/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesActionExtension.xcscheme b/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesActionExtension.xcscheme new file mode 100644 index 00000000..98ca84fb --- /dev/null +++ b/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesActionExtension.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesNotifications.xcscheme b/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesNotifications.xcscheme new file mode 100644 index 00000000..aeb9aedc --- /dev/null +++ b/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesNotifications.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesShareExtension.xcscheme b/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesShareExtension.xcscheme new file mode 100644 index 00000000..97a8f973 --- /dev/null +++ b/IceCubesApp.xcodeproj/xcshareddata/xcschemes/IceCubesShareExtension.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IceCubesNotifications/NotificationService.swift b/IceCubesNotifications/NotificationService.swift index 8878db9c..f26d9a0d 100644 --- a/IceCubesNotifications/NotificationService.swift +++ b/IceCubesNotifications/NotificationService.swift @@ -1,7 +1,7 @@ import AppAccount import CryptoKit import Env -import Intents +@preconcurrency import Intents import KeychainSwift import Models import Network diff --git a/IceCubesShareExtension/ShareViewController.swift b/IceCubesShareExtension/ShareViewController.swift index 7c5624e5..15780371 100644 --- a/IceCubesShareExtension/ShareViewController.swift +++ b/IceCubesShareExtension/ShareViewController.swift @@ -55,13 +55,15 @@ class ShareViewController: UIViewController { NotificationCenter.default.addObserver(forName: NotificationsName.shareSheetClose, object: nil, queue: nil) - { _ in - self.close() + { [weak self] _ in + self?.close() } } - func close() { - extensionContext?.completeRequest(returningItems: [], completionHandler: nil) + nonisolated func close() { + Task { @MainActor in + extensionContext?.completeRequest(returningItems: [], completionHandler: nil) + } } override func viewDidAppear(_ animated: Bool) { diff --git a/Packages/Account/.swiftpm/xcode/xcshareddata/xcschemes/Account.xcscheme b/Packages/Account/.swiftpm/xcode/xcshareddata/xcschemes/Account.xcscheme new file mode 100644 index 00000000..9ef4da31 --- /dev/null +++ b/Packages/Account/.swiftpm/xcode/xcshareddata/xcschemes/Account.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Account/.swiftpm/xcode/xcshareddata/xcschemes/AccountTests.xcscheme b/Packages/Account/.swiftpm/xcode/xcshareddata/xcschemes/AccountTests.xcscheme new file mode 100644 index 00000000..1c16ac78 --- /dev/null +++ b/Packages/Account/.swiftpm/xcode/xcshareddata/xcschemes/AccountTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Account/Package.swift b/Packages/Account/Package.swift index d138a3c1..96828ae2 100644 --- a/Packages/Account/Package.swift +++ b/Packages/Account/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -27,6 +27,9 @@ let package = Package( .product(name: "Network", package: "Network"), .product(name: "Models", package: "Models"), .product(name: "Status", package: "Status"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), .testTarget( diff --git a/Packages/AppAccount/.swiftpm/xcode/xcshareddata/xcschemes/AppAccount.xcscheme b/Packages/AppAccount/.swiftpm/xcode/xcshareddata/xcschemes/AppAccount.xcscheme new file mode 100644 index 00000000..1e9f13f4 --- /dev/null +++ b/Packages/AppAccount/.swiftpm/xcode/xcshareddata/xcschemes/AppAccount.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/AppAccount/Package.swift b/Packages/AppAccount/Package.swift index fba2f889..081ca04d 100644 --- a/Packages/AppAccount/Package.swift +++ b/Packages/AppAccount/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -29,6 +29,9 @@ let package = Package( .product(name: "Models", package: "Models"), .product(name: "Env", package: "Env"), .product(name: "DesignSystem", package: "DesignSystem"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), ] diff --git a/Packages/Conversations/.swiftpm/xcode/xcshareddata/xcschemes/Conversations.xcscheme b/Packages/Conversations/.swiftpm/xcode/xcshareddata/xcschemes/Conversations.xcscheme new file mode 100644 index 00000000..8302f4df --- /dev/null +++ b/Packages/Conversations/.swiftpm/xcode/xcshareddata/xcschemes/Conversations.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Conversations/Package.swift b/Packages/Conversations/Package.swift index 07ef009f..8505f8e4 100644 --- a/Packages/Conversations/Package.swift +++ b/Packages/Conversations/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -29,6 +29,9 @@ let package = Package( .product(name: "Network", package: "Network"), .product(name: "Env", package: "Env"), .product(name: "DesignSystem", package: "DesignSystem"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), ] diff --git a/Packages/DesignSystem/Package.swift b/Packages/DesignSystem/Package.swift index dc9d25f4..6929c382 100644 --- a/Packages/DesignSystem/Package.swift +++ b/Packages/DesignSystem/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -32,6 +32,9 @@ let package = Package( .product(name: "NukeUI", package: "Nuke"), .product(name: "Nuke", package: "Nuke"), .product(name: "EmojiText", package: "EmojiText"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), ] diff --git a/Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift b/Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift index 82c79319..2515b941 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Views/AvatarView.swift @@ -55,7 +55,7 @@ public struct AvatarView: View { .fill(.gray) .frame(width: size.size.width, height: size.size.height) } else { - LazyImage(request: url.map(makeImageRequest)) { state in + LazyImage(request: url.map{ makeImageRequest(for: $0) }) { state in if let image = state.image { image .resizable() diff --git a/Packages/DesignSystem/Sources/DesignSystem/Views/StatusEditorToolbarItem.swift b/Packages/DesignSystem/Sources/DesignSystem/Views/StatusEditorToolbarItem.swift index 17d5cd20..535b95f6 100644 --- a/Packages/DesignSystem/Sources/DesignSystem/Views/StatusEditorToolbarItem.swift +++ b/Packages/DesignSystem/Sources/DesignSystem/Views/StatusEditorToolbarItem.swift @@ -22,6 +22,7 @@ public extension View { } } +@MainActor public struct StatusEditorToolbarItem: ToolbarContent { @EnvironmentObject private var routerPath: RouterPath @@ -34,8 +35,10 @@ public struct StatusEditorToolbarItem: ToolbarContent { public var body: some ToolbarContent { ToolbarItem(placement: .navigationBarTrailing) { Button { - routerPath.presentedSheet = .newStatusEditor(visibility: visibility) - HapticManager.shared.fireHaptic(of: .buttonPress) + Task { @MainActor in + routerPath.presentedSheet = .newStatusEditor(visibility: visibility) + HapticManager.shared.fireHaptic(of: .buttonPress) + } } label: { Image(systemName: "square.and.pencil") .accessibilityLabel("accessibility.tabs.timeline.new-post.label") @@ -49,13 +52,14 @@ public struct StatusEditorToolbarItem: ToolbarContent { } } +@MainActor public struct SecondaryColumnToolbarItem: ToolbarContent { @Environment(\.isSecondaryColumn) private var isSecondaryColumn @EnvironmentObject private var preferences: UserPreferences public init() {} - public var body: some ToolbarContent { + public var body: some ToolbarContent { ToolbarItem(placement: isSecondaryColumn ? .navigationBarLeading : .navigationBarTrailing) { Button { withAnimation { diff --git a/Packages/Env/.swiftpm/xcode/xcshareddata/xcschemes/Env.xcscheme b/Packages/Env/.swiftpm/xcode/xcshareddata/xcschemes/Env.xcscheme new file mode 100644 index 00000000..b3bb4b97 --- /dev/null +++ b/Packages/Env/.swiftpm/xcode/xcshareddata/xcschemes/Env.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Env/Package.swift b/Packages/Env/Package.swift index 26cb788c..315160f2 100644 --- a/Packages/Env/Package.swift +++ b/Packages/Env/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -27,6 +27,9 @@ let package = Package( .product(name: "Models", package: "Models"), .product(name: "Network", package: "Network"), .product(name: "KeychainSwift", package: "keychain-swift"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), ] diff --git a/Packages/Env/Sources/Env/HapticManager.swift b/Packages/Env/Sources/Env/HapticManager.swift index 84fb23d9..f732d2e8 100644 --- a/Packages/Env/Sources/Env/HapticManager.swift +++ b/Packages/Env/Sources/Env/HapticManager.swift @@ -1,6 +1,7 @@ import CoreHaptics import UIKit +@MainActor public class HapticManager { public static let shared: HapticManager = .init() diff --git a/Packages/Env/Sources/Env/PushNotificationsService.swift b/Packages/Env/Sources/Env/PushNotificationsService.swift index 7188fe3c..c867fd59 100644 --- a/Packages/Env/Sources/Env/PushNotificationsService.swift +++ b/Packages/Env/Sources/Env/PushNotificationsService.swift @@ -7,6 +7,9 @@ import Network import SwiftUI import UserNotifications +extension UNNotificationResponse: @unchecked Sendable { } +extension UNUserNotificationCenter: @unchecked Sendable { } + public struct PushAccount: Equatable { public let server: String public let token: OauthToken diff --git a/Packages/Env/Sources/Env/QuickLook.swift b/Packages/Env/Sources/Env/QuickLook.swift index 89fb8d2b..b9b34ad7 100644 --- a/Packages/Env/Sources/Env/QuickLook.swift +++ b/Packages/Env/Sources/Env/QuickLook.swift @@ -1,5 +1,5 @@ import Combine -import QuickLook +@preconcurrency import QuickLook import SwiftUI @MainActor diff --git a/Packages/Explore/.swiftpm/xcode/xcshareddata/xcschemes/Explore.xcscheme b/Packages/Explore/.swiftpm/xcode/xcshareddata/xcschemes/Explore.xcscheme new file mode 100644 index 00000000..50acd07b --- /dev/null +++ b/Packages/Explore/.swiftpm/xcode/xcshareddata/xcschemes/Explore.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Explore/Package.swift b/Packages/Explore/Package.swift index 4d989a25..dca758f4 100644 --- a/Packages/Explore/Package.swift +++ b/Packages/Explore/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -33,6 +33,9 @@ let package = Package( .product(name: "Env", package: "Env"), .product(name: "Status", package: "Status"), .product(name: "DesignSystem", package: "DesignSystem"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), ] diff --git a/Packages/Lists/.swiftpm/xcode/xcshareddata/xcschemes/Lists.xcscheme b/Packages/Lists/.swiftpm/xcode/xcshareddata/xcschemes/Lists.xcscheme new file mode 100644 index 00000000..20191b32 --- /dev/null +++ b/Packages/Lists/.swiftpm/xcode/xcshareddata/xcschemes/Lists.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Lists/Package.swift b/Packages/Lists/Package.swift index e9de4bf2..8daf9815 100644 --- a/Packages/Lists/Package.swift +++ b/Packages/Lists/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -29,6 +29,9 @@ let package = Package( .product(name: "Models", package: "Models"), .product(name: "Env", package: "Env"), .product(name: "DesignSystem", package: "DesignSystem"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), ] diff --git a/Packages/Models/.swiftpm/xcode/xcshareddata/xcschemes/Models.xcscheme b/Packages/Models/.swiftpm/xcode/xcshareddata/xcschemes/Models.xcscheme new file mode 100644 index 00000000..0b6ae599 --- /dev/null +++ b/Packages/Models/.swiftpm/xcode/xcshareddata/xcschemes/Models.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Models/.swiftpm/xcode/xcshareddata/xcschemes/ModelsTests.xcscheme b/Packages/Models/.swiftpm/xcode/xcshareddata/xcschemes/ModelsTests.xcscheme new file mode 100644 index 00000000..a7819c75 --- /dev/null +++ b/Packages/Models/.swiftpm/xcode/xcshareddata/xcschemes/ModelsTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Models/Package.swift b/Packages/Models/Package.swift index 90373a4d..f7e645b8 100644 --- a/Packages/Models/Package.swift +++ b/Packages/Models/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -23,6 +23,9 @@ let package = Package( name: "Models", dependencies: [ "SwiftSoup", + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), .testTarget( diff --git a/Packages/Models/Sources/Models/Alias/DateFormatterCache.swift b/Packages/Models/Sources/Models/Alias/DateFormatterCache.swift new file mode 100644 index 00000000..905e641f --- /dev/null +++ b/Packages/Models/Sources/Models/Alias/DateFormatterCache.swift @@ -0,0 +1,26 @@ +import Foundation + +class DateFormatterCache: @unchecked Sendable { + static let shared = DateFormatterCache() + + let createdAtRelativeFormatter: RelativeDateTimeFormatter + let createdAtShortDateFormatted: DateFormatter + let createdAtDateFormatter: DateFormatter + + init() { + let createdAtRelativeFormatter = RelativeDateTimeFormatter() + createdAtRelativeFormatter.unitsStyle = .short + self.createdAtRelativeFormatter = createdAtRelativeFormatter + + let createdAtShortDateFormatted = DateFormatter() + createdAtShortDateFormatted.dateStyle = .short + createdAtShortDateFormatted.timeStyle = .none + self.createdAtShortDateFormatted = createdAtShortDateFormatted + + let createdAtDateFormatter = DateFormatter() + createdAtDateFormatter.calendar = .init(identifier: .iso8601) + createdAtDateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + createdAtDateFormatter.timeZone = .init(abbreviation: "UTC") + self.createdAtDateFormatter = createdAtDateFormatter + } +} diff --git a/Packages/Models/Sources/Models/Alias/ServerDate.swift b/Packages/Models/Sources/Models/Alias/ServerDate.swift index 0d2e240e..e60d2a50 100644 --- a/Packages/Models/Sources/Models/Alias/ServerDate.swift +++ b/Packages/Models/Sources/Models/Alias/ServerDate.swift @@ -8,36 +8,15 @@ public struct ServerDate: Codable, Hashable, Equatable, Sendable { public let asDate: Date public var relativeFormatted: String { - Self.createdAtRelativeFormatter.localizedString(for: asDate, relativeTo: Date()) + DateFormatterCache.shared.createdAtRelativeFormatter.localizedString(for: asDate, relativeTo: Date()) } public var shortDateFormatted: String { - Self.createdAtShortDateFormatted.string(from: asDate) + DateFormatterCache.shared.createdAtShortDateFormatted.string(from: asDate) } private static let calendar = Calendar(identifier: .gregorian) - private static var createdAtDateFormatter: DateFormatter = { - let dateFormatter = DateFormatter() - dateFormatter.calendar = .init(identifier: .iso8601) - dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - dateFormatter.timeZone = .init(abbreviation: "UTC") - return dateFormatter - }() - - private static var createdAtRelativeFormatter: RelativeDateTimeFormatter = { - let dateFormatter = RelativeDateTimeFormatter() - dateFormatter.unitsStyle = .short - return dateFormatter - }() - - private static var createdAtShortDateFormatted: DateFormatter = { - let dateFormatter = DateFormatter() - dateFormatter.dateStyle = .short - dateFormatter.timeStyle = .none - return dateFormatter - }() - public init() { asDate = Date() - 100 } @@ -47,7 +26,7 @@ public struct ServerDate: Codable, Hashable, Equatable, Sendable { // Decode from server let container = try decoder.singleValueContainer() let stringDate = try container.decode(String.self) - asDate = Self.createdAtDateFormatter.date(from: stringDate) ?? Date() + asDate = DateFormatterCache.shared.createdAtDateFormatter.date(from: stringDate) ?? Date() } catch { // Decode from cache let container = try decoder.container(keyedBy: CodingKeys.self) diff --git a/Packages/Models/Sources/Models/Language.swift b/Packages/Models/Sources/Models/Language.swift index 42651ebd..2215eca2 100644 --- a/Packages/Models/Sources/Models/Language.swift +++ b/Packages/Models/Sources/Models/Language.swift @@ -1,7 +1,8 @@ import Foundation +@MainActor public struct Language: Identifiable, Equatable, Hashable { - public var id: String { isoCode } + nonisolated public var id: String { isoCode } public let isoCode: String public let nativeName: String? diff --git a/Packages/Network/.swiftpm/xcode/xcshareddata/xcschemes/Network.xcscheme b/Packages/Network/.swiftpm/xcode/xcshareddata/xcschemes/Network.xcscheme new file mode 100644 index 00000000..1e37182e --- /dev/null +++ b/Packages/Network/.swiftpm/xcode/xcshareddata/xcschemes/Network.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Network/.swiftpm/xcode/xcshareddata/xcschemes/NetworkTests.xcscheme b/Packages/Network/.swiftpm/xcode/xcshareddata/xcschemes/NetworkTests.xcscheme new file mode 100644 index 00000000..ef2f5579 --- /dev/null +++ b/Packages/Network/.swiftpm/xcode/xcshareddata/xcschemes/NetworkTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Network/Package.swift b/Packages/Network/Package.swift index cdf959ed..3dd8a78d 100644 --- a/Packages/Network/Package.swift +++ b/Packages/Network/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -23,6 +23,9 @@ let package = Package( name: "Network", dependencies: [ .product(name: "Models", package: "Models"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), .testTarget( diff --git a/Packages/Notifications/.swiftpm/xcode/xcshareddata/xcschemes/Notifications.xcscheme b/Packages/Notifications/.swiftpm/xcode/xcshareddata/xcschemes/Notifications.xcscheme new file mode 100644 index 00000000..fba36560 --- /dev/null +++ b/Packages/Notifications/.swiftpm/xcode/xcshareddata/xcschemes/Notifications.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Notifications/Package.swift b/Packages/Notifications/Package.swift index 36aa4486..412e4751 100644 --- a/Packages/Notifications/Package.swift +++ b/Packages/Notifications/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -31,6 +31,9 @@ let package = Package( .product(name: "Env", package: "Env"), .product(name: "Status", package: "Status"), .product(name: "DesignSystem", package: "DesignSystem"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), ] diff --git a/Packages/Status/.swiftpm/xcode/xcshareddata/xcschemes/Status.xcscheme b/Packages/Status/.swiftpm/xcode/xcshareddata/xcschemes/Status.xcscheme index 31a6f207..a532f6ad 100644 --- a/Packages/Status/.swiftpm/xcode/xcshareddata/xcschemes/Status.xcscheme +++ b/Packages/Status/.swiftpm/xcode/xcshareddata/xcschemes/Status.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> @@ -26,19 +26,8 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + shouldAutocreateTestPlan = "YES"> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Timeline/.swiftpm/xcode/xcshareddata/xcschemes/TimelineTests.xcscheme b/Packages/Timeline/.swiftpm/xcode/xcshareddata/xcschemes/TimelineTests.xcscheme new file mode 100644 index 00000000..111c92e1 --- /dev/null +++ b/Packages/Timeline/.swiftpm/xcode/xcshareddata/xcschemes/TimelineTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Packages/Timeline/Package.swift b/Packages/Timeline/Package.swift index 0be0f8f4..c621f4da 100644 --- a/Packages/Timeline/Package.swift +++ b/Packages/Timeline/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.7 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -35,6 +35,9 @@ let package = Package( .product(name: "DesignSystem", package: "DesignSystem"), .product(name: "SwiftUIIntrospect", package: "SwiftUI-Introspect"), .product(name: "Bodega", package: "Bodega"), + ], + swiftSettings: [ + .enableExperimentalFeature("StrictConcurrency") ] ), .testTarget(