Skip to content

Commit

Permalink
Merge pull request #91 from shimastripe/feature/swift6-mode
Browse files Browse the repository at this point in the history
Enable Swift 6 mode
  • Loading branch information
shimastripe authored Sep 11, 2024
2 parents 1136fbe + 3028abb commit b0e78b1
Show file tree
Hide file tree
Showing 23 changed files with 79 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -216,6 +239,7 @@
ONLY_ACTIVE_ARCH = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 6.0;
};
name = Debug;
};
Expand Down Expand Up @@ -269,6 +293,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_VERSION = 6.0;
};
name = Release;
};
Expand All @@ -293,7 +318,6 @@
SUPPORTED_PLATFORMS = macosx;
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -318,7 +342,6 @@
SUPPORTED_PLATFORMS = macosx;
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions App/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import PackageDescription

let package = Package(
name: "client",
products: [],
targets: []
)
name: "client",
products: [],
targets: []
)
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.PHONY: format
format:
xcrun --sdk macosx swift-format swift-format -p -r -i .
33 changes: 8 additions & 25 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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(
Expand All @@ -56,24 +42,21 @@ let package = Package(
dependencies: [
.product(name: "Dependencies", package: "swift-dependencies"),
.product(name: "DependenciesMacros", package: "swift-dependencies"),
],
swiftSettings: swiftSettings
]
),
.target(
name: "IAPInterface",
dependencies: [
"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",
Expand All @@ -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]
)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Sources/IAPClient/CredentialClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Dependencies
import Foundation
import IAPInterface
import KeychainAccess
@preconcurrency import KeychainAccess

extension CredentialClient: DependencyKey {

Expand Down
2 changes: 1 addition & 1 deletion Sources/IAPClient/RootCertificateClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion Sources/IAPClient/SignedDataVerifier+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import AppStoreServerLibrary
import Foundation

extension VerificationError: Error {}
extension VerificationError: @retroactive Error {}

extension SignedDataVerifier {

Expand Down
15 changes: 8 additions & 7 deletions Sources/IAPInterface/AppStoreServerClientInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/IAPInterface/Model/AutoRenewStatus+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import AppStoreServerLibrary
import Foundation

extension AutoRenewStatus: CustomStringConvertible {
extension AutoRenewStatus: @retroactive CustomStringConvertible {

public var description: String {
switch self {
Expand Down
2 changes: 1 addition & 1 deletion Sources/IAPInterface/Model/ExpirationIntent+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import AppStoreServerLibrary
import Foundation

extension ExpirationIntent: CustomStringConvertible {
extension ExpirationIntent: @retroactive CustomStringConvertible {

public var description: String {
switch self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import AppStoreServerLibrary

extension JWSTransactionDecodedPayload: Identifiable {
extension JWSTransactionDecodedPayload: @retroactive Identifiable {
public var id: String? {
transactionId
}
Expand Down
6 changes: 3 additions & 3 deletions Sources/IAPInterface/Model/NotificationHistoryModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Sources/IAPInterface/Model/OfferType+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import AppStoreServerLibrary
import Foundation

extension OfferType: CustomStringConvertible {
extension OfferType: @retroactive CustomStringConvertible {

public var description: String {
switch self {
Expand Down
2 changes: 1 addition & 1 deletion Sources/IAPInterface/Model/PriceIncreaseStatus+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import AppStoreServerLibrary
import Foundation

extension PriceIncreaseStatus: CustomStringConvertible {
extension PriceIncreaseStatus: @retroactive CustomStringConvertible {

public var description: String {
switch self {
Expand Down
2 changes: 1 addition & 1 deletion Sources/IAPInterface/Model/RevocationReason+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import AppStoreServerLibrary

extension RevocationReason: CustomStringConvertible {
extension RevocationReason: @retroactive CustomStringConvertible {

public var description: String {
switch self {
Expand Down
4 changes: 3 additions & 1 deletion Sources/IAPInterface/Model/ServerEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Sources/IAPInterface/Model/Status+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import AppStoreServerLibrary
import SwiftUI

extension Status: CustomStringConvertible {
extension Status: @retroactive CustomStringConvertible {
public var description: String {
switch self {
case .active:
Expand Down
8 changes: 4 additions & 4 deletions Sources/IAPInterface/Model/SubscriptionStatus.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand All @@ -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?

Expand All @@ -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?

Expand Down
4 changes: 2 additions & 2 deletions Sources/IAPInterface/Model/TransactionHistory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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?

Expand Down
4 changes: 2 additions & 2 deletions Sources/IAPInterface/RootCertificateClientInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: ())
})
}

0 comments on commit b0e78b1

Please sign in to comment.