diff --git a/Common/Wrapper/URLSessionProtocol.swift b/Common/Wrapper/URLSessionProtocol.swift index cd181e3..e60b76b 100644 --- a/Common/Wrapper/URLSessionProtocol.swift +++ b/Common/Wrapper/URLSessionProtocol.swift @@ -23,12 +23,29 @@ public protocol URLSessionDataTaskProtocol { // MARK: Conform to protocols extension URLSession: URLSessionProtocol { + + @available(iOS, deprecated: 15.0, message: "Use the built-in API instead") + func data(from url: URLRequest) async throws -> (Data, URLResponse) { + try await withCheckedThrowingContinuation { continuation in + let task = self.dataTask(with: url) { data, response, error in + guard let data = data, let response = response else { + let error = error ?? URLError(.badServerResponse) + return continuation.resume(throwing: error) + } + + continuation.resume(returning: (data, response)) + } + + task.resume() + } + } + public func _dataTask(with request: URLRequest, completion: @escaping DataTaskResult) -> URLSessionDataTaskProtocol { dataTask(with: request, completionHandler: completion) as URLSessionDataTaskProtocol } public func data(for request: URLRequest) async throws -> (Data, URLResponse) { - try await data(for: request, delegate: nil) + try await data(from: request) } } diff --git a/Example/TraktKitExample/TraktKitExample.xcodeproj/project.pbxproj b/Example/TraktKitExample/TraktKitExample.xcodeproj/project.pbxproj index ba183e1..961827d 100644 --- a/Example/TraktKitExample/TraktKitExample.xcodeproj/project.pbxproj +++ b/Example/TraktKitExample/TraktKitExample.xcodeproj/project.pbxproj @@ -249,7 +249,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; @@ -304,7 +304,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -320,7 +320,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = TraktKitExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -338,7 +338,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; INFOPLIST_FILE = TraktKitExample/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/Package.swift b/Package.swift index bdfb1b0..936f3ad 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ let package = Package( name: "TraktKit", platforms: [ .macOS(.v12), - .iOS(.v15), + .iOS(.v13), .tvOS(.v15), .watchOS(.v8) ], diff --git a/TraktKit.podspec b/TraktKit.podspec index 949b395..3f54105 100644 --- a/TraktKit.podspec +++ b/TraktKit.podspec @@ -6,7 +6,7 @@ Pod::Spec.new do |s| s.license = { :type => "MIT", :file => "License.md" } s.authors = "Maximilian Litteral" s.swift_version = "5.0" - s.ios.deployment_target = "12.0" + s.ios.deployment_target = "13.0" s.osx.deployment_target = "10.12" s.watchos.deployment_target = "3.0" s.tvos.deployment_target = "15.0" diff --git a/TraktKit.xcodeproj/project.pbxproj b/TraktKit.xcodeproj/project.pbxproj index 5fcc08a..276f81d 100644 --- a/TraktKit.xcodeproj/project.pbxproj +++ b/TraktKit.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 269487002B9C6B6D00455FAA /* UserResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 269486FF2B9C6B6D00455FAA /* UserResource.swift */; }; + 269487022B9C6BAC00455FAA /* SearchResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 269487012B9C6BAC00455FAA /* SearchResource.swift */; }; 70005646206BBD30005319DD /* test_get_users_watching_now.json in Resources */ = {isa = PBXBuildFile; fileRef = 70005645206BBD30005319DD /* test_get_users_watching_now.json */; }; 70005648206BBF47005319DD /* TraktEpisodeTranslation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70005647206BBF47005319DD /* TraktEpisodeTranslation.swift */; }; 7000564C206BC209005319DD /* test_get_all_episode_translations.json in Resources */ = {isa = PBXBuildFile; fileRef = 7000564B206BC209005319DD /* test_get_all_episode_translations.json */; }; @@ -302,6 +304,8 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 269486FF2B9C6B6D00455FAA /* UserResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserResource.swift; sourceTree = ""; }; + 269487012B9C6BAC00455FAA /* SearchResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchResource.swift; sourceTree = ""; }; 70005645206BBD30005319DD /* test_get_users_watching_now.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test_get_users_watching_now.json; sourceTree = ""; }; 70005647206BBF47005319DD /* TraktEpisodeTranslation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TraktEpisodeTranslation.swift; sourceTree = ""; }; 7000564B206BC209005319DD /* test_get_all_episode_translations.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = test_get_all_episode_translations.json; sourceTree = ""; }; @@ -1108,6 +1112,7 @@ 74A88269267772220075491B /* Resources */ = { isa = PBXGroup; children = ( + 269487012B9C6BAC00455FAA /* SearchResource.swift */, 74A8827E267772B10075491B /* TraktManager+AsyncAwait.swift */, 74A8827A267772A30075491B /* TraktManager+Resources.swift */, 74A8826A267772360075491B /* ShowResource.swift */, @@ -1115,6 +1120,7 @@ 74A88272267772490075491B /* EpisodeResource.swift */, 74A882762677724E0075491B /* MovieResource.swift */, 74A8828226777C770075491B /* ExploreResource.swift */, + 269486FF2B9C6B6D00455FAA /* UserResource.swift */, ); path = Resources; sourceTree = ""; @@ -1525,6 +1531,7 @@ 70F773301F3C77D80078110E /* Alias.swift in Sources */, 703D2ED71EF1422300CAD268 /* Person.swift in Sources */, 700FED291F3FBD8C00169961 /* ScrobbleResult.swift in Sources */, + 269487002B9C6B6D00455FAA /* UserResource.swift in Sources */, 70B8442E1EF0DC4D001BA900 /* TraktWatchedProgress.swift in Sources */, 70D369932066DE000008B9D7 /* TraktCommentLikedUser.swift in Sources */, 70B844251EF0DC4D001BA900 /* TraktMostShow.swift in Sources */, @@ -1545,6 +1552,7 @@ 74A8828326777C770075491B /* ExploreResource.swift in Sources */, 70F7E6231EF220160026B8A1 /* CalendarShow.swift in Sources */, 705462671EF367BA003BB24B /* PlaybackProgress.swift in Sources */, + 269487022B9C6BAC00455FAA /* SearchResource.swift in Sources */, 70393F381F3F2C4700943D34 /* RemoveRatingsResult.swift in Sources */, 74A882772677724E0075491B /* MovieResource.swift in Sources */, 70B8443E1EF0E020001BA900 /* TraktCheckin.swift in Sources */, @@ -1712,7 +1720,7 @@ ENABLE_TESTABILITY = YES; INFOPLIST_FILE = TraktKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_SWIFT_FLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.litteral.$(PRODUCT_NAME:rfc1034identifier)"; @@ -1870,7 +1878,7 @@ ENABLE_TESTABILITY = YES; INFOPLIST_FILE = TraktKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_SWIFT_FLAGS = "-D DEBUG"; PRODUCT_BUNDLE_IDENTIFIER = "com.litteral.$(PRODUCT_NAME:rfc1034identifier)"; @@ -1895,7 +1903,7 @@ ENABLE_TESTABILITY = YES; INFOPLIST_FILE = TraktKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; OTHER_SWIFT_FLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = "com.litteral.$(PRODUCT_NAME:rfc1034identifier)";