diff --git a/Cartfile b/Cartfile index f685ca7..17abdb2 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1 @@ -github "ishkawa/APIKit" ~> 5.0 +github "ishkawa/APIKit" "feature/swift6-concurrency" diff --git a/Cartfile.resolved b/Cartfile.resolved index 43b622e..b835a77 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1 +1 @@ -github "ishkawa/APIKit" "5.0.0" +github "ca-love/APIKit" "feature/swift6-concurrency" diff --git a/Configurations/Ship.xcconfig b/Configurations/Ship.xcconfig index f21258a..9f89d5b 100644 --- a/Configurations/Ship.xcconfig +++ b/Configurations/Ship.xcconfig @@ -1,8 +1,8 @@ -SWIFT_VERSION = 5.0 -IPHONEOS_DEPLOYMENT_TARGET = 8.0 -MACOSX_DEPLOYMENT_TARGET = 10.10 -TVOS_DEPLOYMENT_TARGET = 9.0 -WATCHOS_DEPLOYMENT_TARGET = 2.0 +SWIFT_VERSION = 5.10 +IPHONEOS_DEPLOYMENT_TARGET = 16.0 +MACOSX_DEPLOYMENT_TARGET = 13.0 +TVOS_DEPLOYMENT_TARGET = 16.0 +WATCHOS_DEPLOYMENT_TARGET = 9.0 SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator watchos watchsimulator appletvos appletvsimulator TARGETED_DEVICE_FAMILY = 1,2,3,4 diff --git a/Package.swift b/Package.swift index d5e8661..98f5a19 100644 --- a/Package.swift +++ b/Package.swift @@ -4,12 +4,12 @@ import PackageDescription let package = Package( name: "Ship", - platforms: [.macOS(.v10_10), .iOS(.v8), .tvOS(.v9), .watchOS(.v2)], + platforms: [.macOS(.v13), .iOS(.v16), .tvOS(.v16), .watchOS(.v9)], products: [ .library(name: "Ship", targets: ["Ship"]) ], dependencies: [ - .package(url: "https://github.com/ishkawa/APIKit.git", .upToNextMinor(from: "5.0.0")) + .package(url: "https://github.com/ca-love/APIKit.git", .branch("feature/swift6-concurrency")) ], targets: [ .target(name: "Ship", dependencies: ["APIKit"], path: "Ship"), diff --git a/Ship.podspec b/Ship.podspec index 3e158b4..e3b743f 100644 --- a/Ship.podspec +++ b/Ship.podspec @@ -1,17 +1,17 @@ Pod::Spec.new do |s| s.name = 'Ship' s.version = '1.0.0' - s.swift_version = '5.0' + s.swift_version = '5.10' s.summary = 'Ship is a APIKit plugin that can inject common processing to requests on APIKit.' s.homepage = 'https://github.com/cats-oss/Ship' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Kyohei Ito' => 'ito_kyohei@cyberagent.co.jp' } s.source = { :git => 'https://github.com/cats-oss/Ship.git', :tag => s.version.to_s } - s.ios.deployment_target = '8.0' - s.tvos.deployment_target = '9.0' - s.osx.deployment_target = '10.10' - s.watchos.deployment_target = '2.0' + s.ios.deployment_target = '16.0' + s.tvos.deployment_target = '16.0' + s.osx.deployment_target = '13.0' + s.watchos.deployment_target = '9.0' s.source_files = 'Ship/**/*.{h,swift}' s.requires_arc = true - s.dependency "APIKit", "~> 5.0" + s.dependency "APIKit", "~> 5.4" end diff --git a/Ship.xcodeproj/project.pbxproj b/Ship.xcodeproj/project.pbxproj index eb84cd6..43c6f17 100644 --- a/Ship.xcodeproj/project.pbxproj +++ b/Ship.xcodeproj/project.pbxproj @@ -3,19 +3,17 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ + C5AC78882C5A0A8E008EDBDC /* APIKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5AC78872C5A0A8E008EDBDC /* APIKit.xcframework */; }; C755D5D0225C48DC005B0CEF /* Ship.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C755D5C6225C48DB005B0CEF /* Ship.framework */; }; - C755D5FB225C67B6005B0CEF /* APIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C755D5F9225C67B6005B0CEF /* APIKit.framework */; }; C755D611225C6EAC005B0CEF /* RequestProxyMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C755D607225C6EAC005B0CEF /* RequestProxyMock.swift */; }; C755D612225C6EAC005B0CEF /* RequestMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C755D608225C6EAC005B0CEF /* RequestMock.swift */; }; C755D613225C6EAC005B0CEF /* DependencyMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = C755D609225C6EAC005B0CEF /* DependencyMock.swift */; }; C78C860D2270000900B14BB1 /* AnyBasePathComponentTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C78C860C2270000900B14BB1 /* AnyBasePathComponentTest.swift */; }; C7B219DE2289176900B0579D /* Ship.h in Headers */ = {isa = PBXBuildFile; fileRef = C7FDA03E226DB6770092F224 /* Ship.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C7D02307225CC4C800B76B20 /* APIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C755D5F9225C67B6005B0CEF /* APIKit.framework */; }; - C7D0230C225CC4DE00B76B20 /* APIKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = C755D5F9225C67B6005B0CEF /* APIKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; C7D02312225CD4D900B76B20 /* DependencyTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D0230E225CD4D900B76B20 /* DependencyTest.swift */; }; C7D0231B225CD64400B76B20 /* RequestTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D0231A225CD64400B76B20 /* RequestTest.swift */; }; C7D0231D225CE60E00B76B20 /* SessionTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D0231C225CE60E00B76B20 /* SessionTest.swift */; }; @@ -47,17 +45,16 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - C7D0230C225CC4DE00B76B20 /* APIKit.framework in CopyFiles */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + C5AC78872C5A0A8E008EDBDC /* APIKit.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = APIKit.xcframework; path = Carthage/Build/APIKit.xcframework; sourceTree = ""; }; C755D5C6225C48DB005B0CEF /* Ship.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Ship.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C755D5CF225C48DC005B0CEF /* ShipTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ShipTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C755D5D6225C48DC005B0CEF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - C755D5F9225C67B6005B0CEF /* APIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = APIKit.framework; path = Carthage/Build/iOS/APIKit.framework; sourceTree = ""; }; C755D607225C6EAC005B0CEF /* RequestProxyMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestProxyMock.swift; sourceTree = ""; }; C755D608225C6EAC005B0CEF /* RequestMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestMock.swift; sourceTree = ""; }; C755D609225C6EAC005B0CEF /* DependencyMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DependencyMock.swift; sourceTree = ""; }; @@ -84,7 +81,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C755D5FB225C67B6005B0CEF /* APIKit.framework in Frameworks */, + C5AC78882C5A0A8E008EDBDC /* APIKit.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -92,7 +89,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C7D02307225CC4C800B76B20 /* APIKit.framework in Frameworks */, C755D5D0225C48DC005B0CEF /* Ship.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -149,7 +145,7 @@ C755D5F7225C67B6005B0CEF /* Frameworks */ = { isa = PBXGroup; children = ( - C755D5F9225C67B6005B0CEF /* APIKit.framework */, + C5AC78872C5A0A8E008EDBDC /* APIKit.xcframework */, ); name = Frameworks; sourceTree = ""; @@ -470,16 +466,21 @@ ); INFOPLIST_FILE = Ship/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 13.0; PRODUCT_BUNDLE_IDENTIFIER = jp.co.cyberagent.Ship; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_STRICT_CONCURRENCY = complete; TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 16.0; + WATCHOS_DEPLOYMENT_TARGET = 9.0; }; name = Debug; }; @@ -499,15 +500,20 @@ ); INFOPLIST_FILE = Ship/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MACOSX_DEPLOYMENT_TARGET = 13.0; PRODUCT_BUNDLE_IDENTIFIER = jp.co.cyberagent.Ship; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; + SWIFT_STRICT_CONCURRENCY = complete; TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 16.0; + WATCHOS_DEPLOYMENT_TARGET = 9.0; }; name = Release; }; diff --git a/Ship/Dependency.swift b/Ship/Dependency.swift index e66f812..552e122 100644 --- a/Ship/Dependency.swift +++ b/Ship/Dependency.swift @@ -1,6 +1,6 @@ import Foundation -public protocol Dependency { +public protocol Dependency: Sendable { func buildBaseURL(_ request: R) -> URL func buildHeaderFields(_ request: R) -> [String: String] func intercept(request: R, urlRequest: URLRequest) throws -> URLRequest diff --git a/Ship/RequestProxyProtocol.swift b/Ship/RequestProxyProtocol.swift index 275406d..a859df9 100644 --- a/Ship/RequestProxyProtocol.swift +++ b/Ship/RequestProxyProtocol.swift @@ -18,11 +18,11 @@ extension RequestProxyProtocol where Response == Request.Response { return request.path } - var parameters: Any? { + var parameters: Sendable? { return request.parameters } - var queryParameters: [String: Any]? { + var queryParameters: [String: Sendable]? { return request.queryParameters } diff --git a/Ship/Session.swift b/Ship/Session.swift index 7d28c07..0c9ae77 100644 --- a/Ship/Session.swift +++ b/Ship/Session.swift @@ -14,7 +14,7 @@ open class Session { } @discardableResult - open func send(_ request: R, callbackQueue: CallbackQueue? = nil, handler: @escaping (Result) -> Void) -> SessionTask? { + open func send(_ request: R, callbackQueue: CallbackQueue? = nil, handler: @escaping @Sendable (Result) -> Void) -> SessionTask? { let proxy = RequestProxy(request: request, dependency: dependency) return session.send(proxy, callbackQueue: callbackQueue, handler: handler) }