Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Swift6 Concurrency #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ishkawa/APIKit" ~> 5.0
github "ishkawa/APIKit" "feature/swift6-concurrency"
2 changes: 1 addition & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "ishkawa/APIKit" "5.0.0"
github "ca-love/APIKit" "feature/swift6-concurrency"
10 changes: 5 additions & 5 deletions Configurations/Ship.xcconfig
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
12 changes: 6 additions & 6 deletions Ship.podspec
Original file line number Diff line number Diff line change
@@ -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' => '[email protected]' }
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
24 changes: 15 additions & 9 deletions Ship.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -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 = "<group>"; };
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 = "<group>"; };
C755D5F9225C67B6005B0CEF /* APIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = APIKit.framework; path = Carthage/Build/iOS/APIKit.framework; sourceTree = "<group>"; };
C755D607225C6EAC005B0CEF /* RequestProxyMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestProxyMock.swift; sourceTree = "<group>"; };
C755D608225C6EAC005B0CEF /* RequestMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestMock.swift; sourceTree = "<group>"; };
C755D609225C6EAC005B0CEF /* DependencyMock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DependencyMock.swift; sourceTree = "<group>"; };
Expand All @@ -84,15 +81,14 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C755D5FB225C67B6005B0CEF /* APIKit.framework in Frameworks */,
C5AC78882C5A0A8E008EDBDC /* APIKit.xcframework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
C755D5CC225C48DC005B0CEF /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C7D02307225CC4C800B76B20 /* APIKit.framework in Frameworks */,
C755D5D0225C48DC005B0CEF /* Ship.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -149,7 +145,7 @@
C755D5F7225C67B6005B0CEF /* Frameworks */ = {
isa = PBXGroup;
children = (
C755D5F9225C67B6005B0CEF /* APIKit.framework */,
C5AC78872C5A0A8E008EDBDC /* APIKit.xcframework */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand Down
2 changes: 1 addition & 1 deletion Ship/Dependency.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

public protocol Dependency {
public protocol Dependency: Sendable {
func buildBaseURL<R: Request>(_ request: R) -> URL
func buildHeaderFields<R: Request>(_ request: R) -> [String: String]
func intercept<R: Request>(request: R, urlRequest: URLRequest) throws -> URLRequest
Expand Down
4 changes: 2 additions & 2 deletions Ship/RequestProxyProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion Ship/Session.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ open class Session {
}

@discardableResult
open func send<R: Request>(_ request: R, callbackQueue: CallbackQueue? = nil, handler: @escaping (Result<R.Response, SessionTaskError>) -> Void) -> SessionTask? {
open func send<R: Request>(_ request: R, callbackQueue: CallbackQueue? = nil, handler: @escaping @Sendable (Result<R.Response, SessionTaskError>) -> Void) -> SessionTask? {
let proxy = RequestProxy(request: request, dependency: dependency)
return session.send(proxy, callbackQueue: callbackQueue, handler: handler)
}
Expand Down