@@ -58,17 +58,18 @@ public protocol Router {
5858
5959 func urlQuery( _ parameters: [ String : Any ] ) -> [ URLQueryItem ] ?
6060 func request( _ urlComponents: URLComponents , parameters: [ String : Any ] ) -> URLRequest ?
61- func loadJSON< T: Codable > ( _ session: RequestKitURLSession , expectedResultType: T . Type , completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
62- func load< T: Codable > ( _ session: RequestKitURLSession , dateDecodingStrategy: JSONDecoder . DateDecodingStrategy ? , expectedResultType: T . Type ,
63- completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
64- func load< T: Codable > ( _ session: RequestKitURLSession , decoder: JSONDecoder , expectedResultType: T . Type , completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
61+ func loadJSON< T: Decodable > ( _ session: RequestKitURLSession , expectedResultType: T . Type , completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
62+ func load< T: Decodable > ( _ session: RequestKitURLSession , dateDecodingStrategy: JSONDecoder . DateDecodingStrategy ? , expectedResultType: T . Type ,
63+ completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
64+ func load< T: Decodable > ( _ session: RequestKitURLSession , decoder: JSONDecoder , expectedResultType: T . Type , completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void )
65+ -> URLSessionDataTaskProtocol ?
6566 func request( ) -> URLRequest ?
6667
6768 #if compiler(>=5.5.2) && canImport(_Concurrency)
6869 @available ( macOS 12 . 0 , iOS 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
69- func load< T: Codable > ( _ session: RequestKitURLSession , decoder: JSONDecoder , expectedResultType _: T . Type ) async throws -> T
70+ func load< T: Decodable > ( _ session: RequestKitURLSession , decoder: JSONDecoder , expectedResultType _: T . Type ) async throws -> T
7071 @available ( macOS 12 . 0 , iOS 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
71- func load< T: Codable > ( _ session: RequestKitURLSession , dateDecodingStrategy: JSONDecoder . DateDecodingStrategy ? , expectedResultType: T . Type ) async throws -> T
72+ func load< T: Decodable > ( _ session: RequestKitURLSession , dateDecodingStrategy: JSONDecoder . DateDecodingStrategy ? , expectedResultType: T . Type ) async throws -> T
7273 @available ( macOS 12 . 0 , iOS 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
7374 func load( _ session: RequestKitURLSession ) async throws
7475 #endif
@@ -150,14 +151,14 @@ public extension Router {
150151 }
151152
152153 @available ( * , deprecated, message: " Plase use `load` method instead " )
153- func loadJSON< T: Codable > ( _ session: RequestKitURLSession = URLSession . shared, expectedResultType: T . Type ,
154- completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
154+ func loadJSON< T: Decodable > ( _ session: RequestKitURLSession = URLSession . shared, expectedResultType: T . Type ,
155+ completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
155156 {
156157 return load ( session, expectedResultType: expectedResultType, completion: completion)
157158 }
158159
159- func load< T: Codable > ( _ session: RequestKitURLSession = URLSession . shared, dateDecodingStrategy: JSONDecoder . DateDecodingStrategy ? , expectedResultType: T . Type ,
160- completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
160+ func load< T: Decodable > ( _ session: RequestKitURLSession = URLSession . shared, dateDecodingStrategy: JSONDecoder . DateDecodingStrategy ? , expectedResultType: T . Type ,
161+ completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
161162 {
162163 let decoder = JSONDecoder ( )
163164 if let dateDecodingStrategy = dateDecodingStrategy {
@@ -166,8 +167,8 @@ public extension Router {
166167 return load ( session, decoder: decoder, expectedResultType: expectedResultType, completion: completion)
167168 }
168169
169- func load< T: Codable > ( _ session: RequestKitURLSession = URLSession . shared, decoder: JSONDecoder = JSONDecoder ( ) , expectedResultType _: T . Type ,
170- completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
170+ func load< T: Decodable > ( _ session: RequestKitURLSession = URLSession . shared, decoder: JSONDecoder = JSONDecoder ( ) , expectedResultType _: T . Type ,
171+ completion: @escaping ( _ json: T ? , _ error: Error ? ) -> Void ) -> URLSessionDataTaskProtocol ?
171172 {
172173 guard let request = request ( ) else {
173174 return nil
@@ -231,7 +232,7 @@ public extension Router {
231232#if compiler(>=5.5.2) && canImport(_Concurrency)
232233@available ( macOS 12 . 0 , iOS 15 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
233234public extension Router {
234- func load< T: Codable > ( _ session: RequestKitURLSession = URLSession . shared, decoder: JSONDecoder = JSONDecoder ( ) , expectedResultType _: T . Type ) async throws -> T {
235+ func load< T: Decodable > ( _ session: RequestKitURLSession = URLSession . shared, decoder: JSONDecoder = JSONDecoder ( ) , expectedResultType _: T . Type ) async throws -> T {
235236 guard let request = request ( ) else {
236237 throw NSError ( domain: configuration. errorDomain, code: - 876 , userInfo: nil )
237238 }
@@ -251,7 +252,7 @@ public extension Router {
251252 return try decoder. decode ( T . self, from: responseTuple. 0 )
252253 }
253254
254- func load< T: Codable > ( _ session: RequestKitURLSession = URLSession . shared, dateDecodingStrategy: JSONDecoder . DateDecodingStrategy ? , expectedResultType: T . Type ) async throws -> T {
255+ func load< T: Decodable > ( _ session: RequestKitURLSession = URLSession . shared, dateDecodingStrategy: JSONDecoder . DateDecodingStrategy ? , expectedResultType: T . Type ) async throws -> T {
255256 let decoder = JSONDecoder ( )
256257 if let dateDecodingStrategy = dateDecodingStrategy {
257258 decoder. dateDecodingStrategy = dateDecodingStrategy
0 commit comments