diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9afcdcb..6f057a5 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -11,7 +11,7 @@ jobs: name: Analyze runs-on: macos-14 env: - DEVELOPER_DIR: "/Applications/Xcode_15.4.0.app/Contents/Developer" + DEVELOPER_DIR: "/Applications/Xcode_16_beta_6.app/Contents/Developer" timeout-minutes: 120 permissions: security-events: write diff --git a/App/InAppPurchaseViewer/InAppPurchaseViewer.xcodeproj/project.pbxproj b/App/InAppPurchaseViewer/InAppPurchaseViewer.xcodeproj/project.pbxproj index fbbf85f..858d7ea 100644 --- a/App/InAppPurchaseViewer/InAppPurchaseViewer.xcodeproj/project.pbxproj +++ b/App/InAppPurchaseViewer/InAppPurchaseViewer.xcodeproj/project.pbxproj @@ -82,6 +82,7 @@ isa = PBXNativeTarget; buildConfigurationList = 458FE1652B6E239700798686 /* Build configuration list for PBXNativeTarget "InAppPurchaseViewer" */; buildPhases = ( + 45A8B3AC2C920C25004E6CF6 /* Run swift-format */, 458FE1522B6E239600798686 /* Sources */, 458FE1532B6E239600798686 /* Frameworks */, 458FE1542B6E239600798686 /* Resources */, @@ -146,6 +147,28 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 45A8B3AC2C920C25004E6CF6 /* Run swift-format */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + name = "Run swift-format"; + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "cd ../../\nmake format\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 458FE1522B6E239600798686 /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -216,6 +239,7 @@ ONLY_ACTIVE_ARCH = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 6.0; }; name = Debug; }; @@ -269,6 +293,7 @@ MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 6.0; }; name = Release; }; @@ -293,7 +318,6 @@ SUPPORTED_PLATFORMS = macosx; SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -318,7 +342,6 @@ SUPPORTED_PLATFORMS = macosx; SUPPORTS_MACCATALYST = NO; SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/App/InAppPurchaseViewer/InAppPurchaseViewer/InAppPurchaseViewerApp.swift b/App/InAppPurchaseViewer/InAppPurchaseViewer/InAppPurchaseViewerApp.swift index 27a68ba..d9ddfe8 100644 --- a/App/InAppPurchaseViewer/InAppPurchaseViewer/InAppPurchaseViewerApp.swift +++ b/App/InAppPurchaseViewer/InAppPurchaseViewer/InAppPurchaseViewerApp.swift @@ -25,8 +25,9 @@ struct InAppPurchaseViewerApp: App { } .commands { CommandGroup(after: .appInfo) { - Button("Check for Updates...", - action: updaterController.updater.checkForUpdates) + Button( + "Check for Updates...", + action: updaterController.updater.checkForUpdates) } } Settings { diff --git a/App/Package.swift b/App/Package.swift index 24f66a6..f633a64 100644 --- a/App/Package.swift +++ b/App/Package.swift @@ -5,7 +5,7 @@ import PackageDescription let package = Package( - name: "client", - products: [], - targets: [] -) \ No newline at end of file + name: "client", + products: [], + targets: [] +) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fe4f438 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: format +format: + xcrun --sdk macosx swift-format swift-format -p -r -i . diff --git a/Package.swift b/Package.swift index 659db98..5dbaa28 100644 --- a/Package.swift +++ b/Package.swift @@ -1,21 +1,8 @@ -// swift-tools-version: 5.10 +// swift-tools-version: 6.0 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription -let swiftSettings: [SwiftSetting] = [ - .enableUpcomingFeature("BareSlashRegexLiterals"), - .enableUpcomingFeature("ConciseMagicFile"), - .enableUpcomingFeature("DeprecateApplicationMain"), - .enableUpcomingFeature("DisableOutwardActorInference"), - .enableUpcomingFeature("ExistentialAny"), - .enableUpcomingFeature("ForwardTrailingClosures"), - .enableUpcomingFeature("GlobalConcurrency"), - .enableUpcomingFeature("ImplicitOpenExistentials"), - .enableUpcomingFeature("ImportObjcForwardDeclarations"), - .enableUpcomingFeature("IsolatedDefaultValues"), -] - let package = Package( name: "InAppPurchaseViewer", defaultLocalization: "ja", @@ -34,7 +21,6 @@ let package = Package( .package(url: "https://github.com/sparkle-project/Sparkle", exact: "2.6.4"), .package(url: "https://github.com/pointfreeco/swift-dependencies", exact: "1.3.9"), .package(url: "https://github.com/apple/swift-http-types", exact: "1.3.0"), - .package(url: "https://github.com/apple/swift-format", exact: "510.1.0"), ], targets: [ .target( @@ -56,8 +42,7 @@ let package = Package( dependencies: [ .product(name: "Dependencies", package: "swift-dependencies"), .product(name: "DependenciesMacros", package: "swift-dependencies"), - ], - swiftSettings: swiftSettings + ] ), .target( name: "IAPInterface", @@ -65,15 +50,13 @@ let package = Package( "IAPCore", // Use Model... .product(name: "AppStoreServerLibrary", package: "app-store-server-library-swift"), - ], - swiftSettings: swiftSettings + ] ), .target( name: "IAPModel", dependencies: [ - "IAPInterface", - ], - swiftSettings: swiftSettings + "IAPInterface" + ] ), .testTarget( name: "IAPModelTests", @@ -85,14 +68,14 @@ let package = Package( "IAPModel", .product(name: "Sparkle", package: "Sparkle"), ], - swiftSettings: swiftSettings, plugins: [ - .plugin(name: "LicensesPlugin", package: "LicensesPlugin"), + .plugin(name: "LicensesPlugin", package: "LicensesPlugin") ] ), .testTarget( name: "IAPViewTests", dependencies: ["IAPView"] ), - ] + ], + swiftLanguageVersions: [.v6] ) diff --git a/README.md b/README.md index a86a9e5..061d210 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Get the statuses for all of a customer’s auto-renewable subscriptions in your ### Development Environment -- macOS 14 Sonoma -- Xcode 15.4 -- Swift 5.10 +- macOS 15 Sequoia +- Xcode 16.0 +- Swift 6.0 - Sandbox enabled diff --git a/Sources/IAPClient/CredentialClient.swift b/Sources/IAPClient/CredentialClient.swift index 8fabb45..a937866 100644 --- a/Sources/IAPClient/CredentialClient.swift +++ b/Sources/IAPClient/CredentialClient.swift @@ -8,7 +8,7 @@ import Dependencies import Foundation import IAPInterface -import KeychainAccess +@preconcurrency import KeychainAccess extension CredentialClient: DependencyKey { diff --git a/Sources/IAPClient/RootCertificateClient.swift b/Sources/IAPClient/RootCertificateClient.swift index 0dc7699..d7ab219 100644 --- a/Sources/IAPClient/RootCertificateClient.swift +++ b/Sources/IAPClient/RootCertificateClient.swift @@ -10,7 +10,7 @@ import Foundation import HTTPTypes import HTTPTypesFoundation import IAPInterface -import KeychainAccess +@preconcurrency import KeychainAccess extension RootCertificateClient: DependencyKey { public static let liveValue: RootCertificateClient = { diff --git a/Sources/IAPClient/SignedDataVerifier+.swift b/Sources/IAPClient/SignedDataVerifier+.swift index 329fb90..90bd2a3 100644 --- a/Sources/IAPClient/SignedDataVerifier+.swift +++ b/Sources/IAPClient/SignedDataVerifier+.swift @@ -8,7 +8,7 @@ import AppStoreServerLibrary import Foundation -extension VerificationError: Error {} +extension VerificationError: @retroactive Error {} extension SignedDataVerifier { diff --git a/Sources/IAPInterface/AppStoreServerClientInterface.swift b/Sources/IAPInterface/AppStoreServerClientInterface.swift index 380746d..21182cd 100644 --- a/Sources/IAPInterface/AppStoreServerClientInterface.swift +++ b/Sources/IAPInterface/AppStoreServerClientInterface.swift @@ -56,13 +56,14 @@ public struct AppStoreServerClient: Sendable { extension AppStoreServerClient: TestDependencyKey { public static let testValue = Self() public static let previewValue: AppStoreServerClient = { - let makeDate: (_ year: Int, _ month: Int, _ day: Int, _ hour: Int, _ minute: Int) -> Date? = - { - (year, month, day, hour, minute) in - Calendar.current.date( - from: .init( - year: year, month: month, day: day, hour: hour, minute: minute)) - } + let makeDate: + @Sendable (_ year: Int, _ month: Int, _ day: Int, _ hour: Int, _ minute: Int) -> Date? = + { + (year, month, day, hour, minute) in + Calendar.current.date( + from: .init( + year: year, month: month, day: day, hour: hour, minute: minute)) + } return .init( fetchNotificationHistory: { _, _, _, _, _, _, _ in diff --git a/Sources/IAPInterface/Model/AutoRenewStatus+.swift b/Sources/IAPInterface/Model/AutoRenewStatus+.swift index 878db6d..0a53d47 100644 --- a/Sources/IAPInterface/Model/AutoRenewStatus+.swift +++ b/Sources/IAPInterface/Model/AutoRenewStatus+.swift @@ -8,7 +8,7 @@ import AppStoreServerLibrary import Foundation -extension AutoRenewStatus: CustomStringConvertible { +extension AutoRenewStatus: @retroactive CustomStringConvertible { public var description: String { switch self { diff --git a/Sources/IAPInterface/Model/ExpirationIntent+.swift b/Sources/IAPInterface/Model/ExpirationIntent+.swift index b7bde75..812a988 100644 --- a/Sources/IAPInterface/Model/ExpirationIntent+.swift +++ b/Sources/IAPInterface/Model/ExpirationIntent+.swift @@ -8,7 +8,7 @@ import AppStoreServerLibrary import Foundation -extension ExpirationIntent: CustomStringConvertible { +extension ExpirationIntent: @retroactive CustomStringConvertible { public var description: String { switch self { diff --git a/Sources/IAPInterface/Model/JWSTransactionDecodedPayload+.swift b/Sources/IAPInterface/Model/JWSTransactionDecodedPayload+.swift index 86c2972..39bd19a 100644 --- a/Sources/IAPInterface/Model/JWSTransactionDecodedPayload+.swift +++ b/Sources/IAPInterface/Model/JWSTransactionDecodedPayload+.swift @@ -7,7 +7,7 @@ import AppStoreServerLibrary -extension JWSTransactionDecodedPayload: Identifiable { +extension JWSTransactionDecodedPayload: @retroactive Identifiable { public var id: String? { transactionId } diff --git a/Sources/IAPInterface/Model/NotificationHistoryModel.swift b/Sources/IAPInterface/Model/NotificationHistoryModel.swift index 1e05622..2d03ed7 100644 --- a/Sources/IAPInterface/Model/NotificationHistoryModel.swift +++ b/Sources/IAPInterface/Model/NotificationHistoryModel.swift @@ -5,10 +5,10 @@ // Created by shimastripe on 2024/02/10. // -import AppStoreServerLibrary // For Model +@preconcurrency import AppStoreServerLibrary // For Model import Foundation -public struct NotificationHistoryModel: Codable, Hashable { +public struct NotificationHistoryModel: Codable, Hashable, Sendable { public var paginationToken: String? @@ -25,7 +25,7 @@ public struct NotificationHistoryModel: Codable, Hashable { } } -public struct NotificationHistoryItem: Identifiable, Codable, Hashable { +public struct NotificationHistoryItem: Identifiable, Codable, Hashable, Sendable { public struct ID: RawRepresentable, Hashable, Sendable, Codable, ExpressibleByStringLiteral { public let rawValue: String diff --git a/Sources/IAPInterface/Model/OfferType+.swift b/Sources/IAPInterface/Model/OfferType+.swift index e8b1846..b04c785 100644 --- a/Sources/IAPInterface/Model/OfferType+.swift +++ b/Sources/IAPInterface/Model/OfferType+.swift @@ -8,7 +8,7 @@ import AppStoreServerLibrary import Foundation -extension OfferType: CustomStringConvertible { +extension OfferType: @retroactive CustomStringConvertible { public var description: String { switch self { diff --git a/Sources/IAPInterface/Model/PriceIncreaseStatus+.swift b/Sources/IAPInterface/Model/PriceIncreaseStatus+.swift index dc987b1..257ea10 100644 --- a/Sources/IAPInterface/Model/PriceIncreaseStatus+.swift +++ b/Sources/IAPInterface/Model/PriceIncreaseStatus+.swift @@ -8,7 +8,7 @@ import AppStoreServerLibrary import Foundation -extension PriceIncreaseStatus: CustomStringConvertible { +extension PriceIncreaseStatus: @retroactive CustomStringConvertible { public var description: String { switch self { diff --git a/Sources/IAPInterface/Model/RevocationReason+.swift b/Sources/IAPInterface/Model/RevocationReason+.swift index 64763e2..d297d54 100644 --- a/Sources/IAPInterface/Model/RevocationReason+.swift +++ b/Sources/IAPInterface/Model/RevocationReason+.swift @@ -7,7 +7,7 @@ import AppStoreServerLibrary -extension RevocationReason: CustomStringConvertible { +extension RevocationReason: @retroactive CustomStringConvertible { public var description: String { switch self { diff --git a/Sources/IAPInterface/Model/ServerEnvironment.swift b/Sources/IAPInterface/Model/ServerEnvironment.swift index d546749..23778f3 100644 --- a/Sources/IAPInterface/Model/ServerEnvironment.swift +++ b/Sources/IAPInterface/Model/ServerEnvironment.swift @@ -7,7 +7,9 @@ import Foundation -public enum ServerEnvironment: Identifiable, Hashable, CustomStringConvertible, CaseIterable { +public enum ServerEnvironment: Identifiable, Hashable, CustomStringConvertible, CaseIterable, + Sendable +{ case sandbox case production diff --git a/Sources/IAPInterface/Model/Status+.swift b/Sources/IAPInterface/Model/Status+.swift index 4e40124..1e7e71d 100644 --- a/Sources/IAPInterface/Model/Status+.swift +++ b/Sources/IAPInterface/Model/Status+.swift @@ -8,7 +8,7 @@ import AppStoreServerLibrary import SwiftUI -extension Status: CustomStringConvertible { +extension Status: @retroactive CustomStringConvertible { public var description: String { switch self { case .active: diff --git a/Sources/IAPInterface/Model/SubscriptionStatus.swift b/Sources/IAPInterface/Model/SubscriptionStatus.swift index 00a9f45..cad278c 100644 --- a/Sources/IAPInterface/Model/SubscriptionStatus.swift +++ b/Sources/IAPInterface/Model/SubscriptionStatus.swift @@ -5,10 +5,10 @@ // Created by shimastripe on 2024/02/22. // -import AppStoreServerLibrary // For Model +@preconcurrency import AppStoreServerLibrary // For Model import Foundation -public struct SubscriptionStatus: Codable, Hashable { +public struct SubscriptionStatus: Codable, Hashable, Sendable { public let environment: Environment? @@ -28,7 +28,7 @@ public struct SubscriptionStatus: Codable, Hashable { } } -public struct SubscriptionGroup: Codable, Hashable, Identifiable { +public struct SubscriptionGroup: Codable, Hashable, Identifiable, Sendable { public let subscriptionGroupIdentifier: String? @@ -47,7 +47,7 @@ public struct SubscriptionGroup: Codable, Hashable, Identifiable { } } -public struct LastTransaction: Codable, Hashable, Identifiable { +public struct LastTransaction: Codable, Hashable, Identifiable, Sendable { public let status: Status? diff --git a/Sources/IAPInterface/Model/TransactionHistory.swift b/Sources/IAPInterface/Model/TransactionHistory.swift index c9aba3d..ae2b7a4 100644 --- a/Sources/IAPInterface/Model/TransactionHistory.swift +++ b/Sources/IAPInterface/Model/TransactionHistory.swift @@ -5,10 +5,10 @@ // Created by shimastripe on 2024/02/24. // -import AppStoreServerLibrary // For Model +@preconcurrency import AppStoreServerLibrary // For Model import Foundation -public struct TransactionHistory: Codable, Hashable { +public struct TransactionHistory: Codable, Hashable, Sendable { public var revision: String? diff --git a/Sources/IAPInterface/RootCertificateClientInterface.swift b/Sources/IAPInterface/RootCertificateClientInterface.swift index 404c032..8adc8ef 100644 --- a/Sources/IAPInterface/RootCertificateClientInterface.swift +++ b/Sources/IAPInterface/RootCertificateClientInterface.swift @@ -30,12 +30,12 @@ extension RootCertificateClient: TestDependencyKey { public static let testValue = Self() public static let previewValue: RootCertificateClient = .init( fetch: { - unimplemented() + unimplemented(placeholder: Data()) }, get: { Data() }, remove: { - unimplemented() + unimplemented(placeholder: ()) }) }