diff --git a/AlamoRecord.podspec b/AlamoRecord.podspec index 475d913..ba7f957 100644 --- a/AlamoRecord.podspec +++ b/AlamoRecord.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'AlamoRecord' - s.version = '1.4.0' + s.version = '2.0.0' s.summary = 'An elegant Alamofire wrapper inspired by ActiveRecord.' s.description = <<-DESC AlamoRecord is a powerful yet simple framework that eliminates the often complex networking layer that exists between your networking framework and your application. AlamoRecord uses the power of AlamoFire, AlamofireObjectMapper and the concepts behind the ActiveRecord pattern to create a networking layer that makes interacting with your API easier than ever. @@ -19,5 +19,6 @@ AlamoRecord is a powerful yet simple framework that eliminates the often complex s.watchos.deployment_target = '3.0' s.source_files = 'AlamoRecord/Classes/**/*' - s.dependency 'AlamofireObjectMapper', '5.1.0' + s.dependency 'Alamofire', '5.0.0-beta.6' + end diff --git a/AlamoRecord/Classes/AlamoRecordDecoder.swift b/AlamoRecord/Classes/AlamoRecordDecoder.swift new file mode 100644 index 0000000..1643906 --- /dev/null +++ b/AlamoRecord/Classes/AlamoRecordDecoder.swift @@ -0,0 +1,30 @@ +// +// AlamoRecordDecoder.swift +// AlamoRecord +// +// Created by Dalton Hinterscher on 6/6/19. +// + +import Alamofire + +class AlamoRecordDecoder: DataDecoder { + + private let keyPath: String? + + init(keyPath: String?) { + self.keyPath = keyPath + } + + func decode(_ type: D.Type, from data: Data) throws -> D where D : Decodable { + let decoder = JSONDecoder() + guard let keyPath = keyPath, + let json = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String: Any], + let keyPathJson = json[keyPath] else { + return try decoder.decode(D.self, from: data) + } + let keyPathJsonData = try JSONSerialization.data(withJSONObject: keyPathJson, options: .prettyPrinted) + return try decoder.decode(D.self, from: keyPathJsonData) + } + + +} diff --git a/AlamoRecord/Classes/AlamoRecordError.swift b/AlamoRecord/Classes/AlamoRecordError.swift index 696fc44..9ecee79 100644 --- a/AlamoRecord/Classes/AlamoRecordError.swift +++ b/AlamoRecord/Classes/AlamoRecordError.swift @@ -15,38 +15,33 @@ THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +import Foundation -import ObjectMapper - -open class AlamoRecordError: NSError, Mappable { - - override open var description: String { - guard let nsError = nsError else { - return "[AlamoRecordError] No description could be found for this error." - } - return "[AlamoRecordError] \(nsError.localizedDescription)" - } +open class AlamoRecordError: Error { /// The error of the failed request - public var nsError: NSError? + public let error: Error? - public required init() { - super.init(domain: "", code: -1, userInfo: [:]) + required public init(error: Error) { + self.error = error } - required public init(nsError: NSError) { - super.init(domain: nsError.domain, code: nsError.code, userInfo: nsError.userInfo) - self.nsError = nsError - } - - required public init?(map: Map) { - super.init(domain: "", code: -1, userInfo: [:]) - mapping(map: map) + public required init(from decoder: Decoder) throws { + error = nil } + +} + +extension AlamoRecordError: Codable { + open func encode(to encoder: Encoder) throws {} +} + +extension AlamoRecordError: CustomStringConvertible { - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) + open var description: String { + guard let error = error else { + return "❗️ [AlamoRecordError] No description could be found for this error." + } + return "❗️ [AlamoRecordError] \(error.localizedDescription)" } - - open func mapping(map: Map) {} } diff --git a/AlamoRecord/Classes/AlamoRecordObject.swift b/AlamoRecord/Classes/AlamoRecordObject.swift index ba1695f..d27a7f4 100644 --- a/AlamoRecord/Classes/AlamoRecordObject.swift +++ b/AlamoRecord/Classes/AlamoRecordObject.swift @@ -17,13 +17,11 @@ */ import Alamofire -import AlamofireObjectMapper -import ObjectMapper -open class AlamoRecordObject: NSObject, Mappable { +open class AlamoRecordObject: Codable { - /// Key to encode/decode the id variable - private let idKey: String = "id" + /// The id of this instance. This should be a String or an Int. + public let id: IDType /// The RequestManager that is tied to all instances of this class open class var requestManager: RequestManager { @@ -35,9 +33,6 @@ open class AlamoRecordObject: NS return type(of: self).requestManager } - /// The id of this instance. This should be a String or an Int. - open var id: IDType! - /// The root of all instances of this class. This is used when making URL's that relate to a component of this class. // Example: '/comment/id' --> '/\(Comment.root)/id' open class var root: String { @@ -95,37 +90,24 @@ open class AlamoRecordObject: NS open var pluralKeyPath: String? { return type(of: self).pluralKeyPath } - - public override init() { - super.init() - } - - public required init?(map: Map) { - super.init() - mapping(map: map) - } - - open func mapping(map: Map) { - id <- map["id"] - } /** Returns an array of all objects of this instance if the server supports it - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - open class func all(parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success: (([T]) -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { - return requestManager.findArray(T.urlForAll(), + open class func all(parameters: Parameters? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success: (([O]) -> Void)?, + failure: ((E) -> Void)?) -> DataRequest { + return requestManager.findArray(O.urlForAll(), parameters: parameters, - keyPath: T.pluralKeyPath, + keyPath: O.pluralKeyPath, encoding: encoding, headers: headers, success: success, @@ -135,17 +117,17 @@ open class AlamoRecordObject: NS /** Creates an object of this instance - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - open class func create(parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success: ((T) -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { + open class func create(parameters: Parameters? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success: ((O) -> Void)?, + failure: ((E) -> Void)?) -> DataRequest { return requestManager.createObject(parameters: parameters, keyPath: keyPath, @@ -158,14 +140,14 @@ open class AlamoRecordObject: NS /** Creates an object of this instance - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult open class func create(parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, success: (() -> Void)?, failure: ((E) -> Void)?) -> DataRequest { @@ -182,18 +164,18 @@ open class AlamoRecordObject: NS Finds an object of this instance based on the given id - parameter id: The id of the object to find - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - open class func find(id: IDType, - parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success: ((T) -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { + open class func find(id: IDType, + parameters: Parameters? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success: ((O) -> Void)?, + failure: ((E) -> Void)?) -> DataRequest { return requestManager.findObject(id: id, parameters: parameters, @@ -207,19 +189,19 @@ open class AlamoRecordObject: NS /** Updates the object - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - open func update(parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success: ((T) -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { + open func update(parameters: Parameters? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success: ((O) -> Void)?, + failure: ((E) -> Void)?) -> DataRequest { - return T.update(id: id, + return O.update(id: id, parameters: parameters, encoding: encoding, headers: headers, @@ -231,18 +213,18 @@ open class AlamoRecordObject: NS Updates an object of this instance based with the given id - parameter id: The id of the object to update - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - open class func update(id: IDType, - parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success: ((T) -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { + open class func update(id: IDType, + parameters: Parameters? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success: ((O) -> Void)?, + failure: ((E) -> Void)?) -> DataRequest { return requestManager.updateObject(id: id, parameters: parameters, @@ -257,7 +239,7 @@ open class AlamoRecordObject: NS Updates an object of this instance based with the given id - parameter id: The id of the object to update - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails @@ -265,7 +247,7 @@ open class AlamoRecordObject: NS @discardableResult open class func update(id: IDType, parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, success: (() -> Void)?, failure: ((E) -> Void)?) -> DataRequest { @@ -282,14 +264,14 @@ open class AlamoRecordObject: NS Updates an object of this instance based with the given id - parameter id: The id of the object to update - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult open func update(parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, success: (() -> Void)?, failure: ((E) -> Void)?) -> DataRequest { @@ -305,14 +287,14 @@ open class AlamoRecordObject: NS /** Destroys the object - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult open func destroy(parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, success: (() -> Void)?, failure: ((E) -> Void)?) -> DataRequest { @@ -329,18 +311,18 @@ open class AlamoRecordObject: NS Finds an object of this instance based on the given id - parameter id: The id of the object to destroy - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult open class func destroy(id: IDType, - parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success: (() -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { + parameters: Parameters? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success: (() -> Void)?, + failure: ((E) -> Void)?) -> DataRequest { return requestManager.destroyObject(url: urlForDestroy(id), parameters: parameters, diff --git a/AlamoRecord/Classes/Configuration.swift b/AlamoRecord/Classes/Configuration.swift index a0608de..2413628 100644 --- a/AlamoRecord/Classes/Configuration.swift +++ b/AlamoRecord/Classes/Configuration.swift @@ -21,14 +21,11 @@ import Alamofire open class Configuration: NSObject { /// See URLSessionConfiguration Documentation - public var urlSessionConfiguration: URLSessionConfiguration! - - /// See Alamofire.RequestRetrier Documentation - public var requestRetrier: RequestRetrier? - - /// See Alamofire.RequestAdapter Documentation - public var requestAdapter: RequestAdapter? + public let urlSessionConfiguration: URLSessionConfiguration + /// See Alamofire.RequestInterceptor Documentation + public var requestInterceptor: RequestInterceptor? + /// The status codes this configuration should ignore for failed requests public var ignoredErrorCodes: [Int] = [] @@ -39,13 +36,13 @@ open class Configuration: NSObject { public var requestObserver: RequestObserver? public override init() { - super.init() let bundleIdentifier = Bundle.main.bundleIdentifier ?? "AlamoRecord" let randomId = UUID.init().uuidString // Need a random id in case multiple request manager instances are created urlSessionConfiguration = URLSessionConfiguration.background(withIdentifier: "\(bundleIdentifier)-\(randomId).background") urlSessionConfiguration.timeoutIntervalForRequest = 30.0 urlSessionConfiguration.timeoutIntervalForResource = 30.0 + super.init() } public convenience init(builder: (Configuration) -> ()) { diff --git a/AlamoRecord/Classes/ErrorParser.swift b/AlamoRecord/Classes/ErrorParser.swift index 0942a0e..e62707a 100644 --- a/AlamoRecord/Classes/ErrorParser.swift +++ b/AlamoRecord/Classes/ErrorParser.swift @@ -16,30 +16,26 @@ */ -import ObjectMapper +import Foundation class ErrorParser: NSObject { /* Parses a failed request into an instance of an AlamoRecordError - - parameter data: The data of the failed request - - parameter error: The error of the failed request + - parameter data: The data of the request + - parameter error: The error of the request + - parameter statusCode: The status code of the request */ - open class func parse(_ data: Data?, error: NSError) -> E { + open class func parse(_ data: Data?, error: Error, statusCode: Int?) -> E { - guard let data = data else { - return E(nsError: error) - } + guard let data = data, + let statusCode = statusCode, + (200...299).contains(statusCode) == false else { return E(error: error) } do { - let json = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments) - if let json = json as? [String: Any] { - return Mapper().map(JSON: json)! - } else { - return E(nsError: error) - } + return try JSONDecoder().decode(E.self, from: data) } catch (_) { - return E(nsError: error) + return E(error: error) } } diff --git a/AlamoRecord/Classes/Logger.swift b/AlamoRecord/Classes/Logger.swift index c34620c..70dfd4d 100644 --- a/AlamoRecord/Classes/Logger.swift +++ b/AlamoRecord/Classes/Logger.swift @@ -30,14 +30,9 @@ class Logger: NSObject { Logs a request that just started to the console - parameter request: The request to log to the console */ - class func logRequest(request: DataRequest) { - guard let httpMethod = request.request?.httpMethod, let url = request.request?.url else { - print("[AlamoRecordLogger] The request appears to invalid. Please check your URL and try again.") - return - } - if loggingEnabled { - print("🔵 \(loggerPrefix) \(httpMethod) \(url.absoluteString)") - } + class func logRequest(_ method: HTTPMethod, url: String) { + guard loggingEnabled else { return } + print("🔵 \(loggerPrefix) \(method.rawValue.uppercased()) \(url)") } /* @@ -45,19 +40,19 @@ class Logger: NSObject { - parameter response: The response to log to the console */ class func logFinishedResponse(response: DataResponse) { - guard let responseObject = response.response else { - return - } - if loggingEnabled { - let method = response.request!.httpMethod! - let urlString = response.request!.url!.absoluteString - let statusCode = responseObject.statusCode - let statusCodeString = statusCodeStrings[statusCode] - let duration = String(response.timeline.totalDuration) - let trimmedDuration = String(duration[duration.startIndex..: NSObject { +open class RequestManager { public typealias Parameters = [String: Any] + public typealias ARObject = AlamoRecordObject /// If enabled, each request will be logged to the console public var loggingEnabled: Bool = true { @@ -32,17 +31,16 @@ open class RequestManager: NSObj } /// The configuration object of the RequestManager - public var configuration: Configuration! + public let configuration: Configuration /// Responsible for creating and managing `Request` objects, as well as their underlying `NSURLSession`. - public var sessionManager: Alamofire.SessionManager! + public let session: Session public init(configuration: Configuration) { self.configuration = configuration - sessionManager = Alamofire.SessionManager(configuration: configuration.urlSessionConfiguration) - sessionManager.startRequestsImmediately = true - sessionManager.retrier = configuration.requestRetrier - sessionManager.adapter = configuration.requestAdapter + session = Session(configuration: configuration.urlSessionConfiguration, + startRequestsImmediately: true, + interceptor: configuration.requestInterceptor) } /** @@ -50,22 +48,22 @@ open class RequestManager: NSObj - parameter method: The HTTP method - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default */ @discardableResult open func makeRequest(_ method: Alamofire.HTTPMethod, - url: U, - parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil) -> DataRequest { + url: Url, + parameters: Parameters? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil) -> DataRequest { - let request = sessionManager.request(url.absolute, - method: method, - parameters: parameters, - encoding: encoding, - headers: headers).validate() - Logger.logRequest(request: request) + let request = session.request(url.absolute, + method: method, + parameters: parameters, + encoding: encoding, + headers: headers).validate() + Logger.logRequest(method, url: url.absolute) return request } @@ -74,7 +72,7 @@ open class RequestManager: NSObj - parameter method: The HTTP method - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default - parameter headers: The HTTP headers. `nil` by default - parameter emptyBody: Wether or not the response will have an empty body. `false` by default - parameter success: The block to execute if the request succeeds @@ -82,13 +80,13 @@ open class RequestManager: NSObj */ @discardableResult open func makeRequest(_ method: Alamofire.HTTPMethod, - url: U, + url: Url, parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, emptyBody: Bool = false, success: (() -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { + failure: ((ARError) -> Void)?) -> DataRequest { return makeRequest(method, url: url, @@ -109,7 +107,7 @@ open class RequestManager: NSObj return } - if response.response!.statusCode >= 200 && response.response!.statusCode <= 299 { + if (200...299).contains(response.response?.statusCode ?? 0) { self.onSuccess(success: success, response: response) } else { self.onFailure(error: response.error!, response: response, failure: failure) @@ -124,32 +122,32 @@ open class RequestManager: NSObj - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func mapObject(_ method: Alamofire.HTTPMethod, - url: U, - parameters: Parameters? = nil, - keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success: ((T) -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { + public func mapObject(_ method: Alamofire.HTTPMethod, + url: Url, + parameters: Parameters? = nil, + keyPath: String? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success: ((C) -> Void)?, + failure: ((ARError) -> Void)?) -> DataRequest { return makeRequest(method, url: url, parameters: parameters, encoding: encoding, headers: headers) - .responseObject(keyPath: keyPath, completionHandler: { (response: DataResponse) in - + .responseDecodable(decoder: AlamoRecordDecoder(keyPath: keyPath), + completionHandler: { (response: DataResponse) in Logger.logFinishedResponse(response: response) switch response.result { - case .success: - self.onSuccess(success: success, response: response) + case .success(let value): + self.onSuccess(success: success, response: response, value: value) case .failure(let error): self.onFailure(error: error, response: response, failure: failure) } @@ -162,32 +160,32 @@ open class RequestManager: NSObj - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func mapObjects(_ method: Alamofire.HTTPMethod, - url: U, - parameters: Parameters? = nil, - keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success: (([T]) -> Void)?, - failure: ((E) -> Void)?) -> DataRequest { + public func mapObjects(_ method: Alamofire.HTTPMethod, + url: Url, + parameters: Parameters? = nil, + keyPath: String? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success: (([C]) -> Void)?, + failure: ((ARError) -> Void)?) -> DataRequest { return makeRequest(method, url: url, parameters: parameters, encoding: encoding, headers: headers) - .responseArray(keyPath: keyPath, completionHandler: { (response: DataResponse<[T]>) in - + .responseDecodable(decoder: AlamoRecordDecoder(keyPath: keyPath), + completionHandler: { (response: DataResponse<[C]>) in Logger.logFinishedResponse(response: response) switch response.result { - case .success: - self.onSuccess(success: success, response: response) + case .success(let value): + self.onSuccess(success: success, response: response, value: value) case .failure(let error): self.onFailure(error: error, response: response, failure: failure) } @@ -199,21 +197,21 @@ open class RequestManager: NSObj - parameter id: The id of the object to find - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func findObject>(id: IDType, - parameters: Parameters? = nil, - keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success:((T) -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + public func findObject(id: IDType, + parameters: Parameters? = nil, + keyPath: String? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success:((O) -> Void)?, + failure:((ARError) -> Void)?) -> DataRequest { - return findObject(url: T.urlForFind(id), + return findObject(url: O.urlForFind(id), parameters: parameters, keyPath: keyPath, encoding: encoding, @@ -227,19 +225,19 @@ open class RequestManager: NSObj - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func findObject>(url: U, + public func findObject(url: Url, parameters: Parameters? = nil, keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, - success:((T) -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + success:((O) -> Void)?, + failure:((ARError) -> Void)?) -> DataRequest { return mapObject(.get, url: url, @@ -256,19 +254,19 @@ open class RequestManager: NSObj - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func findArray(_ url: U, - parameters: Parameters? = nil, - keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success:(([T]) -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + public func findArray(_ url: Url, + parameters: Parameters? = nil, + keyPath: String? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success:(([C]) -> Void)?, + failure:((ARError) -> Void)?) -> DataRequest { return mapObjects(.get, url: url, @@ -284,26 +282,26 @@ open class RequestManager: NSObj Makes a request and creates an AlamoRecordObjects - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func createObject>(parameters: Parameters? = nil, - keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success:((T) -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + public func createObject(parameters: Parameters? = nil, + keyPath: String? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success:((O) -> Void)?, + failure:((ARError) -> Void)?) -> DataRequest { - return createObject(url: T.urlForCreate(), - parameters: parameters, - keyPath: keyPath, - encoding: encoding, - headers: headers, - success: success, - failure: failure) + return createObject(url: O.urlForCreate(), + parameters: parameters, + keyPath: keyPath, + encoding: encoding, + headers: headers, + success: success, + failure: failure) } /** @@ -311,19 +309,19 @@ open class RequestManager: NSObj - paramter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func createObject>(url: U, - parameters: Parameters? = nil, - keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success:((T) -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + public func createObject(url: Url, + parameters: Parameters? = nil, + keyPath: String? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success:((O) -> Void)?, + failure:((ARError) -> Void)?) -> DataRequest { return mapObject(.post, url: url, @@ -338,18 +336,18 @@ open class RequestManager: NSObj /** Makes a request and creates the object - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func createObject(url: U, + public func createObject(url: Url, parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, success:(() -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + failure:((ARError) -> Void)?) -> DataRequest { return makeRequest(.post, url: url, @@ -365,21 +363,21 @@ open class RequestManager: NSObj - parameter id: The id of the object to update - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func updateObject>(id: IDType, - parameters: Parameters? = nil, - keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success:((T) -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + public func updateObject(id: IDType, + parameters: Parameters? = nil, + keyPath: String? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success:((O) -> Void)?, + failure:((ARError) -> Void)?) -> DataRequest { - return updateObject(url: T.urlForUpdate(id), + return updateObject(url: O.urlForUpdate(id), parameters: parameters, keyPath: keyPath, encoding: encoding, @@ -393,19 +391,19 @@ open class RequestManager: NSObj - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func updateObject>(url: U, - parameters: Parameters? = nil, - keyPath: String? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - success:((T) -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + public func updateObject(url: Url, + parameters: Parameters? = nil, + keyPath: String? = nil, + encoding: ParameterEncoding = JSONEncoding.default, + headers: HTTPHeaders? = nil, + success:((O) -> Void)?, + failure:((ARError) -> Void)?) -> DataRequest { return mapObject(.put, url: url, @@ -422,18 +420,18 @@ open class RequestManager: NSObj - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - parameter keyPath: The keyPath to use when deserializing the JSON. `nil` by default. - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func updateObject(url: U, + public func updateObject(url: Url, parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, success:(() -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + failure:((ARError) -> Void)?) -> DataRequest { return makeRequest(.put, url: url, @@ -448,18 +446,18 @@ open class RequestManager: NSObj Makes a request and destroys an AlamoRecordObject - parameter url: The URL that conforms to AlamoRecordURL - parameter parameters: The parameters. `nil` by default - - parameter encoding: The parameter encoding. `URLEncoding.default` by default. + - parameter encoding: The parameter encoding. `JSONEncoding.default` by default. - parameter headers: The HTTP headers. `nil` by default. - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ @discardableResult - public func destroyObject(url: U, + public func destroyObject(url: Url, parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, + encoding: ParameterEncoding = JSONEncoding.default, headers: HTTPHeaders? = nil, success:(() -> Void)?, - failure:((E) -> Void)?) -> DataRequest { + failure:((ARError) -> Void)?) -> DataRequest { return makeRequest(.delete, url: url, @@ -481,32 +479,27 @@ open class RequestManager: NSObj - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ - public func upload(url: U, - keyPath: String? = nil, - headers: HTTPHeaders? = nil, - multipartFormData: @escaping ((MultipartFormData) -> Void), - progressHandler: Request.ProgressHandler? = nil, - success: ((T) -> Void)?, - failure: ((E) -> Void)?) { - - sessionManager.upload(multipartFormData: multipartFormData, to: url.absolute, headers: headers) { (result) in - switch result { - case .success(let request, _, _): - if let progressHandler = progressHandler { - request.uploadProgress(closure: progressHandler) - } - request.responseObject(keyPath: keyPath, completionHandler: { (response: DataResponse) in - switch response.result { - case .success: - success?(response.result.value!) - case .failure(let error): - self.onFailure(error: error, response: response, failure: failure) - } - }) - case .failure(let error): - failure?(E(nsError: error as NSError)) + public func upload(url: Url, + keyPath: String? = nil, + headers: HTTPHeaders? = nil, + multipartFormData: @escaping ((MultipartFormData) -> Void), + progressHandler: Request.ProgressHandler? = nil, + success: ((C) -> Void)?, + failure: ((ARError) -> Void)?) { + + session.upload(multipartFormData: multipartFormData, to: url.absolute, headers: headers) + .uploadProgress { progress in + progressHandler?(progress) } - } + .responseDecodable(decoder: AlamoRecordDecoder(keyPath: keyPath), + completionHandler: { (response: DataResponse) in + switch response.result { + case .success(let value): + success?(value) + case .failure(let error): + failure?(ARError(error: error)) + } + }) } /** @@ -517,13 +510,14 @@ open class RequestManager: NSObj - parameter success: The block to execute if the request succeeds - parameter failure: The block to execute if the request fails */ - public func download(url: U, - destination: DownloadRequest.DownloadFileDestination? = nil, + public func download(url: Url, + destination: DownloadRequest.Destination? = nil, progress: Request.ProgressHandler? = nil, success: @escaping ((URL?) -> Void), - failure: @escaping ((E) -> Void)) { + failure: @escaping ((ARError) -> Void)) { + + let finalDestination: DownloadRequest.Destination - var finalDestination: DownloadRequest.DownloadFileDestination! if let destination = destination { finalDestination = destination } else { @@ -534,9 +528,9 @@ open class RequestManager: NSObj } } - sessionManager.download(url.absolute, to: finalDestination).downloadProgress(closure: { (prog) in + session.download(url.absolute, to: finalDestination).downloadProgress(closure: { (prog) in progress?(prog) - }).response { (response) in + }).response { response in if let error = response.error { self.onFailure(error: error, response: response, failure: failure) } else { @@ -556,23 +550,23 @@ open class RequestManager: NSObj } /** - Performs any logic associated with a successful DataResponse + Performs any logic associated with a successful DataResponse - parameter success: The block to execute if the request succeeds - parameter response: The response of the request */ - private func onSuccess(success: ((T) -> Void)?, response: DataResponse) { + private func onSuccess(success: ((C) -> Void)?, response: DataResponse, value: C) { sendEventsToObservers(response: response.response) - success?(response.result.value!) + success?(value) } /** - Performs any logic associated with a successful DataResponse<[T]> + Performs any logic associated with a successful DataResponse<[C]> - parameter success: The block to execute if the request succeeds - parameter response: The response of the request */ - private func onSuccess(success: (([T]) -> Void)?, response: DataResponse<[T]>) { + private func onSuccess(success: (([C]) -> Void)?, response: DataResponse<[C]>, value: [C]) { sendEventsToObservers(response: response.response) - success?(response.result.value!) + success?(value) } /** @@ -581,9 +575,9 @@ open class RequestManager: NSObj - parameter response: The response of the request */ private func onSuccess(success: ((URL?) -> Void)?, - response: DefaultDownloadResponse) { + response: DownloadResponse) { sendEventsToObservers(response: response.response) - success?(response.destinationURL) + success?(response.fileURL) } /** @@ -610,7 +604,7 @@ open class RequestManager: NSObj */ private func onFailure(error: Error, response: DataResponse, - failure:((E) -> Void)?) { + failure:((ARError) -> Void)?) { onFailure(error: error, responseData: response.data, statusCode: response.response?.statusCode, @@ -618,14 +612,14 @@ open class RequestManager: NSObj } /** - Performs any logic associated with a failed DataResponse + Performs any logic associated with a failed DataResponse - parameter error: The error the request returned - parameter response: The response of the request - parameter failure: The block to execute if the request fails */ - private func onFailure(error: Error, - response: DataResponse, - failure:((E) -> Void)?) { + private func onFailure(error: Error, + response: DataResponse, + failure:((ARError) -> Void)?) { onFailure(error: error, responseData: response.data, statusCode: response.response?.statusCode, @@ -633,14 +627,14 @@ open class RequestManager: NSObj } /** - Performs any logic associated with a failed DataResponse<[T]> + Performs any logic associated with a failed DataResponse<[C]> - parameter error: The error the request returned - parameter response: The response of the request - parameter failure: The block to execute if the request fails */ - private func onFailure(error: Error, - response: DataResponse<[T]>, - failure:((E) -> Void)?) { + private func onFailure(error: Error, + response: DataResponse<[C]>, + failure:((ARError) -> Void)?) { onFailure(error: error, responseData: response.data, statusCode: response.response?.statusCode, @@ -654,8 +648,8 @@ open class RequestManager: NSObj - parameter failure: The block to execute if the request fails */ private func onFailure(error: Error, - response: DefaultDownloadResponse, - failure:((E) -> Void)?) { + response: DownloadResponse, + failure:((ARError) -> Void)?) { onFailure(error: error, responseData: nil, statusCode: response.response?.statusCode, @@ -672,19 +666,19 @@ open class RequestManager: NSObj private func onFailure(error: Error, responseData: Data?, statusCode: Int?, - failure: ((E) -> Void)?) { + failure: ((ARError) -> Void)?) { let nsError = error as NSError if configuration.ignoredErrorCodes.contains(nsError.code) { return } - let error: E = ErrorParser.parse(responseData, error: nsError) + let error: ARError = ErrorParser.parse(responseData, error: nsError, statusCode: statusCode) if let statusCode = statusCode { configuration.statusCodeObserver?.onStatusCode(statusCode: statusCode, error: error) } - + failure?(error) } diff --git a/Example/AlamoRecord.xcodeproj/project.pbxproj b/Example/AlamoRecord.xcodeproj/project.pbxproj index f2b3c57..ae3ba4c 100644 --- a/Example/AlamoRecord.xcodeproj/project.pbxproj +++ b/Example/AlamoRecord.xcodeproj/project.pbxproj @@ -7,6 +7,8 @@ objects = { /* Begin PBXBuildFile section */ + 5C25BD0822A9F08E0074320C /* AlamoRecordDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C25BD0722A9F08E0074320C /* AlamoRecordDecoder.swift */; }; + 5C25BD0922A9F6820074320C /* AlamoRecordDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C25BD0722A9F08E0074320C /* AlamoRecordDecoder.swift */; }; 5C4141901F1181C200A18674 /* CommentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C41418F1F1181C200A18674 /* CommentCell.swift */; }; 5C4141941F12CE6B00A18674 /* CreatePostModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C4141931F12CE6B00A18674 /* CreatePostModel.swift */; }; 5C4141961F12CE7800A18674 /* CreatePostView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C4141951F12CE7800A18674 /* CreatePostView.swift */; }; @@ -71,6 +73,7 @@ 34615B12F449D260169502E2 /* Pods-AlamoRecord_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AlamoRecord_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.debug.xcconfig"; sourceTree = ""; }; 35147C54E24FC9C20F682301 /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 5B7C3F03A1046596BEE7867D /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; + 5C25BD0722A9F08E0074320C /* AlamoRecordDecoder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AlamoRecordDecoder.swift; path = ../../AlamoRecord/Classes/AlamoRecordDecoder.swift; sourceTree = ""; }; 5C41418F1F1181C200A18674 /* CommentCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommentCell.swift; sourceTree = ""; }; 5C4141931F12CE6B00A18674 /* CreatePostModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreatePostModel.swift; sourceTree = ""; }; 5C4141951F12CE7800A18674 /* CreatePostView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreatePostView.swift; sourceTree = ""; }; @@ -205,6 +208,7 @@ 5C94C2F21F08706400762CFC /* Source */ = { isa = PBXGroup; children = ( + 5C25BD0722A9F08E0074320C /* AlamoRecordDecoder.swift */, 5C86407E1F09D5E6001E8320 /* AlamoRecordError.swift */, 5C94C2F31F08707F00762CFC /* AlamoRecordObject.swift */, 5CA0A94E21825DA3002BA69A /* AlamoRecordURL.swift */, @@ -398,22 +402,18 @@ "${PODS_ROOT}/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-frameworks.sh", "${BUILT_PRODUCTS_DIR}/AlamoRecord/AlamoRecord.framework", "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", - "${BUILT_PRODUCTS_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework", "${BUILT_PRODUCTS_DIR}/KeyboardSpy/KeyboardSpy.framework", "${BUILT_PRODUCTS_DIR}/MarqueeLabel/MarqueeLabel.framework", "${BUILT_PRODUCTS_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework", - "${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework", "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AlamoRecord.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AlamofireObjectMapper.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KeyboardSpy.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MarqueeLabel.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NotificationBannerSwift.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjectMapper.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", ); runOnlyForDeploymentPostprocessing = 0; @@ -466,15 +466,11 @@ "${PODS_ROOT}/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh", "${BUILT_PRODUCTS_DIR}/AlamoRecord/AlamoRecord.framework", "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", - "${BUILT_PRODUCTS_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework", - "${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AlamoRecord.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/AlamofireObjectMapper.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjectMapper.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -490,6 +486,7 @@ files = ( 5C63470B1F0B088200158A80 /* ApplicationError.swift in Sources */, 5CCB209A1F1706880027BA56 /* Logger.swift in Sources */, + 5C25BD0922A9F6820074320C /* AlamoRecordDecoder.swift in Sources */, 5CCB20951F17064E0027BA56 /* Comment.swift in Sources */, 5CCB209C1F1706880027BA56 /* RequestObserver.swift in Sources */, 5CCB209B1F1706880027BA56 /* RequestManager.swift in Sources */, @@ -530,6 +527,7 @@ 5C94C3001F08707F00762CFC /* ErrorParser.swift in Sources */, 5C96D9911F0ECC4E005FF25E /* PostsViewController.swift in Sources */, 5C96D9971F0EDB71005FF25E /* ColorsExtension.swift in Sources */, + 5C25BD0822A9F08E0074320C /* AlamoRecordDecoder.swift in Sources */, 5C94C3081F08707F00762CFC /* RequestObserver.swift in Sources */, 5CE6C8161F102C5200965235 /* Comment.swift in Sources */, 5C4141981F12CE8300A18674 /* CreatePostViewController.swift in Sources */, diff --git a/Example/AlamoRecord/AppDelegate.swift b/Example/AlamoRecord/AppDelegate.swift index 665d6e8..d321da0 100644 --- a/Example/AlamoRecord/AppDelegate.swift +++ b/Example/AlamoRecord/AppDelegate.swift @@ -13,7 +13,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. diff --git a/Example/AlamoRecord/Comment.swift b/Example/AlamoRecord/Comment.swift index db70d68..48a1b5a 100644 --- a/Example/AlamoRecord/Comment.swift +++ b/Example/AlamoRecord/Comment.swift @@ -6,11 +6,20 @@ // Copyright © 2017 CocoaPods. All rights reserved. // -import ObjectMapper -import UIKit - class Comment: AlamoRecordObject { - + + let name: String + let email: String + let body: String + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + name = try container.decode(String.self, forKey: .name) + email = try container.decode(String.self, forKey: .email) + body = try container.decode(String.self, forKey: .body) + try super.init(from: decoder) + } + class override var requestManager: ApplicationRequestManager { return ApplicationRequestManager.default } @@ -19,20 +28,9 @@ class Comment: AlamoRecordObject { return "comment" } - private(set) var postId: Int! - private(set) var name: String! - private(set) var email: String! - private(set) var body: String! - - required init?(map: Map) { - super.init(map: map) - } - - override func mapping(map: Map) { - super.mapping(map: map) - postId <- map["postId"] - name <- map["name"] - email <- map["email"] - body <- map["body"] + private enum CodingKeys: String, CodingKey { + case name + case email + case body } } diff --git a/Example/Podfile.lock b/Example/Podfile.lock index ce0f09a..9b3fe89 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,16 +1,12 @@ PODS: - - Alamofire (4.8.2) - - AlamofireObjectMapper (5.1.0): - - Alamofire (~> 4.1) - - ObjectMapper (~> 3.3) - - AlamoRecord (1.4.0): - - AlamofireObjectMapper (= 5.1.0) + - Alamofire (5.0.0-beta.6) + - AlamoRecord (2.0.0): + - Alamofire (= 5.0.0-beta.6) - KeyboardSpy (1.1) - MarqueeLabel (4.0.0) - NotificationBannerSwift (2.2.0): - MarqueeLabel (~> 4.0.0) - SnapKit (~> 5.0.0) - - ObjectMapper (3.4.2) - SnapKit (5.0.0) DEPENDENCIES: @@ -22,11 +18,9 @@ DEPENDENCIES: SPEC REPOS: https://github.com/cocoapods/specs.git: - Alamofire - - AlamofireObjectMapper - KeyboardSpy - MarqueeLabel - NotificationBannerSwift - - ObjectMapper - SnapKit EXTERNAL SOURCES: @@ -34,13 +28,11 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3 - AlamofireObjectMapper: 3395e698901d8b0e6f48b7d0c43bd47875325102 - AlamoRecord: f7ff85c04c4637a1d3ceb916bb079e1e2311f232 + Alamofire: cd08a4402bd12cacd0c66f23fb12fec8d6b965e4 + AlamoRecord: 92fb2db13838474750f90605d8a37c932d530db1 KeyboardSpy: 4552ddd413d3b856b3b396422fccb8e1b3008524 MarqueeLabel: b55b26e690b6ad41faedd95cbf5eae6f1d1735b4 NotificationBannerSwift: 0ebb4b35e18c0515fdfe01b5ebd90c3eb1255e3d - ObjectMapper: 0d4402610f4e468903ae64629eec4784531e5c51 SnapKit: fd22d10eb9aff484d79a8724eab922c1ddf89bcf PODFILE CHECKSUM: f5d73d86856e49073d0206d4e3f83582b8a8a64b diff --git a/Example/Pods/Alamofire/LICENSE b/Example/Pods/Alamofire/LICENSE index 38a301a..2ec3cb1 100644 --- a/Example/Pods/Alamofire/LICENSE +++ b/Example/Pods/Alamofire/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Example/Pods/Alamofire/README.md b/Example/Pods/Alamofire/README.md index 26e364a..48f9a52 100644 --- a/Example/Pods/Alamofire/README.md +++ b/Example/Pods/Alamofire/README.md @@ -6,9 +6,12 @@ [![Platform](https://img.shields.io/cocoapods/p/Alamofire.svg?style=flat)](https://alamofire.github.io/Alamofire) [![Twitter](https://img.shields.io/badge/twitter-@AlamofireSF-blue.svg?style=flat)](https://twitter.com/AlamofireSF) [![Gitter](https://badges.gitter.im/Alamofire/Alamofire.svg)](https://gitter.im/Alamofire/Alamofire?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) +[![Open Source Helpers](https://www.codetriage.com/alamofire/alamofire/badges/users.svg)](https://www.codetriage.com/alamofire/alamofire) Alamofire is an HTTP networking library written in Swift. +**⚠️⚠️⚠️ WARNING ⚠️⚠️⚠️** This documentation is out of date during the Alamofire 5 beta process. + - [Features](#features) - [Component Libraries](#component-libraries) - [Requirements](#requirements) @@ -56,93 +59,56 @@ In order to keep Alamofire focused specifically on core networking implementatio ## Requirements -- iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ -- Xcode 8.3+ -- Swift 3.1+ +- iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ +- Xcode 10.2+ +- Swift 5+ + ## Migration Guides +- Alamofire 5.0 Migration Guide: To be written! - [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md) - [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md) - [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md) ## Communication -- If you **need help with making network requests**, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire) and tag `alamofire`. +- If you **need help with making network requests** using Alamofire, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire) and tag `alamofire`. - If you need to **find or understand an API**, check [our documentation](http://alamofire.github.io/Alamofire/) or [Apple's documentation for `URLSession`](https://developer.apple.com/documentation/foundation/url_loading_system), on top of which Alamofire is built. - If you need **help with an Alamofire feature**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire). - If you'd like to **discuss Alamofire best practices**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire). - If you'd like to **discuss a feature request**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire). -- If you **found a bug**, open an issue and follow the guide. The more detail the better! +- If you **found a bug**, open an issue here on GitHub and follow the guide. The more detail the better! - If you **want to contribute**, submit a pull request. ## Installation ### CocoaPods -[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: - -```bash -$ gem install cocoapods -``` - -> CocoaPods 1.1+ is required to build Alamofire 4.0+. - -To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`: +[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`: ```ruby -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '10.0' -use_frameworks! - -target '' do - pod 'Alamofire', '~> 4.7' -end -``` - -Then, run the following command: - -```bash -$ pod install +pod 'Alamofire', '~> 5.0.0-beta.5' ``` ### Carthage -[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. - -You can install Carthage with [Homebrew](https://brew.sh/) using the following command: - -```bash -$ brew update -$ brew install carthage -``` - -To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`: +[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`: ```ogdl -github "Alamofire/Alamofire" ~> 4.7 +github "Alamofire/Alamofire" "5.0.0-beta.5" ``` -Run `carthage update` to build the framework and drag the built `Alamofire.framework` into your Xcode project. - ### Swift Package Manager -The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but Alamofire does support its use on supported platforms. +The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but Alamofire does support its use on supported platforms. Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`. -#### Swift 3 - -```swift -dependencies: [ - .Package(url: "https://github.com/Alamofire/Alamofire.git", majorVersion: 4) -] -``` - #### Swift 4 ```swift dependencies: [ - .package(url: "https://github.com/Alamofire/Alamofire.git", from: "4.0.0") + .package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.0.0-beta.5") ] ``` @@ -176,7 +142,7 @@ If you prefer not to use any of the aforementioned dependency managers, you can > It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`. -- Select the top `Alamofire.framework` for iOS and the bottom one for OS X. +- Select the top `Alamofire.framework` for iOS and the bottom one for macOS. > You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as either `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS` or `Alamofire watchOS`. @@ -191,26 +157,21 @@ The following radars have some effect on the current implementation of Alamofire - [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776) - Compiler throwing warning due to toll-free bridging issue in test case - `rdar://26870455` - Background URL Session Configurations do not work in the simulator - `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest` -- [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424) - `URLSessionTaskMetrics` failing to link on watchOS 3.0+ ## Resolved Radars The following radars have been resolved over time after being filed against the Alamofire project. -- [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage (Resolved on 9/1/17 in Xcode 9 beta 6). - +- [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage. + - (Resolved): 9/1/17 in Xcode 9 beta 6. +- [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424) - `URLSessionTaskMetrics` failing to link on watchOS 3.0+ + - (Resolved): Just add `CFNetwork` to your linked frameworks. ## FAQ ### What's the origin of the name Alamofire? Alamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html), a hybrid variant of the Bluebonnet, the official state flower of Texas. -### What logic belongs in a Router vs. a Request Adapter? - -Simple, static data such as paths, parameters and common headers belong in the `Router`. Dynamic data such as an `Authorization` header whose value can changed based on an authentication system belongs in a `RequestAdapter`. - -The reason the dynamic data MUST be placed into the `RequestAdapter` is to support retry operations. When a `Request` is retried, the original request is not rebuilt meaning the `Router` will not be called again. The `RequestAdapter` is called again allowing the dynamic data to be updated on the original request before retrying the `Request`. - ## Credits Alamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org). You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF) for project updates and releases. diff --git a/Example/Pods/Alamofire/Source/AFError.swift b/Example/Pods/Alamofire/Source/AFError.swift index b163f60..5440791 100644 --- a/Example/Pods/Alamofire/Source/AFError.swift +++ b/Example/Pods/Alamofire/Source/AFError.swift @@ -1,7 +1,7 @@ // // AFError.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -27,23 +27,40 @@ import Foundation /// `AFError` is the error type returned by Alamofire. It encompasses a few different types of errors, each with /// their own associated reasons. /// +/// - explicitlyCancelled: Returned when a `Request` is explicitly cancelled. /// - invalidURL: Returned when a `URLConvertible` type fails to create a valid `URL`. /// - parameterEncodingFailed: Returned when a parameter encoding object throws an error during the encoding process. +/// - parameterEncoderFailed: Returned when a parameter encoder throws an error during the encoding process. /// - multipartEncodingFailed: Returned when some step in the multipart encoding process fails. +/// - requestAdaptationFailed: Returned when a `RequestAdapter` throws an error during request adaptation. /// - responseValidationFailed: Returned when a `validate()` call fails. -/// - responseSerializationFailed: Returned when a response serializer encounters an error in the serialization process. +/// - responseSerializationFailed: Returned when a response serializer throws an error in the serialization process. +/// - serverTrustEvaluationFailed: Returned when a `ServerTrustEvaluating` instance fails during the server trust evaluation process. +/// - requestRetryFailed: Returned when a `RequestRetrier` throws an error during the request retry process. public enum AFError: Error { /// The underlying reason the parameter encoding error occurred. /// /// - missingURL: The URL request did not have a URL to encode. /// - jsonEncodingFailed: JSON serialization failed with an underlying system error during the /// encoding process. - /// - propertyListEncodingFailed: Property list serialization failed with an underlying system error during - /// encoding process. public enum ParameterEncodingFailureReason { case missingURL case jsonEncodingFailed(error: Error) - case propertyListEncodingFailed(error: Error) + } + + /// Underlying reason the parameter encoder error occured. + public enum ParameterEncoderFailureReason { + /// Possible missing components. + public enum RequiredComponent { + /// The `URL` was missing or unable to be extracted from the passed `URLRequest` or during encoding. + case url + /// The `HTTPMethod` could not be extracted from the passed `URLRequest`. + case httpMethod(rawValue: String) + } + /// A `RequiredComponent` was missing during encoding. + case missingRequiredComponent(RequiredComponent) + /// The underlying encoder failed with the associated error. + case encoderFailed(error: Error) } /// The underlying reason the multipart encoding error occurred. @@ -107,77 +124,171 @@ public enum AFError: Error { } /// The underlying reason the response serialization error occurred. - /// - /// - inputDataNil: The server response contained no data. - /// - inputDataNilOrZeroLength: The server response contained no data or the data was zero length. - /// - inputFileNil: The file containing the server response did not exist. - /// - inputFileReadFailed: The file containing the server response could not be read. - /// - stringSerializationFailed: String serialization failed using the provided `String.Encoding`. - /// - jsonSerializationFailed: JSON serialization failed with an underlying system error. - /// - propertyListSerializationFailed: Property list serialization failed with an underlying system error. public enum ResponseSerializationFailureReason { - case inputDataNil + /// The server response contained no data or the data was zero length. case inputDataNilOrZeroLength + /// The file containing the server response did not exist. case inputFileNil + /// The file containing the server response could not be read from the associated `URL`. case inputFileReadFailed(at: URL) + /// String serialization failed using the provided `String.Encoding`. case stringSerializationFailed(encoding: String.Encoding) + /// JSON serialization failed with an underlying system error. case jsonSerializationFailed(error: Error) - case propertyListSerializationFailed(error: Error) + /// A `DataDecoder` failed to decode the response due to the associated `Error`. + case decodingFailed(error: Error) + /// Generic serialization failed for an empty response that wasn't type `Empty` but instead the associated type. + case invalidEmptyResponse(type: String) + /// A response serializer was added to the request after the request was already finished. + case responseSerializerAddedAfterRequestFinished + } + + /// Underlying reason a server trust evaluation error occured. + public enum ServerTrustFailureReason { + /// The output of a server trust evaluation. + public struct Output { + /// The host for which the evaluation was performed. + public let host: String + /// The `SecTrust` value which was evaluated. + public let trust: SecTrust + /// The `OSStatus` of evaluation operation. + public let status: OSStatus + /// The result of the evaluation operation. + public let result: SecTrustResultType + + /// Creates an `Output` value from the provided values. + init(_ host: String, _ trust: SecTrust, _ status: OSStatus, _ result: SecTrustResultType) { + self.host = host + self.trust = trust + self.status = status + self.result = result + } + } + case noRequiredEvaluator(host: String) + /// No certificates were found with which to perform the trust evaluation. + case noCertificatesFound + /// No public keys were found with which to perform the trust evaluation. + case noPublicKeysFound + /// During evaluation, application of the associated `SecPolicy` failed. + case policyApplicationFailed(trust: SecTrust, policy: SecPolicy, status: OSStatus) + /// During evaluation, setting the associated anchor certificates failed. + case settingAnchorCertificatesFailed(status: OSStatus, certificates: [SecCertificate]) + /// During evaluation, creation of the revocation policy failed. + case revocationPolicyCreationFailed + /// Default evaluation failed with the associated `Output`. + case defaultEvaluationFailed(output: Output) + /// Host validation failed with the associated `Output`. + case hostValidationFailed(output: Output) + /// Revocation check failed with the associated `Output` and options. + case revocationCheckFailed(output: Output, options: RevocationTrustEvaluator.Options) + /// Certificate pinning failed. + case certificatePinningFailed(host: String, trust: SecTrust, pinnedCertificates: [SecCertificate], serverCertificates: [SecCertificate]) + /// Public key pinning failed. + case publicKeyPinningFailed(host: String, trust: SecTrust, pinnedKeys: [SecKey], serverKeys: [SecKey]) } + case sessionDeinitialized + case sessionInvalidated(error: Error?) + case explicitlyCancelled case invalidURL(url: URLConvertible) case parameterEncodingFailed(reason: ParameterEncodingFailureReason) + case parameterEncoderFailed(reason: ParameterEncoderFailureReason) case multipartEncodingFailed(reason: MultipartEncodingFailureReason) + case requestAdaptationFailed(error: Error) case responseValidationFailed(reason: ResponseValidationFailureReason) case responseSerializationFailed(reason: ResponseSerializationFailureReason) -} - -// MARK: - Adapt Error - -struct AdaptError: Error { - let error: Error + case serverTrustEvaluationFailed(reason: ServerTrustFailureReason) + case requestRetryFailed(retryError: Error, originalError: Error) } extension Error { - var underlyingAdaptError: Error? { return (self as? AdaptError)?.error } + /// Returns the instance cast as an `AFError`. + public var asAFError: AFError? { + return self as? AFError + } } // MARK: - Error Booleans extension AFError { - /// Returns whether the AFError is an invalid URL error. + // Returns whether the instance is `.sessionDeinitialized`. + public var isSessionDeinitializedError: Bool { + if case .sessionDeinitialized = self { return true } + return false + } + + // Returns whether the instance is `.sessionInvalidated`. + public var isSessionInvalidatedError: Bool { + if case .sessionInvalidated = self { return true } + return false + } + + /// Returns whether the instance is `.explicitlyCancelled`. + public var isExplicitlyCancelledError: Bool { + if case .explicitlyCancelled = self { return true } + return false + } + + /// Returns whether the instance is `.invalidURL`. public var isInvalidURLError: Bool { if case .invalidURL = self { return true } return false } - /// Returns whether the AFError is a parameter encoding error. When `true`, the `underlyingError` property will + /// Returns whether the instance is `.parameterEncodingFailed`. When `true`, the `underlyingError` property will /// contain the associated value. public var isParameterEncodingError: Bool { if case .parameterEncodingFailed = self { return true } return false } - /// Returns whether the AFError is a multipart encoding error. When `true`, the `url` and `underlyingError` properties - /// will contain the associated values. + /// Returns whether the instance is `.parameterEncoderFailed`. When `true`, the `underlyingError` property will + // contain the associated value. + public var isParameterEncoderError: Bool { + if case .parameterEncoderFailed = self { return true } + return false + } + + /// Returns whether the instance is `.multipartEncodingFailed`. When `true`, the `url` and `underlyingError` + /// properties will contain the associated values. public var isMultipartEncodingError: Bool { if case .multipartEncodingFailed = self { return true } return false } - /// Returns whether the `AFError` is a response validation error. When `true`, the `acceptableContentTypes`, + /// Returns whether the instance is `.requestAdaptationFailed`. When `true`, the `underlyingError` property will + /// contain the associated value. + public var isRequestAdaptationError: Bool { + if case .requestAdaptationFailed = self { return true } + return false + } + + /// Returns whether the instance is `.responseValidationFailed`. When `true`, the `acceptableContentTypes`, /// `responseContentType`, and `responseCode` properties will contain the associated values. public var isResponseValidationError: Bool { if case .responseValidationFailed = self { return true } return false } - /// Returns whether the `AFError` is a response serialization error. When `true`, the `failedStringEncoding` and + /// Returns whether the instance is `.responseSerializationFailed`. When `true`, the `failedStringEncoding` and /// `underlyingError` properties will contain the associated values. public var isResponseSerializationError: Bool { if case .responseSerializationFailed = self { return true } return false } + + /// Returns whether the instance is `.serverTrustEvaluationFailed`. + public var isServerTrustEvaluationError: Bool { + if case .serverTrustEvaluationFailed = self { return true } + return false + } + + /// Returns whether the instance is `requestRetryFailed`. When `true`, the `underlyingError` property will + /// contain the associated value. + public var isRequestRetryError: Bool { + if case .requestRetryFailed = self { return true } + return false + } } // MARK: - Convenience Properties @@ -185,34 +296,35 @@ extension AFError { extension AFError { /// The `URLConvertible` associated with the error. public var urlConvertible: URLConvertible? { - switch self { - case .invalidURL(let url): - return url - default: - return nil - } + guard case .invalidURL(let url) = self else { return nil } + return url } /// The `URL` associated with the error. public var url: URL? { - switch self { - case .multipartEncodingFailed(let reason): - return reason.url - default: - return nil - } + guard case .multipartEncodingFailed(let reason) = self else { return nil } + return reason.url } - /// The `Error` returned by a system framework associated with a `.parameterEncodingFailed`, - /// `.multipartEncodingFailed` or `.responseSerializationFailed` error. + /// The underlying `Error` responsible for generating the failure associated with `.sessionInvalidated`, + /// `.parameterEncodingFailed`, `.parameterEncoderFailed`, `.multipartEncodingFailed`, `.requestAdaptationFailed`, + /// `.responseSerializationFailed`, `.requestRetryFailed` errors. public var underlyingError: Error? { switch self { + case .sessionInvalidated(let error): + return error case .parameterEncodingFailed(let reason): return reason.underlyingError + case .parameterEncoderFailed(let reason): + return reason.underlyingError case .multipartEncodingFailed(let reason): return reason.underlyingError + case .requestAdaptationFailed(let error): + return error case .responseSerializationFailed(let reason): return reason.underlyingError + case .requestRetryFailed(let retryError, _): + return retryError default: return nil } @@ -220,53 +332,40 @@ extension AFError { /// The acceptable `Content-Type`s of a `.responseValidationFailed` error. public var acceptableContentTypes: [String]? { - switch self { - case .responseValidationFailed(let reason): - return reason.acceptableContentTypes - default: - return nil - } + guard case .responseValidationFailed(let reason) = self else { return nil } + return reason.acceptableContentTypes } /// The response `Content-Type` of a `.responseValidationFailed` error. public var responseContentType: String? { - switch self { - case .responseValidationFailed(let reason): - return reason.responseContentType - default: - return nil - } + guard case .responseValidationFailed(let reason) = self else { return nil } + return reason.responseContentType } /// The response code of a `.responseValidationFailed` error. public var responseCode: Int? { - switch self { - case .responseValidationFailed(let reason): - return reason.responseCode - default: - return nil - } + guard case .responseValidationFailed(let reason) = self else { return nil } + return reason.responseCode } /// The `String.Encoding` associated with a failed `.stringResponse()` call. public var failedStringEncoding: String.Encoding? { - switch self { - case .responseSerializationFailed(let reason): - return reason.failedStringEncoding - default: - return nil - } + guard case .responseSerializationFailed(let reason) = self else { return nil } + return reason.failedStringEncoding } } extension AFError.ParameterEncodingFailureReason { var underlyingError: Error? { - switch self { - case .jsonEncodingFailed(let error), .propertyListEncodingFailed(let error): - return error - default: - return nil - } + guard case .jsonEncodingFailed(let error) = self else { return nil } + return error + } +} + +extension AFError.ParameterEncoderFailureReason { + var underlyingError: Error? { + guard case .encoderFailed(let error) = self else { return nil } + return error } } @@ -306,40 +405,36 @@ extension AFError.ResponseValidationFailureReason { } var responseContentType: String? { - switch self { - case .unacceptableContentType(_, let responseType): - return responseType - default: - return nil - } + guard case .unacceptableContentType(_, let responseType) = self else { return nil } + return responseType } var responseCode: Int? { - switch self { - case .unacceptableStatusCode(let code): - return code - default: - return nil - } + guard case .unacceptableStatusCode(let code) = self else { return nil } + return code } } extension AFError.ResponseSerializationFailureReason { var failedStringEncoding: String.Encoding? { - switch self { - case .stringSerializationFailed(let encoding): - return encoding - default: - return nil - } + guard case .stringSerializationFailed(let encoding) = self else { return nil } + return encoding } var underlyingError: Error? { + guard case .jsonSerializationFailed(let error) = self else { return nil } + return error + } +} + +extension AFError.ServerTrustFailureReason { + var output: AFError.ServerTrustFailureReason.Output? { switch self { - case .jsonSerializationFailed(let error), .propertyListSerializationFailed(let error): - return error - default: - return nil + case let .defaultEvaluationFailed(output), + let .hostValidationFailed(output), + let .revocationCheckFailed(output, _): + return output + default: return nil } } } @@ -349,16 +444,36 @@ extension AFError.ResponseSerializationFailureReason { extension AFError: LocalizedError { public var errorDescription: String? { switch self { + case .sessionDeinitialized: + return """ + Session was invalidated without error, so it was likely deinitialized unexpectedly. \ + Be sure to retain a reference to your Session for the duration of your requests. + """ + case .sessionInvalidated(let error): + return "Session was invalidated with error: \(error?.localizedDescription ?? "No description.")" + case .explicitlyCancelled: + return "Request explicitly cancelled." case .invalidURL(let url): return "URL is not valid: \(url)" case .parameterEncodingFailed(let reason): return reason.localizedDescription + case .parameterEncoderFailed(let reason): + return reason.localizedDescription case .multipartEncodingFailed(let reason): return reason.localizedDescription + case .requestAdaptationFailed(let error): + return "Request adaption failed with error: \(error.localizedDescription)" case .responseValidationFailed(let reason): return reason.localizedDescription case .responseSerializationFailed(let reason): return reason.localizedDescription + case .serverTrustEvaluationFailed: + return "Server trust evaluation failed." + case .requestRetryFailed(let retryError, let originalError): + return """ + Request retry failed with retry error: \(retryError.localizedDescription), \ + original error: \(originalError.localizedDescription) + """ } } } @@ -370,8 +485,17 @@ extension AFError.ParameterEncodingFailureReason { return "URL request to encode was missing a URL" case .jsonEncodingFailed(let error): return "JSON could not be encoded because of error:\n\(error.localizedDescription)" - case .propertyListEncodingFailed(let error): - return "PropertyList could not be encoded because of error:\n\(error.localizedDescription)" + } + } +} + +extension AFError.ParameterEncoderFailureReason { + var localizedDescription: String { + switch self { + case .missingRequiredComponent(let component): + return "Encoding failed due to a missing request component: \(component)" + case .encoderFailed(let error): + return "The underlying encoder failed with the error: \(error)" } } } @@ -418,8 +542,6 @@ extension AFError.MultipartEncodingFailureReason { extension AFError.ResponseSerializationFailureReason { var localizedDescription: String { switch self { - case .inputDataNil: - return "Response could not be serialized, input data was nil." case .inputDataNilOrZeroLength: return "Response could not be serialized, input data was nil or zero length." case .inputFileNil: @@ -430,8 +552,12 @@ extension AFError.ResponseSerializationFailureReason { return "String could not be serialized with encoding: \(encoding)." case .jsonSerializationFailed(let error): return "JSON could not be serialized because of error:\n\(error.localizedDescription)" - case .propertyListSerializationFailed(let error): - return "PropertyList could not be serialized because of error:\n\(error.localizedDescription)" + case .invalidEmptyResponse(let type): + return "Empty response could not be serialized to type: \(type). Use Empty as the expected type for such responses." + case .decodingFailed(let error): + return "Response could not be decoded because of error:\n\(error.localizedDescription)" + case .responseSerializerAddedAfterRequestFinished: + return "Response serializer was added to the request after it had already finished." } } } @@ -458,3 +584,32 @@ extension AFError.ResponseValidationFailureReason { } } } + +extension AFError.ServerTrustFailureReason { + var localizedDescription: String { + switch self { + case let .noRequiredEvaluator(host): + return "A ServerTrustEvaluating value is required for host \(host) but none was found." + case .noCertificatesFound: + return "No certificates were found or provided for evaluation." + case .noPublicKeysFound: + return "No public keys were found or provided for evaluation." + case .policyApplicationFailed: + return "Attempting to set a SecPolicy failed." + case .settingAnchorCertificatesFailed: + return "Attempting to set the provided certificates as anchor certificates failed." + case .revocationPolicyCreationFailed: + return "Attempting to create a revocation policy failed." + case let .defaultEvaluationFailed(output): + return "Default evaluation failed for host \(output.host)." + case let .hostValidationFailed(output): + return "Host validation failed for host \(output.host)." + case let .revocationCheckFailed(output, _): + return "Revocation check failed for host \(output.host)." + case let .certificatePinningFailed(host, _, _, _): + return "Certificate pinning failed for host \(host)." + case let .publicKeyPinningFailed(host, _, _, _): + return "Public key pinning failed for host \(host)." + } + } +} diff --git a/Example/Pods/Alamofire/Source/AFResult.swift b/Example/Pods/Alamofire/Source/AFResult.swift new file mode 100644 index 0000000..94898cd --- /dev/null +++ b/Example/Pods/Alamofire/Source/AFResult.swift @@ -0,0 +1,108 @@ +// +// AFResult.swift +// +// Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +public typealias AFResult = Result + +// MARK: - Internal APIs + +extension AFResult { + /// Returns the associated value if the result is a success, `nil` otherwise. + var value: Success? { + guard case .success(let value) = self else { return nil } + return value + } + + /// Returns the associated error value if the result is a failure, `nil` otherwise. + var error: Failure? { + guard case .failure(let error) = self else { return nil } + return error + } + + /// Initializes an `AFResult` from value or error. Returns `.failure` if the error is non-nil, `.success` otherwise. + /// + /// - Parameters: + /// - value: A value. + /// - error: An `Error`. + init(value: Success, error: Failure?) { + if let error = error { + self = .failure(error) + } else { + self = .success(value) + } + } + + /// Evaluates the specified closure when the `AFResult` is a success, passing the unwrapped value as a parameter. + /// + /// Use the `flatMap` method with a closure that may throw an error. For example: + /// + /// let possibleData: AFResult = .success(Data(...)) + /// let possibleObject = possibleData.flatMap { + /// try JSONSerialization.jsonObject(with: $0) + /// } + /// + /// - parameter transform: A closure that takes the success value of the instance. + /// + /// - returns: An `AFResult` containing the result of the given closure. If this instance is a failure, returns the + /// same failure. + func flatMap(_ transform: (Success) throws -> T) -> AFResult { + switch self { + case .success(let value): + do { + return try .success(transform(value)) + } catch { + return .failure(error) + } + case .failure(let error): + return .failure(error) + } + } + + /// Evaluates the specified closure when the `AFResult` is a failure, passing the unwrapped error as a parameter. + /// + /// Use the `flatMapError` function with a closure that may throw an error. For example: + /// + /// let possibleData: AFResult = .success(Data(...)) + /// let possibleObject = possibleData.flatMapError { + /// try someFailableFunction(taking: $0) + /// } + /// + /// - Parameter transform: A throwing closure that takes the error of the instance. + /// + /// - Returns: An `AFResult` instance containing the result of the transform. If this instance is a success, returns + /// the same success. + func flatMapError(_ transform: (Failure) throws -> T) -> AFResult { + switch self { + case .failure(let error): + do { + return try .failure(transform(error)) + } catch { + return .failure(error) + } + case .success(let value): + return .success(value) + } + } +} diff --git a/Example/Pods/Alamofire/Source/Alamofire.swift b/Example/Pods/Alamofire/Source/Alamofire.swift index 20c3672..98e7a33 100644 --- a/Example/Pods/Alamofire/Source/Alamofire.swift +++ b/Example/Pods/Alamofire/Source/Alamofire.swift @@ -1,7 +1,7 @@ // // Alamofire.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,442 +24,373 @@ import Foundation -/// Types adopting the `URLConvertible` protocol can be used to construct URLs, which are then used to construct -/// URL requests. -public protocol URLConvertible { - /// Returns a URL that conforms to RFC 2396 or throws an `Error`. - /// - /// - throws: An `Error` if the type cannot be converted to a `URL`. - /// - /// - returns: A URL or throws an `Error`. - func asURL() throws -> URL -} +/// Global namespace containing API for the `default` `Session` instance. +public enum AF { + // MARK: - Data Request -extension String: URLConvertible { - /// Returns a URL if `self` represents a valid URL string that conforms to RFC 2396 or throws an `AFError`. + /// Creates a `DataRequest` using `SessionManager.default` to retrive the contents of the specified `url` + /// using the `method`, `parameters`, `encoding`, and `headers` provided. /// - /// - throws: An `AFError.invalidURL` if `self` is not a valid URL string. + /// - Parameters: + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`, `.get` by default. + /// - parameters: The `Parameters`, `nil` by default. + /// - encoding: The `ParameterEncoding`, `URLEncoding.default` by default. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - interceptor: The `RequestInterceptor`, `nil` by default. /// - /// - returns: A URL or throws an `AFError`. - public func asURL() throws -> URL { - guard let url = URL(string: self) else { throw AFError.invalidURL(url: self) } - return url + /// - Returns: The created `DataRequest`. + public static func request(_ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoding: ParameterEncoding = URLEncoding.default, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> DataRequest { + return Session.default.request(url, + method: method, + parameters: parameters, + encoding: encoding, + headers: headers, + interceptor: interceptor) } -} - -extension URL: URLConvertible { - /// Returns self. - public func asURL() throws -> URL { return self } -} -extension URLComponents: URLConvertible { - /// Returns a URL if `url` is not nil, otherwise throws an `Error`. + /// Creates a `DataRequest` using `SessionManager.default` to retrive the contents of the specified `url` + /// using the `method`, `parameters`, `encoding`, and `headers` provided. /// - /// - throws: An `AFError.invalidURL` if `url` is `nil`. + /// - Parameters: + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`, `.get` by default. + /// - parameters: The `Encodable` parameters, `nil` by default. + /// - encoding: The `ParameterEncoding`, `URLEncodedFormParameterEncoder.default` by default. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - interceptor: The `RequestInterceptor`, `nil` by default. /// - /// - returns: A URL or throws an `AFError`. - public func asURL() throws -> URL { - guard let url = url else { throw AFError.invalidURL(url: self) } - return url + /// - Returns: The created `DataRequest`. + public static func request(_ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> DataRequest { + return Session.default.request(url, + method: method, + parameters: parameters, + encoder: encoder, + headers: headers, + interceptor: interceptor) } -} - -// MARK: - -/// Types adopting the `URLRequestConvertible` protocol can be used to construct URL requests. -public protocol URLRequestConvertible { - /// Returns a URL request or throws if an `Error` was encountered. + /// Creates a `DataRequest` using `SessionManager.default` to execute the specified `urlRequest`. /// - /// - throws: An `Error` if the underlying `URLRequest` is `nil`. + /// - Parameters: + /// - urlRequest: The `URLRequestConvertible` value. + /// - interceptor: The `RequestInterceptor`, `nil` by default. /// - /// - returns: A URL request. - func asURLRequest() throws -> URLRequest -} - -extension URLRequestConvertible { - /// The URL request. - public var urlRequest: URLRequest? { return try? asURLRequest() } -} - -extension URLRequest: URLRequestConvertible { - /// Returns a URL request or throws if an `Error` was encountered. - public func asURLRequest() throws -> URLRequest { return self } -} + /// - Returns: The created `DataRequest`. + public static func request(_ urlRequest: URLRequestConvertible, interceptor: RequestInterceptor? = nil) -> DataRequest { + return Session.default.request(urlRequest, interceptor: interceptor) + } -// MARK: - + // MARK: - Download Request -extension URLRequest { - /// Creates an instance with the specified `method`, `urlString` and `headers`. + /// Creates a `DownloadRequest` using `SessionManager.default` to download the contents of the specified `url` to + /// the provided `destination` using the `method`, `parameters`, `encoding`, and `headers` provided. /// - /// - parameter url: The URL. - /// - parameter method: The HTTP method. - /// - parameter headers: The HTTP headers. `nil` by default. + /// If `destination` is not specified, the download will remain at the temporary location determined by the + /// underlying `URLSession`. /// - /// - returns: The new `URLRequest` instance. - public init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) throws { - let url = try url.asURL() - - self.init(url: url) - - httpMethod = method.rawValue - - if let headers = headers { - for (headerField, headerValue) in headers { - setValue(headerValue, forHTTPHeaderField: headerField) - } - } + /// - Parameters: + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`, `.get` by default. + /// - parameters: The `Parameters`, `nil` by default. + /// - encoding: The `ParameterEncoding`, `URLEncoding.default` by default. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// - destination: The `DownloadRequest.Destination` closure used the determine the destination of the + /// downloaded file. `nil` by default. + /// + /// - Returns: The created `DownloadRequest`. + public static func download(_ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoding: ParameterEncoding = URLEncoding.default, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil, + to destination: DownloadRequest.Destination? = nil) -> DownloadRequest { + return Session.default.download(url, + method: method, + parameters: parameters, + encoding: encoding, + headers: headers, + interceptor: interceptor, + to: destination) } - func adapt(using adapter: RequestAdapter?) throws -> URLRequest { - guard let adapter = adapter else { return self } - return try adapter.adapt(self) + /// Creates a `DownloadRequest` using `SessionManager.default` to download the contents of the specified `url` to + /// the provided `destination` using the `method`, encodable `parameters`, `encoder`, and `headers` provided. + /// + /// If `destination` is not specified, the download will remain at the temporary location determined by the + /// underlying `URLSession`. + /// + /// - Parameters: + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`, `.get` by default. + /// - parameters: The `Encodable` parameters, `nil` by default. + /// - encoder: The `ParameterEncoder`, `URLEncodedFormParameterEncoder.default` by default. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// - destination: The `DownloadRequest.Destination` closure used the determine the destination of the + /// downloaded file. `nil` by default. + /// + /// - Returns: The created `DownloadRequest`. + public static func download(_ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil, + to destination: DownloadRequest.Destination? = nil) -> DownloadRequest { + return Session.default.download(url, + method: method, + parameters: parameters, + encoder: encoder, + headers: headers, + interceptor: interceptor, + to: destination) } -} - -// MARK: - Data Request - -/// Creates a `DataRequest` using the default `SessionManager` to retrieve the contents of the specified `url`, -/// `method`, `parameters`, `encoding` and `headers`. -/// -/// - parameter url: The URL. -/// - parameter method: The HTTP method. `.get` by default. -/// - parameter parameters: The parameters. `nil` by default. -/// - parameter encoding: The parameter encoding. `URLEncoding.default` by default. -/// - parameter headers: The HTTP headers. `nil` by default. -/// -/// - returns: The created `DataRequest`. -@discardableResult -public func request( - _ url: URLConvertible, - method: HTTPMethod = .get, - parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil) - -> DataRequest -{ - return SessionManager.default.request( - url, - method: method, - parameters: parameters, - encoding: encoding, - headers: headers - ) -} - -/// Creates a `DataRequest` using the default `SessionManager` to retrieve the contents of a URL based on the -/// specified `urlRequest`. -/// -/// - parameter urlRequest: The URL request -/// -/// - returns: The created `DataRequest`. -@discardableResult -public func request(_ urlRequest: URLRequestConvertible) -> DataRequest { - return SessionManager.default.request(urlRequest) -} -// MARK: - Download Request - -// MARK: URL Request - -/// Creates a `DownloadRequest` using the default `SessionManager` to retrieve the contents of the specified `url`, -/// `method`, `parameters`, `encoding`, `headers` and save them to the `destination`. -/// -/// If `destination` is not specified, the contents will remain in the temporary location determined by the -/// underlying URL session. -/// -/// - parameter url: The URL. -/// - parameter method: The HTTP method. `.get` by default. -/// - parameter parameters: The parameters. `nil` by default. -/// - parameter encoding: The parameter encoding. `URLEncoding.default` by default. -/// - parameter headers: The HTTP headers. `nil` by default. -/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. -/// -/// - returns: The created `DownloadRequest`. -@discardableResult -public func download( - _ url: URLConvertible, - method: HTTPMethod = .get, - parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - to destination: DownloadRequest.DownloadFileDestination? = nil) - -> DownloadRequest -{ - return SessionManager.default.download( - url, - method: method, - parameters: parameters, - encoding: encoding, - headers: headers, - to: destination - ) -} - -/// Creates a `DownloadRequest` using the default `SessionManager` to retrieve the contents of a URL based on the -/// specified `urlRequest` and save them to the `destination`. -/// -/// If `destination` is not specified, the contents will remain in the temporary location determined by the -/// underlying URL session. -/// -/// - parameter urlRequest: The URL request. -/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. -/// -/// - returns: The created `DownloadRequest`. -@discardableResult -public func download( - _ urlRequest: URLRequestConvertible, - to destination: DownloadRequest.DownloadFileDestination? = nil) - -> DownloadRequest -{ - return SessionManager.default.download(urlRequest, to: destination) -} + // MARK: URLRequest -// MARK: Resume Data - -/// Creates a `DownloadRequest` using the default `SessionManager` from the `resumeData` produced from a -/// previous request cancellation to retrieve the contents of the original request and save them to the `destination`. -/// -/// If `destination` is not specified, the contents will remain in the temporary location determined by the -/// underlying URL session. -/// -/// On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), `resumeData` is broken -/// on background URL session configurations. There's an underlying bug in the `resumeData` generation logic where the -/// data is written incorrectly and will always fail to resume the download. For more information about the bug and -/// possible workarounds, please refer to the following Stack Overflow post: -/// -/// - http://stackoverflow.com/a/39347461/1342462 -/// -/// - parameter resumeData: The resume data. This is an opaque data blob produced by `URLSessionDownloadTask` -/// when a task is cancelled. See `URLSession -downloadTask(withResumeData:)` for additional -/// information. -/// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. -/// -/// - returns: The created `DownloadRequest`. -@discardableResult -public func download( - resumingWith resumeData: Data, - to destination: DownloadRequest.DownloadFileDestination? = nil) - -> DownloadRequest -{ - return SessionManager.default.download(resumingWith: resumeData, to: destination) -} - -// MARK: - Upload Request - -// MARK: File - -/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers` -/// for uploading the `file`. -/// -/// - parameter file: The file to upload. -/// - parameter url: The URL. -/// - parameter method: The HTTP method. `.post` by default. -/// - parameter headers: The HTTP headers. `nil` by default. -/// -/// - returns: The created `UploadRequest`. -@discardableResult -public func upload( - _ fileURL: URL, - to url: URLConvertible, - method: HTTPMethod = .post, - headers: HTTPHeaders? = nil) - -> UploadRequest -{ - return SessionManager.default.upload(fileURL, to: url, method: method, headers: headers) -} - -/// Creates a `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for -/// uploading the `file`. -/// -/// - parameter file: The file to upload. -/// - parameter urlRequest: The URL request. -/// -/// - returns: The created `UploadRequest`. -@discardableResult -public func upload(_ fileURL: URL, with urlRequest: URLRequestConvertible) -> UploadRequest { - return SessionManager.default.upload(fileURL, with: urlRequest) -} + /// Creates a `DownloadRequest` using `SessionManager.default` to execute the specified `urlRequest` and download + /// the result to the provided `destination`. + /// + /// - Parameters: + /// - urlRequest: The `URLRequestConvertible` value. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// - destination: The `DownloadRequest.Destination` closure used the determine the destination of the + /// downloaded file. `nil` by default. + /// + /// - Returns: The created `DownloadRequest`. + public static func download(_ urlRequest: URLRequestConvertible, + interceptor: RequestInterceptor? = nil, + to destination: DownloadRequest.Destination? = nil) -> DownloadRequest { + return Session.default.download(urlRequest, interceptor: interceptor, to: destination) + } -// MARK: Data + // MARK: Resume Data -/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers` -/// for uploading the `data`. -/// -/// - parameter data: The data to upload. -/// - parameter url: The URL. -/// - parameter method: The HTTP method. `.post` by default. -/// - parameter headers: The HTTP headers. `nil` by default. -/// -/// - returns: The created `UploadRequest`. -@discardableResult -public func upload( - _ data: Data, - to url: URLConvertible, - method: HTTPMethod = .post, - headers: HTTPHeaders? = nil) - -> UploadRequest -{ - return SessionManager.default.upload(data, to: url, method: method, headers: headers) -} + /// Creates a `DownloadRequest` using the `SessionManager.default` from the `resumeData` produced from a previous + /// `DownloadRequest` cancellation to retrieve the contents of the original request and save them to the `destination`. + /// + /// If `destination` is not specified, the contents will remain in the temporary location determined by the + /// underlying URL session. + /// + /// On some versions of all Apple platforms (iOS 10 - 10.2, macOS 10.12 - 10.12.2, tvOS 10 - 10.1, watchOS 3 - 3.1.1), + /// `resumeData` is broken on background URL session configurations. There's an underlying bug in the `resumeData` + /// generation logic where the data is written incorrectly and will always fail to resume the download. For more + /// information about the bug and possible workarounds, please refer to the [this Stack Overflow post](http://stackoverflow.com/a/39347461/1342462). + /// + /// - Parameters: + /// - resumeData: The resume `Data`. This is an opaque blob produced by `URLSessionDownloadTask` when a task is + /// cancelled. See [Apple's documentation](https://developer.apple.com/documentation/foundation/urlsessiondownloadtask/1411634-cancel) + /// for more information. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// - destination: The `DownloadRequest.Destination` closure used to determine the destination of the downloaded + /// file. `nil` by default. + /// + /// - Returns: The created `DownloadRequest`. + public static func download(resumingWith resumeData: Data, + interceptor: RequestInterceptor? = nil, + to destination: DownloadRequest.Destination? = nil) -> DownloadRequest { + return Session.default.download(resumingWith: resumeData, interceptor: interceptor, to: destination) + } -/// Creates an `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for -/// uploading the `data`. -/// -/// - parameter data: The data to upload. -/// - parameter urlRequest: The URL request. -/// -/// - returns: The created `UploadRequest`. -@discardableResult -public func upload(_ data: Data, with urlRequest: URLRequestConvertible) -> UploadRequest { - return SessionManager.default.upload(data, with: urlRequest) -} + // MARK: - Upload Request -// MARK: InputStream + // MARK: File -/// Creates an `UploadRequest` using the default `SessionManager` from the specified `url`, `method` and `headers` -/// for uploading the `stream`. -/// -/// - parameter stream: The stream to upload. -/// - parameter url: The URL. -/// - parameter method: The HTTP method. `.post` by default. -/// - parameter headers: The HTTP headers. `nil` by default. -/// -/// - returns: The created `UploadRequest`. -@discardableResult -public func upload( - _ stream: InputStream, - to url: URLConvertible, - method: HTTPMethod = .post, - headers: HTTPHeaders? = nil) - -> UploadRequest -{ - return SessionManager.default.upload(stream, to: url, method: method, headers: headers) -} + /// Creates an `UploadRequest` using `SessionManager.default` to upload the contents of the `fileURL` specified + /// using the `url`, `method` and `headers` provided. + /// + /// - Parameters: + /// - fileURL: The `URL` of the file to upload. + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`, `.post` by default. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// + /// - Returns: The created `UploadRequest`. + public static func upload(_ fileURL: URL, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return Session.default.upload(fileURL, to: url, method: method, headers: headers, interceptor: interceptor) + } -/// Creates an `UploadRequest` using the default `SessionManager` from the specified `urlRequest` for -/// uploading the `stream`. -/// -/// - parameter urlRequest: The URL request. -/// - parameter stream: The stream to upload. -/// -/// - returns: The created `UploadRequest`. -@discardableResult -public func upload(_ stream: InputStream, with urlRequest: URLRequestConvertible) -> UploadRequest { - return SessionManager.default.upload(stream, with: urlRequest) -} + /// Creates an `UploadRequest` using the `SessionManager.default` to upload the contents of the `fileURL` specificed + /// using the `urlRequest` provided. + /// + /// - Parameters: + /// - fileURL: The `URL` of the file to upload. + /// - urlRequest: The `URLRequestConvertible` value. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// + /// - Returns: The created `UploadRequest`. + public static func upload(_ fileURL: URL, + with urlRequest: URLRequestConvertible, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return Session.default.upload(fileURL, with: urlRequest, interceptor: interceptor) + } -// MARK: MultipartFormData + // MARK: Data -/// Encodes `multipartFormData` using `encodingMemoryThreshold` with the default `SessionManager` and calls -/// `encodingCompletion` with new `UploadRequest` using the `url`, `method` and `headers`. -/// -/// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative -/// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most -/// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to -/// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory -/// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be -/// used for larger payloads such as video content. -/// -/// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory -/// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, -/// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk -/// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding -/// technique was used. -/// -/// - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. -/// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. -/// `multipartFormDataEncodingMemoryThreshold` by default. -/// - parameter url: The URL. -/// - parameter method: The HTTP method. `.post` by default. -/// - parameter headers: The HTTP headers. `nil` by default. -/// - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. -public func upload( - multipartFormData: @escaping (MultipartFormData) -> Void, - usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, - to url: URLConvertible, - method: HTTPMethod = .post, - headers: HTTPHeaders? = nil, - encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?) -{ - return SessionManager.default.upload( - multipartFormData: multipartFormData, - usingThreshold: encodingMemoryThreshold, - to: url, - method: method, - headers: headers, - encodingCompletion: encodingCompletion - ) -} + /// Creates an `UploadRequest` using `SessionManager.default` to upload the contents of the `data` specified using + /// the `url`, `method` and `headers` provided. + /// + /// - Parameters: + /// - data: The `Data` to upload. + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`, `.post` by default. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// - retryPolicies: The `RetryPolicy` types, `[]` by default. + /// + /// - Returns: The created `UploadRequest`. + public static func upload(_ data: Data, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return Session.default.upload(data, to: url, method: method, headers: headers, interceptor: interceptor) + } -/// Encodes `multipartFormData` using `encodingMemoryThreshold` and the default `SessionManager` and -/// calls `encodingCompletion` with new `UploadRequest` using the `urlRequest`. -/// -/// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative -/// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most -/// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to -/// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory -/// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be -/// used for larger payloads such as video content. -/// -/// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory -/// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, -/// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk -/// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding -/// technique was used. -/// -/// - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. -/// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. -/// `multipartFormDataEncodingMemoryThreshold` by default. -/// - parameter urlRequest: The URL request. -/// - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. -public func upload( - multipartFormData: @escaping (MultipartFormData) -> Void, - usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, - with urlRequest: URLRequestConvertible, - encodingCompletion: ((SessionManager.MultipartFormDataEncodingResult) -> Void)?) -{ - return SessionManager.default.upload( - multipartFormData: multipartFormData, - usingThreshold: encodingMemoryThreshold, - with: urlRequest, - encodingCompletion: encodingCompletion - ) -} + /// Creates an `UploadRequest` using `SessionManager.default` to upload the contents of the `data` specified using + /// the `urlRequest` provided. + /// + /// - Parameters: + /// - data: The `Data` to upload. + /// - urlRequest: The `URLRequestConvertible` value. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// + /// - Returns: The created `UploadRequest`. + public static func upload(_ data: Data, + with urlRequest: URLRequestConvertible, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return Session.default.upload(data, with: urlRequest, interceptor: interceptor) + } -#if !os(watchOS) + // MARK: InputStream -// MARK: - Stream Request + /// Creates an `UploadRequest` using `SessionManager.default` to upload the content provided by the `stream` + /// specified using the `url`, `method` and `headers` provided. + /// + /// - Parameters: + /// - stream: The `InputStream` to upload. + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`, `.post` by default. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// + /// - Returns: The created `UploadRequest`. + public static func upload(_ stream: InputStream, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return Session.default.upload(stream, to: url, method: method, headers: headers, interceptor: interceptor) + } -// MARK: Hostname and Port + /// Creates an `UploadRequest` using `SessionManager.default` to upload the content provided by the `stream` + /// specified using the `urlRequest` specified. + /// + /// - Parameters: + /// - stream: The `InputStream` to upload. + /// - urlRequest: The `URLRequestConvertible` value. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// + /// - Returns: The created `UploadRequest`. + public static func upload(_ stream: InputStream, + with urlRequest: URLRequestConvertible, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return Session.default.upload(stream, with: urlRequest, interceptor: interceptor) + } -/// Creates a `StreamRequest` using the default `SessionManager` for bidirectional streaming with the `hostname` -/// and `port`. -/// -/// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. -/// -/// - parameter hostName: The hostname of the server to connect to. -/// - parameter port: The port of the server to connect to. -/// -/// - returns: The created `StreamRequest`. -@discardableResult -@available(iOS 9.0, macOS 10.11, tvOS 9.0, *) -public func stream(withHostName hostName: String, port: Int) -> StreamRequest { - return SessionManager.default.stream(withHostName: hostName, port: port) -} + // MARK: MultipartFormData -// MARK: NetService + /// Encodes `multipartFormData` using `encodingMemoryThreshold` and uploads the result using `SessionManager.default` + /// with the `url`, `method`, and `headers` provided. + /// + /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative + /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most + /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to + /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory + /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be + /// used for larger payloads such as video content. + /// + /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory + /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, + /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk + /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding + /// technique was used. + /// + /// - Parameters: + /// - multipartFormData: The closure used to append body parts to the `MultipartFormData`. + /// - encodingMemoryThreshold: The encoding memory threshold in bytes. `10_000_000` bytes by default. + /// - fileManager: The `FileManager` instance to use to manage streaming and encoding. + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`, `.post` by default. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// + /// - Returns: The created `UploadRequest`. + public static func upload(multipartFormData: @escaping (MultipartFormData) -> Void, + usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold, + fileManager: FileManager = .default, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return Session.default.upload(multipartFormData: multipartFormData, + usingThreshold: encodingMemoryThreshold, + fileManager: fileManager, + to: url, + method: method, + headers: headers, + interceptor: interceptor) + } -/// Creates a `StreamRequest` using the default `SessionManager` for bidirectional streaming with the `netService`. -/// -/// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. -/// -/// - parameter netService: The net service used to identify the endpoint. -/// -/// - returns: The created `StreamRequest`. -@discardableResult -@available(iOS 9.0, macOS 10.11, tvOS 9.0, *) -public func stream(with netService: NetService) -> StreamRequest { - return SessionManager.default.stream(with: netService) + /// Encodes `multipartFormData` using `encodingMemoryThreshold` and uploads the result using `SessionManager.default` + /// using the `urlRequest` provided. + /// + /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative + /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most + /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to + /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory + /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be + /// used for larger payloads such as video content. + /// + /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory + /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, + /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk + /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding + /// technique was used. + /// + /// - Parameters: + /// - multipartFormData: The closure used to append body parts to the `MultipartFormData`. + /// - encodingMemoryThreshold: The encoding memory threshold in bytes. `10_000_000` bytes by default. + /// - urlRequest: The `URLRequestConvertible` value. + /// - interceptor: The `RequestInterceptor`, `nil` by default. + /// + /// - Returns: The `UploadRequest` created. + @discardableResult + public static func upload(multipartFormData: MultipartFormData, + usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold, + with urlRequest: URLRequestConvertible, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return Session.default.upload(multipartFormData: multipartFormData, + usingThreshold: encodingMemoryThreshold, + with: urlRequest, + interceptor: interceptor) + } } - -#endif diff --git a/Example/Pods/ObjectMapper/Sources/NSDecimalNumberTransform.swift b/Example/Pods/Alamofire/Source/AlamofireExtended.swift similarity index 52% rename from Example/Pods/ObjectMapper/Sources/NSDecimalNumberTransform.swift rename to Example/Pods/Alamofire/Source/AlamofireExtended.swift index d06a4b9..f9fbb0a 100644 --- a/Example/Pods/ObjectMapper/Sources/NSDecimalNumberTransform.swift +++ b/Example/Pods/Alamofire/Source/AlamofireExtended.swift @@ -1,12 +1,7 @@ // -// TransformOf.swift -// ObjectMapper +// AlamofireExtended.swift // -// Created by Tristan Himmelman on 8/22/16. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman +// Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -25,28 +20,36 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// -import Foundation +/// Type that acts as a generic extension point for all `AlamofireExtended` types. +public struct AlamofireExtension { + /// Stores the type or metatype of any extended type. + let type: ExtendedType -open class NSDecimalNumberTransform: TransformType { - public typealias Object = NSDecimalNumber - public typealias JSON = String + init(_ type: ExtendedType) { + self.type = type + } +} + +/// Protocol describing the `af` extension points for Alamofire extended types. +public protocol AlamofireExtended { + associatedtype ExtendedType - public init() {} + /// Static Alamofire extension point. + static var af: AlamofireExtension.Type { get set } + /// Instance Alamofire extension point. + var af: AlamofireExtension { get set } +} - open func transformFromJSON(_ value: Any?) -> NSDecimalNumber? { - if let string = value as? String { - return NSDecimalNumber(string: string) - } else if let number = value as? NSNumber { - return NSDecimalNumber(decimal: number.decimalValue) - } else if let double = value as? Double { - return NSDecimalNumber(floatLiteral: double) - } - return nil +public extension AlamofireExtended { + static var af: AlamofireExtension.Type { + get { return AlamofireExtension.self } + set { } } - open func transformToJSON(_ value: NSDecimalNumber?) -> String? { - guard let value = value else { return nil } - return value.description + var af: AlamofireExtension { + get { return AlamofireExtension(self) } + set { } } } diff --git a/Example/Pods/Alamofire/Source/CachedResponseHandler.swift b/Example/Pods/Alamofire/Source/CachedResponseHandler.swift new file mode 100644 index 0000000..5306d85 --- /dev/null +++ b/Example/Pods/Alamofire/Source/CachedResponseHandler.swift @@ -0,0 +1,92 @@ +// +// CachedResponseHandler.swift +// +// Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// A type that handles whether the data task should store the HTTP response in the cache. +public protocol CachedResponseHandler { + /// Determines whether the HTTP response should be stored in the cache. + /// + /// The `completion` closure should be passed one of three possible options: + /// + /// 1. The cached response provided by the server (this is the most common use case). + /// 2. A modified version of the cached response (you may want to modify it in some way before caching). + /// 3. A `nil` value to prevent the cached response from being stored in the cache. + /// + /// - Parameters: + /// - task: The data task whose request resulted in the cached response. + /// - response: The cached response to potentially store in the cache. + /// - completion: The closure to execute containing cached response, a modified response, or `nil`. + func dataTask(_ task: URLSessionDataTask, + willCacheResponse response: CachedURLResponse, + completion: @escaping (CachedURLResponse?) -> Void) +} + +// MARK: - + +/// `ResponseCacher` is a convenience `CachedResponseHandler` making it easy to cache, not cache, or modify a cached +/// response. +public struct ResponseCacher { + /// Defines the behavior of the `ResponseCacher` type. + /// + /// - cache: Stores the cached response in the cache. + /// - doNotCache: Prevents the cached response from being stored in the cache. + /// - modify: Modifies the cached response before storing it in the cache. + public enum Behavior { + case cache + case doNotCache + case modify((URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?) + } + + /// Returns a `ResponseCacher` with a follow `Behavior`. + public static let cache = ResponseCacher(behavior: .cache) + /// Returns a `ResponseCacher` with a do not follow `Behavior`. + public static let doNotCache = ResponseCacher(behavior: .doNotCache) + + /// The `Behavior` of the `ResponseCacher`. + public let behavior: Behavior + + /// Creates a `ResponseCacher` instance from the `Behavior`. + /// + /// - Parameter behavior: The `Behavior`. + public init(behavior: Behavior) { + self.behavior = behavior + } +} + +extension ResponseCacher: CachedResponseHandler { + public func dataTask(_ task: URLSessionDataTask, + willCacheResponse response: CachedURLResponse, + completion: @escaping (CachedURLResponse?) -> Void) { + switch behavior { + case .cache: + completion(response) + case .doNotCache: + completion(nil) + case .modify(let closure): + let response = closure(task, response) + completion(response) + } + } +} diff --git a/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift b/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift index a54673c..fdfee6b 100644 --- a/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +++ b/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift @@ -1,7 +1,7 @@ // // DispatchQueue+Alamofire.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -26,11 +26,6 @@ import Dispatch import Foundation extension DispatchQueue { - static var userInteractive: DispatchQueue { return DispatchQueue.global(qos: .userInteractive) } - static var userInitiated: DispatchQueue { return DispatchQueue.global(qos: .userInitiated) } - static var utility: DispatchQueue { return DispatchQueue.global(qos: .utility) } - static var background: DispatchQueue { return DispatchQueue.global(qos: .background) } - func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) { asyncAfter(deadline: .now() + delay, execute: closure) } diff --git a/Example/Pods/Alamofire/Source/EventMonitor.swift b/Example/Pods/Alamofire/Source/EventMonitor.swift new file mode 100644 index 0000000..8207537 --- /dev/null +++ b/Example/Pods/Alamofire/Source/EventMonitor.swift @@ -0,0 +1,826 @@ +// +// EventMonitor.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Protocol outlining the lifetime events inside Alamofire. It includes both events received from the various +/// `URLSession` delegate protocols as well as various events from the lifetime of `Request` and its subclasses. +public protocol EventMonitor { + /// The `DispatchQueue` onto which Alamofire's root `CompositeEventMonitor` will dispatch events. Defaults to `.main`. + var queue: DispatchQueue { get } + + // MARK: - URLSession Events + + // MARK: URLSessionDelegate Events + + /// Event called during `URLSessionDelegate`'s `urlSession(_:didBecomeInvalidWithError:)` method. + func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) + + // MARK: URLSessionTaskDelegate Events + + /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didReceive:completionHandler:)` method. + func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge) + + /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)` method. + func urlSession(_ session: URLSession, + task: URLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) + + /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:needNewBodyStream:)` method. + func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) + + /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` method. + func urlSession(_ session: URLSession, + task: URLSessionTask, + willPerformHTTPRedirection response: HTTPURLResponse, + newRequest request: URLRequest) + + /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didFinishCollecting:)` method. + func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) + + /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didCompleteWithError:)` method. + func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) + + /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:taskIsWaitingForConnectivity:)` method. + @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) + func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) + + // MARK: URLSessionDataDelegate Events + + /// Event called during `URLSessionDataDelegate`'s `urlSession(_:dataTask:didReceive:)` method. + func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) + + /// Event called during `URLSessionDataDelegate`'s `urlSession(_:dataTask:willCacheResponse:completionHandler:)` method. + func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse) + + // MARK: URLSessionDownloadDelegate Events + + /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)` method. + func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) + + /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)` method. + func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) + + /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didFinishDownloadingTo:)` method. + func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) + + // MARK: - Request Events + + /// Event called when a `URLRequest` is first created for a `Request`. + func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) + + /// Event called when the attempt to create a `URLRequest` from a `Request`'s original `URLRequestConvertible` value fails. + func request(_ request: Request, didFailToCreateURLRequestWithError error: Error) + + /// Event called when a `RequestAdapter` adapts the `Request`'s initial `URLRequest`. + func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest) + + /// Event called when a `RequestAdapter` fails to adapt the `Request`'s initial `URLRequest`. + func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: Error) + + /// Event called when a `URLSessionTask` subclass instance is created for a `Request`. + func request(_ request: Request, didCreateTask task: URLSessionTask) + + /// Event called when a `Request` receives a `URLSessionTaskMetrics` value. + func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) + + /// Event called when a `Request` fails due to an error created by Alamofire. e.g. When certificat pinning fails. + func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: Error) + + /// Event called when a `Request`'s task completes, possibly with an error. A `Request` may recieve this event + /// multiple times if it is retried. + func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: Error?) + + /// Event called when a `Request` is about to be retried. + func requestIsRetrying(_ request: Request) + + /// Event called when a `Request` finishes and response serializers are being called. + func requestDidFinish(_ request: Request) + + /// Event called when a `Request` receives a `resume` call. + func requestDidResume(_ request: Request) + + /// Event called when a `Request`'s associated `URLSessionTask` is resumed. + func request(_ request: Request, didResumeTask task: URLSessionTask) + + /// Event called when a `Request` receives a `suspend` call. + func requestDidSuspend(_ request: Request) + + /// Event called when a `Request`'s associated `URLSessionTask` is suspended. + func request(_ request: Request, didSuspendTask task: URLSessionTask) + + /// Event called when a `Request` receives a `cancel` call. + func requestDidCancel(_ request: Request) + + /// Event called when a `Request`'s associated `URLSessionTask` is cancelled. + func request(_ request: Request, didCancelTask task: URLSessionTask) + + // MARK: DataRequest Events + + /// Event called when a `DataRequest` calls a `Validation`. + func request(_ request: DataRequest, + didValidateRequest urlRequest: URLRequest?, + response: HTTPURLResponse, + data: Data?, + withResult result: Request.ValidationResult) + + /// Event called when a `DataRequest` creates a `DataResponse` value without calling a `ResponseSerializer`. + func request(_ request: DataRequest, didParseResponse response: DataResponse) + + /// Event called when a `DataRequest` calls a `ResponseSerializer` and creates a generic `DataResponse`. + func request(_ request: DataRequest, didParseResponse response: DataResponse) + + // MARK: UploadRequest Events + + /// Event called when an `UploadRequest` creates its `Uploadable` value, indicating the type of upload it represents. + func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) + + /// Event called when an `UploadRequest` failes to create its `Uploadable` value due to an error. + func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: Error) + + /// Event called when an `UploadRequest` provides the `InputStream` from its `Uploadable` value. This only occurs if + /// the `InputStream` does not wrap a `Data` value or file `URL`. + func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) + + // MARK: DownloadRequest Events + + /// Event called when a `DownloadRequest`'s `URLSessionDownloadTask` finishes and the temporary file has been moved. + func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: AFResult) + + /// Event called when a `DownloadRequest`'s `Destination` closure is called and creates the destination URL the + /// downloaded file will be moved to. + func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) + + /// Event called when a `DownloadRequest` calls a `Validation`. + func request(_ request: DownloadRequest, + didValidateRequest urlRequest: URLRequest?, + response: HTTPURLResponse, + fileURL: URL?, + withResult result: Request.ValidationResult) + + /// Event called when a `DownloadRequest` creates a `DownloadResponse` without calling a `ResponseSerializer`. + func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse) + + /// Event called when a `DownloadRequest` calls a `DownloadResponseSerializer` and creates a generic `DownloadResponse` + func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse) +} + +extension EventMonitor { + /// The default queue on which `CompositeEventMonitor`s will call the `EventMonitor` methods. Defaults to `.main`. + public var queue: DispatchQueue { return .main } + + // MARK: Default Implementations + + public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { } + public func urlSession(_ session: URLSession, + task: URLSessionTask, + didReceive challenge: URLAuthenticationChallenge) { } + public func urlSession(_ session: URLSession, + task: URLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) { } + public func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) { } + public func urlSession(_ session: URLSession, + task: URLSessionTask, + willPerformHTTPRedirection response: HTTPURLResponse, + newRequest request: URLRequest) { } + public func urlSession(_ session: URLSession, + task: URLSessionTask, + didFinishCollecting metrics: URLSessionTaskMetrics) { } + public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { } + public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) { } + public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { } + public func urlSession(_ session: URLSession, + dataTask: URLSessionDataTask, + willCacheResponse proposedResponse: CachedURLResponse) { } + public func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) { } + public func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) { } + public func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didFinishDownloadingTo location: URL) { } + public func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) { } + public func request(_ request: Request, didFailToCreateURLRequestWithError error: Error) { } + public func request(_ request: Request, + didAdaptInitialRequest initialRequest: URLRequest, + to adaptedRequest: URLRequest) { } + public func request(_ request: Request, + didFailToAdaptURLRequest initialRequest: URLRequest, + withError error: Error) { } + public func request(_ request: Request, didCreateTask task: URLSessionTask) { } + public func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) { } + public func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: Error) { } + public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: Error?) { } + public func requestIsRetrying(_ request: Request) { } + public func requestDidFinish(_ request: Request) { } + public func requestDidResume(_ request: Request) { } + public func request(_ request: Request, didResumeTask task: URLSessionTask) { } + public func requestDidSuspend(_ request: Request) { } + public func request(_ request: Request, didSuspendTask task: URLSessionTask) { } + public func requestDidCancel(_ request: Request) { } + public func request(_ request: Request, didCancelTask task: URLSessionTask) { } + public func request(_ request: DataRequest, + didValidateRequest urlRequest: URLRequest?, + response: HTTPURLResponse, + data: Data?, + withResult result: Request.ValidationResult) { } + public func request(_ request: DataRequest, didParseResponse response: DataResponse) { } + public func request(_ request: DataRequest, didParseResponse response: DataResponse) { } + public func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) { } + public func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: Error) { } + public func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) { } + public func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: AFResult) { } + public func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) { } + public func request(_ request: DownloadRequest, + didValidateRequest urlRequest: URLRequest?, + response: HTTPURLResponse, + fileURL: URL?, + withResult result: Request.ValidationResult) { } + public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse) { } + public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse) { } +} + +/// An `EventMonitor` which can contain multiple `EventMonitor`s and calls their methods on their queues. +public final class CompositeEventMonitor: EventMonitor { + public let queue = DispatchQueue(label: "org.alamofire.componsiteEventMonitor", qos: .background) + + let monitors: [EventMonitor] + + init(monitors: [EventMonitor]) { + self.monitors = monitors + } + + func performEvent(_ event: @escaping (EventMonitor) -> Void) { + queue.async { + for monitor in self.monitors { + monitor.queue.async { event(monitor) } + } + } + } + + public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { + performEvent { $0.urlSession(session, didBecomeInvalidWithError: error) } + } + + public func urlSession(_ session: URLSession, + task: URLSessionTask, + didReceive challenge: URLAuthenticationChallenge) { + performEvent { $0.urlSession(session, task: task, didReceive: challenge) } + } + + public func urlSession(_ session: URLSession, + task: URLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) { + performEvent { + $0.urlSession(session, + task: task, + didSendBodyData: bytesSent, + totalBytesSent: totalBytesSent, + totalBytesExpectedToSend: totalBytesExpectedToSend) + } + } + + public func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) { + performEvent { + $0.urlSession(session, taskNeedsNewBodyStream: task) + } + } + + public func urlSession(_ session: URLSession, + task: URLSessionTask, + willPerformHTTPRedirection response: HTTPURLResponse, + newRequest request: URLRequest) { + performEvent { + $0.urlSession(session, + task: task, + willPerformHTTPRedirection: response, + newRequest: request) + } + } + + public func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) { + performEvent { $0.urlSession(session, task: task, didFinishCollecting: metrics) } + } + + public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { + performEvent { $0.urlSession(session, task: task, didCompleteWithError: error) } + } + + @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) + public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) { + performEvent { $0.urlSession(session, taskIsWaitingForConnectivity: task) } + } + + public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { + performEvent { $0.urlSession(session, dataTask: dataTask, didReceive: data) } + } + + public func urlSession(_ session: URLSession, + dataTask: URLSessionDataTask, + willCacheResponse proposedResponse: CachedURLResponse) { + performEvent { $0.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse) } + } + + public func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) { + performEvent { + $0.urlSession(session, + downloadTask: downloadTask, + didResumeAtOffset: fileOffset, + expectedTotalBytes: expectedTotalBytes) + } + } + + public func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) { + performEvent { + $0.urlSession(session, + downloadTask: downloadTask, + didWriteData: bytesWritten, + totalBytesWritten: totalBytesWritten, + totalBytesExpectedToWrite: totalBytesExpectedToWrite) + } + } + + public func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didFinishDownloadingTo location: URL) { + performEvent { $0.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location) } + } + + public func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) { + performEvent { $0.request(request, didCreateURLRequest: urlRequest) } + } + + public func request(_ request: Request, didFailToCreateURLRequestWithError error: Error) { + performEvent { $0.request(request, didFailToCreateURLRequestWithError: error) } + } + + public func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest) { + performEvent { $0.request(request, didAdaptInitialRequest: initialRequest, to: adaptedRequest) } + } + + public func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: Error) { + performEvent { $0.request(request, didFailToAdaptURLRequest: initialRequest, withError: error) } + } + + public func request(_ request: Request, didCreateTask task: URLSessionTask) { + performEvent { $0.request(request, didCreateTask: task) } + } + + public func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) { + performEvent { $0.request(request, didGatherMetrics: metrics) } + } + + public func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: Error) { + performEvent { $0.request(request, didFailTask: task, earlyWithError: error) } + } + + public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: Error?) { + performEvent { $0.request(request, didCompleteTask: task, with: error) } + } + + public func requestIsRetrying(_ request: Request) { + performEvent { $0.requestIsRetrying(request) } + } + + public func requestDidFinish(_ request: Request) { + performEvent { $0.requestDidFinish(request) } + } + + public func requestDidResume(_ request: Request) { + performEvent { $0.requestDidResume(request) } + } + + public func request(_ request: Request, didResumeTask task: URLSessionTask) { + performEvent { $0.request(request, didResumeTask: task) } + } + + public func requestDidSuspend(_ request: Request) { + performEvent { $0.requestDidSuspend(request) } + } + + public func request(_ request: Request, didSuspendTask task: URLSessionTask) { + performEvent { $0.request(request, didSuspendTask: task) } + } + + public func requestDidCancel(_ request: Request) { + performEvent { $0.requestDidCancel(request) } + } + + public func request(_ request: Request, didCancelTask task: URLSessionTask) { + performEvent { $0.request(request, didCancelTask: task) } + } + + public func request(_ request: DataRequest, + didValidateRequest urlRequest: URLRequest?, + response: HTTPURLResponse, + data: Data?, + withResult result: Request.ValidationResult) { + performEvent { $0.request(request, + didValidateRequest: urlRequest, + response: response, + data: data, + withResult: result) + } + } + + public func request(_ request: DataRequest, didParseResponse response: DataResponse) { + performEvent { $0.request(request, didParseResponse: response) } + } + + public func request(_ request: DataRequest, didParseResponse response: DataResponse) { + performEvent { $0.request(request, didParseResponse: response) } + } + + public func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) { + performEvent { $0.request(request, didCreateUploadable: uploadable) } + } + + public func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: Error) { + performEvent { $0.request(request, didFailToCreateUploadableWithError: error) } + } + + public func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) { + performEvent { $0.request(request, didProvideInputStream: stream) } + } + + public func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: AFResult) { + performEvent { $0.request(request, didFinishDownloadingUsing: task, with: result) } + } + + public func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) { + performEvent { $0.request(request, didCreateDestinationURL: url) } + } + + public func request(_ request: DownloadRequest, + didValidateRequest urlRequest: URLRequest?, + response: HTTPURLResponse, + fileURL: URL?, + withResult result: Request.ValidationResult) { + performEvent { $0.request(request, + didValidateRequest: urlRequest, + response: response, + fileURL: fileURL, + withResult: result) } + } + + public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse) { + performEvent { $0.request(request, didParseResponse: response) } + } + + public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse) { + performEvent { $0.request(request, didParseResponse: response) } + } +} + +/// `EventMonitor` that allows optional closures to be set to receive events. +open class ClosureEventMonitor: EventMonitor { + /// Closure called on the `urlSession(_:didBecomeInvalidWithError:)` event. + open var sessionDidBecomeInvalidWithError: ((URLSession, Error?) -> Void)? + + /// Closure called on the `urlSession(_:task:didReceive:completionHandler:)`. + open var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> Void)? + + /// Closure that receives `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)` event. + open var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)? + + /// Closure called on the `urlSession(_:task:needNewBodyStream:)` event. + open var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> Void)? + + /// Closure called on the `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` event. + open var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> Void)? + + /// Closure called on the `urlSession(_:task:didFinishCollecting:)` event. + open var taskDidFinishCollectingMetrics: ((URLSession, URLSessionTask, URLSessionTaskMetrics) -> Void)? + + /// Closure called on the `urlSession(_:task:didCompleteWithError:)` event. + open var taskDidComplete: ((URLSession, URLSessionTask, Error?) -> Void)? + + /// Closure called on the `urlSession(_:taskIsWaitingForConnectivity:)` event. + open var taskIsWaitingForConnectivity: ((URLSession, URLSessionTask) -> Void)? + + /// Closure that recieves the `urlSession(_:dataTask:didReceive:)` event. + open var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)? + + /// Closure called on the `urlSession(_:dataTask:willCacheResponse:completionHandler:)` event. + open var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> Void)? + + /// Closure called on the `urlSession(_:downloadTask:didFinishDownloadingTo:)` event. + open var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> Void)? + + /// Closure called on the `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)` + /// event. + open var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)? + + /// Closure called on the `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)` event. + open var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)? + + // MARK: - Request Events + + /// Closure called on the `request(_:didCreateURLRequest:)` event. + open var requestDidCreateURLRequest: ((Request, URLRequest) -> Void)? + + /// Closure called on the `request(_:didFailToCreateURLRequestWithError:)` event. + open var requestDidFailToCreateURLRequestWithError: ((Request, Error) -> Void)? + + /// Closure called on the `request(_:didAdaptInitialRequest:to:)` event. + open var requestDidAdaptInitialRequestToAdaptedRequest: ((Request, URLRequest, URLRequest) -> Void)? + + /// Closure called on the `request(_:didFailToAdaptURLRequest:withError:)` event. + open var requestDidFailToAdaptURLRequestWithError: ((Request, URLRequest, Error) -> Void)? + + /// Closure called on the `request(_:didCreateTask:)` event. + open var requestDidCreateTask: ((Request, URLSessionTask) -> Void)? + + /// Closure called on the `request(_:didGatherMetrics:)` event. + open var requestDidGatherMetrics: ((Request, URLSessionTaskMetrics) -> Void)? + + /// Closure called on the `request(_:didFailTask:earlyWithError:)` event. + open var requestDidFailTaskEarlyWithError: ((Request, URLSessionTask, Error) -> Void)? + + /// Closure called on the `request(_:didCompleteTask:with:)` event. + open var requestDidCompleteTaskWithError: ((Request, URLSessionTask, Error?) -> Void)? + + /// Closure called on the `requestIsRetrying(_:)` event. + open var requestIsRetrying: ((Request) -> Void)? + + /// Closure called on the `requestDidFinish(_:)` event. + open var requestDidFinish: ((Request) -> Void)? + + /// Closure called on the `requestDidResume(_:)` event. + open var requestDidResume: ((Request) -> Void)? + + /// Closure called on the `request(_:didResumeTask:)` event. + open var requestDidResumeTask: ((Request, URLSessionTask) -> Void)? + + /// Closure called on the `requestDidSuspend(_:)` event. + open var requestDidSuspend: ((Request) -> Void)? + + /// Closure called on the `request(_:didSuspendTask:)` event. + open var requestDidSuspendTask: ((Request, URLSessionTask) -> Void)? + + /// Closure called on the `requestDidCancel(_:)` event. + open var requestDidCancel: ((Request) -> Void)? + + /// Closure called on the `request(_:didCancelTask:)` event. + open var requestDidCancelTask: ((Request, URLSessionTask) -> Void)? + + /// Closure called on the `request(_:didValidateRequest:response:data:withResult:)` event. + open var requestDidValidateRequestResponseDataWithResult: ((DataRequest, URLRequest?, HTTPURLResponse, Data?, Request.ValidationResult) -> Void)? + + /// Closure called on the `request(_:didParseResponse:)` event. + open var requestDidParseResponse: ((DataRequest, DataResponse) -> Void)? + + /// Closure called on the `request(_:didCreateUploadable:)` event. + open var requestDidCreateUploadable: ((UploadRequest, UploadRequest.Uploadable) -> Void)? + + /// Closure called on the `request(_:didFailToCreateUploadableWithError:)` event. + open var requestDidFailToCreateUploadableWithError: ((UploadRequest, Error) -> Void)? + + /// Closure called on the `request(_:didProvideInputStream:)` event. + open var requestDidProvideInputStream: ((UploadRequest, InputStream) -> Void)? + + /// Closure called on the `request(_:didFinishDownloadingUsing:with:)` event. + open var requestDidFinishDownloadingUsingTaskWithResult: ((DownloadRequest, URLSessionTask, AFResult) -> Void)? + + /// Closure called on the `request(_:didCreateDestinationURL:)` event. + open var requestDidCreateDestinationURL: ((DownloadRequest, URL) -> Void)? + + /// Closure called on the `request(_:didValidateRequest:response:temporaryURL:destinationURL:withResult:)` event. + open var requestDidValidateRequestResponseFileURLWithResult: ((DownloadRequest, URLRequest?, HTTPURLResponse, URL?, Request.ValidationResult) -> Void)? + + /// Closure called on the `request(_:didParseResponse:)` event. + open var requestDidParseDownloadResponse: ((DownloadRequest, DownloadResponse) -> Void)? + + public let queue: DispatchQueue + + public init(queue: DispatchQueue = .main) { + self.queue = queue + } + + open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { + sessionDidBecomeInvalidWithError?(session, error) + } + + open func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge) { + taskDidReceiveChallenge?(session, task, challenge) + } + + open func urlSession(_ session: URLSession, + task: URLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) { + taskDidSendBodyData?(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend) + } + + open func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) { + taskNeedNewBodyStream?(session, task) + } + + open func urlSession(_ session: URLSession, + task: URLSessionTask, + willPerformHTTPRedirection response: HTTPURLResponse, + newRequest request: URLRequest) { + taskWillPerformHTTPRedirection?(session, task, response, request) + } + + open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) { + taskDidFinishCollectingMetrics?(session, task, metrics) + } + + open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { + taskDidComplete?(session, task, error) + } + + open func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) { + taskIsWaitingForConnectivity?(session, task) + } + + open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { + dataTaskDidReceiveData?(session, dataTask, data) + } + + open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse) { + dataTaskWillCacheResponse?(session, dataTask, proposedResponse) + } + + open func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) { + downloadTaskDidResumeAtOffset?(session, downloadTask, fileOffset, expectedTotalBytes) + } + + open func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) { + downloadTaskDidWriteData?(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) + } + + open func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) { + downloadTaskDidFinishDownloadingToURL?(session, downloadTask, location) + } + + // MARK: Request Events + + open func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) { + requestDidCreateURLRequest?(request, urlRequest) + } + + open func request(_ request: Request, didFailToCreateURLRequestWithError error: Error) { + requestDidFailToCreateURLRequestWithError?(request, error) + } + + open func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest) { + requestDidAdaptInitialRequestToAdaptedRequest?(request, initialRequest, adaptedRequest) + } + + open func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: Error) { + requestDidFailToAdaptURLRequestWithError?(request, initialRequest, error) + } + + open func request(_ request: Request, didCreateTask task: URLSessionTask) { + requestDidCreateTask?(request, task) + } + + open func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) { + requestDidGatherMetrics?(request, metrics) + } + + open func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: Error) { + requestDidFailTaskEarlyWithError?(request, task, error) + } + + open func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: Error?) { + requestDidCompleteTaskWithError?(request, task, error) + } + + open func requestIsRetrying(_ request: Request) { + requestIsRetrying?(request) + } + + open func requestDidFinish(_ request: Request) { + requestDidFinish?(request) + } + + open func requestDidResume(_ request: Request) { + requestDidResume?(request) + } + + public func request(_ request: Request, didResumeTask task: URLSessionTask) { + requestDidResumeTask?(request, task) + } + + open func requestDidSuspend(_ request: Request) { + requestDidSuspend?(request) + } + + public func request(_ request: Request, didSuspendTask task: URLSessionTask) { + requestDidSuspendTask?(request, task) + } + + open func requestDidCancel(_ request: Request) { + requestDidCancel?(request) + } + + public func request(_ request: Request, didCancelTask task: URLSessionTask) { + requestDidCancelTask?(request, task) + } + + open func request(_ request: DataRequest, + didValidateRequest urlRequest: URLRequest?, + response: HTTPURLResponse, + data: Data?, + withResult result: Request.ValidationResult) { + requestDidValidateRequestResponseDataWithResult?(request, urlRequest, response, data, result) + } + + open func request(_ request: DataRequest, didParseResponse response: DataResponse) { + requestDidParseResponse?(request, response) + } + + open func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) { + requestDidCreateUploadable?(request, uploadable) + } + + open func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: Error) { + requestDidFailToCreateUploadableWithError?(request, error) + } + + open func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) { + requestDidProvideInputStream?(request, stream) + } + + open func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: AFResult) { + requestDidFinishDownloadingUsingTaskWithResult?(request, task, result) + } + + open func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) { + requestDidCreateDestinationURL?(request, url) + } + + open func request(_ request: DownloadRequest, + didValidateRequest urlRequest: URLRequest?, + response: HTTPURLResponse, + fileURL: URL?, + withResult result: Request.ValidationResult) { + requestDidValidateRequestResponseFileURLWithResult?(request, + urlRequest, + response, + fileURL, + result) + } + + open func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse) { + requestDidParseDownloadResponse?(request, response) + } + +} diff --git a/Example/Pods/Alamofire/Source/HTTPHeaders.swift b/Example/Pods/Alamofire/Source/HTTPHeaders.swift new file mode 100644 index 0000000..4780a12 --- /dev/null +++ b/Example/Pods/Alamofire/Source/HTTPHeaders.swift @@ -0,0 +1,435 @@ +// +// HTTPHeaders.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + + +/// An order-preserving and case-insensitive representation of HTTP headers. +public struct HTTPHeaders { + private var headers = [HTTPHeader]() + + /// Create an empty instance. + public init() { } + + /// Create an instance from an array of `HTTPHeader`s. Duplicate case-insensitive names are collapsed into the last + /// name and value encountered. + public init(_ headers: [HTTPHeader]) { + self.init() + + headers.forEach { update($0) } + } + + /// Create an instance from a `[String: String]`. Duplicate case-insensitive names are collapsed into the last name + /// and value encountered. + public init(_ dictionary: [String: String]) { + self.init() + + dictionary.forEach { update(HTTPHeader(name: $0.key, value: $0.value)) } + } + + /// Case-insensitively updates or appends an `HTTPHeader` into the instance using the provided `name` and `value`. + /// + /// - Parameters: + /// - name: The `HTTPHeader` name. + /// - value: The `HTTPHeader value. + public mutating func add(name: String, value: String) { + update(HTTPHeader(name: name, value: value)) + } + + /// Case-insensitively updates or appends the provided `HTTPHeader` into the instance. + /// + /// - Parameter header: The `HTTPHeader` to update or append. + public mutating func add(_ header: HTTPHeader) { + update(header) + } + + /// Case-insensitively updates or appends an `HTTPHeader` into the instance using the provided `name` and `value`. + /// + /// - Parameters: + /// - name: The `HTTPHeader` name. + /// - value: The `HTTPHeader value. + public mutating func update(name: String, value: String) { + update(HTTPHeader(name: name, value: value)) + } + + /// Case-insensitively updates or appends the provided `HTTPHeader` into the instance. + /// + /// - Parameter header: The `HTTPHeader` to update or append. + public mutating func update(_ header: HTTPHeader) { + guard let index = headers.index(of: header.name) else { + headers.append(header) + return + } + + headers.replaceSubrange(index...index, with: [header]) + } + + /// Case-insensitively removes an `HTTPHeader`, if it exists, from the instance. + /// + /// - Parameter name: The name of the `HTTPHeader` to remove. + public mutating func remove(name: String) { + guard let index = headers.index(of: name) else { return } + + headers.remove(at: index) + } + + /// Sort the current instance by header name. + mutating public func sort() { + headers.sort { $0.name < $1.name } + } + + /// Returns an instance sorted by header name. + /// + /// - Returns: A copy of the current instance sorted by name. + public func sorted() -> HTTPHeaders { + return HTTPHeaders(headers.sorted { $0.name < $1.name }) + } + + /// Case-insensitively find a header's value by name. + /// + /// - Parameter name: The name of the header to search for, case-insensitively. + /// - Returns: The value of header, if it exists. + public func value(for name: String) -> String? { + guard let index = headers.index(of: name) else { return nil } + + return headers[index].value + } + + /// Case-insensitively access the header with the given name. + /// + /// - Parameter name: The name of the header. + public subscript(_ name: String) -> String? { + get { return value(for: name) } + set { + if let value = newValue { + update(name: name, value: value) + } else { + remove(name: name) + } + } + } + + /// The dictionary representation of all headers. + /// + /// This representation does not preserve the current order of the instance. + public var dictionary: [String: String] { + let namesAndValues = headers.map { ($0.name, $0.value) } + + return Dictionary(namesAndValues, uniquingKeysWith: { (_, last) in last }) + } +} + +extension HTTPHeaders: ExpressibleByDictionaryLiteral { + public init(dictionaryLiteral elements: (String, String)...) { + self.init() + + elements.forEach { update(name: $0.0, value: $0.1) } + } +} + +extension HTTPHeaders: ExpressibleByArrayLiteral { + public init(arrayLiteral elements: HTTPHeader...) { + self.init(elements) + } +} + +extension HTTPHeaders: Sequence { + public func makeIterator() -> IndexingIterator> { + return headers.makeIterator() + } +} + +extension HTTPHeaders: Collection { + public var startIndex: Int { + return headers.startIndex + } + + public var endIndex: Int { + return headers.endIndex + } + + public subscript(position: Int) -> HTTPHeader { + return headers[position] + } + + public func index(after i: Int) -> Int { + return headers.index(after: i) + } +} + +extension HTTPHeaders: CustomStringConvertible { + public var description: String { + return headers.map { $0.description } + .joined(separator: "\n") + } +} + +// MARK: - HTTPHeader + +/// A representation of a single HTTP header's name / value pair. +public struct HTTPHeader: Hashable { + /// Name of the header. + public let name: String + + /// Value of the header. + public let value: String + + /// Creates an instance from the given `name` and `value`. + /// + /// - Parameters: + /// - name: The name of the header. + /// - value: The value of the header. + public init(name: String, value: String) { + self.name = name + self.value = value + } +} + +extension HTTPHeader: CustomStringConvertible { + public var description: String { + return "\(name): \(value)" + } +} + +extension HTTPHeader { + /// Returns an `Accept-Charset` header. + /// + /// - Parameter value: The `Accept-Charset` value. + /// - Returns: The header. + public static func acceptCharset(_ value: String) -> HTTPHeader { + return HTTPHeader(name: "Accept-Charset", value: value) + } + + /// Returns an `Accept-Language` header. + /// + /// Alamofire offers a default Accept-Language header that accumulates and encodes the system's preferred languages. + /// Use `HTTPHeader.defaultAcceptLanguage`. + /// + /// - Parameter value: The `Accept-Language` value. + /// - Returns: The header. + public static func acceptLanguage(_ value: String) -> HTTPHeader { + return HTTPHeader(name: "Accept-Language", value: value) + } + + /// Returns an `Accept-Encoding` header. + /// + /// Alamofire offers a default accept encoding value that provides the most common values. Use + /// `HTTPHeader.defaultAcceptEncoding`. + /// + /// - Parameter value: The `Accept-Encoding` value. + /// - Returns: The header + public static func acceptEncoding(_ value: String) -> HTTPHeader { + return HTTPHeader(name: "Accept-Encoding", value: value) + } + + /// Returns a `Basic` `Authorization` header using the `username` and `password` provided. + /// + /// - Parameters: + /// - username: The username of the header. + /// - password: The password of the header. + /// - Returns: The header. + public static func authorization(username: String, password: String) -> HTTPHeader { + let credential = Data("\(username):\(password)".utf8).base64EncodedString() + + return authorization("Basic \(credential)") + } + + /// Returns a `Bearer` `Authorization` header using the `bearerToken` provided + /// + /// - Parameter bearerToken: The bearer token. + /// - Returns: The header. + public static func authorization(bearerToken: String) -> HTTPHeader { + return authorization("Bearer \(bearerToken)") + } + + /// Returns an `Authorization` header. + /// + /// Alamofire provides built-in methods to produce `Authorization` headers. For a Basic `Authorization` header use + /// `HTTPHeader.authorization(username: password:)`. For a Bearer `Authorization` header, use + /// `HTTPHeader.authorization(bearerToken:)`. + /// + /// - Parameter value: The `Authorization` value. + /// - Returns: The header. + public static func authorization(_ value: String) -> HTTPHeader { + return HTTPHeader(name: "Authorization", value: value) + } + + /// Returns a `Content-Disposition` header. + /// + /// - Parameter value: The `Content-Disposition` value. + /// - Returns: The header. + public static func contentDisposition(_ value: String) -> HTTPHeader { + return HTTPHeader(name: "Content-Disposition", value: value) + } + + /// Returns a `Content-Type` header. + /// + /// All Alamofire `ParameterEncoding`s set the `Content-Type` of the request, so it may not be necessary to manually + /// set this value. + /// + /// - Parameter value: The `Content-Type` value. + /// - Returns: The header. + public static func contentType(_ value: String) -> HTTPHeader { + return HTTPHeader(name: "Content-Type", value: value) + } + + /// Returns a `User-Agent` header. + /// + /// - Parameter value: The `User-Agent` value. + /// - Returns: The header. + public static func userAgent(_ value: String) -> HTTPHeader { + return HTTPHeader(name: "User-Agent", value: value) + } +} + +extension Array where Element == HTTPHeader { + /// Case-insensitively finds the index of an `HTTPHeader` with the provided name, if it exists. + func index(of name: String) -> Int? { + let lowercasedName = name.lowercased() + return firstIndex { $0.name.lowercased() == lowercasedName } + } +} + +// MARK: - Defaults + +extension HTTPHeaders { + /// The default set of `HTTPHeaders` used by Alamofire. Includes `Accept-Encoding`, `Accept-Language`, and + /// `User-Agent`. + public static let `default`: HTTPHeaders = [.defaultAcceptEncoding, + .defaultAcceptLanguage, + .defaultUserAgent] +} + +extension HTTPHeader { + /// Returns Alamofire's default `Accept-Encoding` header, appropriate for the encodings supporte by particular OS + /// versions. + /// + /// See the [Accept-Encoding HTTP header documentation](https://tools.ietf.org/html/rfc7230#section-4.2.3) . + public static let defaultAcceptEncoding: HTTPHeader = { + let encodings: [String] + if #available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *) { + encodings = ["br", "gzip", "deflate"] + } else { + encodings = ["gzip", "deflate"] + } + + return .acceptEncoding(encodings.qualityEncoded) + }() + + /// Returns Alamofire's default `Accept-Language` header, generated by querying `Locale` for the user's + /// `preferredLanguages`. + /// + /// See the [Accept-Language HTTP header documentation](https://tools.ietf.org/html/rfc7231#section-5.3.5). + public static let defaultAcceptLanguage: HTTPHeader = { + .acceptLanguage(Locale.preferredLanguages.prefix(6).qualityEncoded) + }() + + /// Returns Alamofire's default `User-Agent` header. + /// + /// See the [User-Agent header documentation](https://tools.ietf.org/html/rfc7231#section-5.5.3). + /// + /// Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 12.0.0) Alamofire/5.0.0` + public static let defaultUserAgent: HTTPHeader = { + let userAgent: String = { + if let info = Bundle.main.infoDictionary { + let executable = info[kCFBundleExecutableKey as String] as? String ?? "Unknown" + let bundle = info[kCFBundleIdentifierKey as String] as? String ?? "Unknown" + let appVersion = info["CFBundleShortVersionString"] as? String ?? "Unknown" + let appBuild = info[kCFBundleVersionKey as String] as? String ?? "Unknown" + + let osNameVersion: String = { + let version = ProcessInfo.processInfo.operatingSystemVersion + let versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)" + + let osName: String = { + #if os(iOS) + return "iOS" + #elseif os(watchOS) + return "watchOS" + #elseif os(tvOS) + return "tvOS" + #elseif os(macOS) + return "macOS" + #elseif os(Linux) + return "Linux" + #else + return "Unknown" + #endif + }() + + return "\(osName) \(versionString)" + }() + + let alamofireVersion: String = { + guard + let afInfo = Bundle(for: Session.self).infoDictionary, + let build = afInfo["CFBundleShortVersionString"] + else { return "Unknown" } + + return "Alamofire/\(build)" + }() + + return "\(executable)/\(appVersion) (\(bundle); build:\(appBuild); \(osNameVersion)) \(alamofireVersion)" + } + + return "Alamofire" + }() + + return .userAgent(userAgent) + }() +} + +extension Collection where Element == String { + var qualityEncoded: String { + return enumerated().map { (index, encoding) in + let quality = 1.0 - (Double(index) * 0.1) + return "\(encoding);q=\(quality)" + }.joined(separator: ", ") + } +} + +// MARK: - System Type Extensions + +extension URLRequest { + /// Returns `allHTTPHeaderFields` as `HTTPHeaders`. + public var headers: HTTPHeaders { + get { return allHTTPHeaderFields.map(HTTPHeaders.init) ?? HTTPHeaders() } + set { allHTTPHeaderFields = newValue.dictionary } + } +} + +extension HTTPURLResponse { + /// Returns `allHeaderFields` as `HTTPHeaders`. + public var headers: HTTPHeaders { + return (allHeaderFields as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders() + } +} + +extension URLSessionConfiguration { + /// Returns `httpAdditionalHeaders` as `HTTPHeaders`. + public var headers: HTTPHeaders { + get { return (httpAdditionalHeaders as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders() } + set { httpAdditionalHeaders = newValue.dictionary } + } +} diff --git a/Example/Pods/ObjectMapper/Sources/EnumTransform.swift b/Example/Pods/Alamofire/Source/HTTPMethod.swift similarity index 65% rename from Example/Pods/ObjectMapper/Sources/EnumTransform.swift rename to Example/Pods/Alamofire/Source/HTTPMethod.swift index f63d3ad..44049bc 100644 --- a/Example/Pods/ObjectMapper/Sources/EnumTransform.swift +++ b/Example/Pods/Alamofire/Source/HTTPMethod.swift @@ -1,12 +1,7 @@ // -// EnumTransform.swift -// ObjectMapper +// HTTPMethod.swift // -// Created by Kaan Dedeoglu on 3/20/15. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -25,26 +20,19 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// -import Foundation - -open class EnumTransform: TransformType { - public typealias Object = T - public typealias JSON = T.RawValue - - public init() {} - - open func transformFromJSON(_ value: Any?) -> T? { - if let raw = value as? T.RawValue { - return T(rawValue: raw) - } - return nil - } - - open func transformToJSON(_ value: T?) -> T.RawValue? { - if let obj = value { - return obj.rawValue - } - return nil - } +/// HTTP method definitions. +/// +/// See https://tools.ietf.org/html/rfc7231#section-4.3 +public enum HTTPMethod: String { + case connect = "CONNECT" + case delete = "DELETE" + case get = "GET" + case head = "HEAD" + case options = "OPTIONS" + case patch = "PATCH" + case post = "POST" + case put = "PUT" + case trace = "TRACE" } diff --git a/Example/Pods/Alamofire/Source/MultipartFormData.swift b/Example/Pods/Alamofire/Source/MultipartFormData.swift index b840138..1a7ae5f 100644 --- a/Example/Pods/Alamofire/Source/MultipartFormData.swift +++ b/Example/Pods/Alamofire/Source/MultipartFormData.swift @@ -1,7 +1,7 @@ // // MultipartFormData.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -71,7 +71,7 @@ open class MultipartFormData { boundaryText = "\(EncodingCharacters.crlf)--\(boundary)--\(EncodingCharacters.crlf)" } - return boundaryText.data(using: String.Encoding.utf8, allowLossyConversion: false)! + return Data(boundaryText.utf8) } } @@ -91,6 +91,9 @@ open class MultipartFormData { // MARK: - Properties + /// Default memory threshold used when encoding `MultipartFormData`, in bytes. + public static let encodingMemoryThreshold: UInt64 = 10_000_000 + /// The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`. open lazy var contentType: String = "multipart/form-data; boundary=\(self.boundary)" @@ -98,7 +101,9 @@ open class MultipartFormData { public var contentLength: UInt64 { return bodyParts.reduce(0) { $0 + $1.bodyContentLength } } /// The boundary used to separate the body parts in the encoded form data. - public var boundary: String + public let boundary: String + + let fileManager: FileManager private var bodyParts: [BodyPart] private var bodyPartError: AFError? @@ -109,8 +114,9 @@ open class MultipartFormData { /// Creates a multipart form data object. /// /// - returns: The multipart form data object. - public init() { - self.boundary = BoundaryGenerator.randomBoundary() + public init(fileManager: FileManager = .default, boundary: String? = nil) { + self.fileManager = fileManager + self.boundary = boundary ?? BoundaryGenerator.randomBoundary() self.bodyParts = [] /// @@ -124,44 +130,6 @@ open class MultipartFormData { // MARK: - Body Parts - /// Creates a body part from the data and appends it to the multipart form data object. - /// - /// The body part data will be encoded using the following format: - /// - /// - `Content-Disposition: form-data; name=#{name}` (HTTP Header) - /// - Encoded data - /// - Multipart form boundary - /// - /// - parameter data: The data to encode into the multipart form data. - /// - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. - public func append(_ data: Data, withName name: String) { - let headers = contentHeaders(withName: name) - let stream = InputStream(data: data) - let length = UInt64(data.count) - - append(stream, withLength: length, headers: headers) - } - - /// Creates a body part from the data and appends it to the multipart form data object. - /// - /// The body part data will be encoded using the following format: - /// - /// - `Content-Disposition: form-data; name=#{name}` (HTTP Header) - /// - `Content-Type: #{generated mimeType}` (HTTP Header) - /// - Encoded data - /// - Multipart form boundary - /// - /// - parameter data: The data to encode into the multipart form data. - /// - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. - /// - parameter mimeType: The MIME type to associate with the data content type in the `Content-Type` HTTP header. - public func append(_ data: Data, withName name: String, mimeType: String) { - let headers = contentHeaders(withName: name, mimeType: mimeType) - let stream = InputStream(data: data) - let length = UInt64(data.count) - - append(stream, withLength: length, headers: headers) - } - /// Creates a body part from the data and appends it to the multipart form data object. /// /// The body part data will be encoded using the following format: @@ -175,7 +143,7 @@ open class MultipartFormData { /// - parameter name: The name to associate with the data in the `Content-Disposition` HTTP header. /// - parameter fileName: The filename to associate with the data in the `Content-Disposition` HTTP header. /// - parameter mimeType: The MIME type to associate with the data in the `Content-Type` HTTP header. - public func append(_ data: Data, withName name: String, fileName: String, mimeType: String) { + public func append(_ data: Data, withName name: String, fileName: String? = nil, mimeType: String? = nil) { let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType) let stream = InputStream(data: data) let length = UInt64(data.count) @@ -257,7 +225,7 @@ open class MultipartFormData { var isDirectory: ObjCBool = false let path = fileURL.path - guard FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue else { + guard fileManager.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue else { setBodyPartError(withReason: .bodyPartFileIsDirectory(at: fileURL)) return } @@ -269,7 +237,7 @@ open class MultipartFormData { let bodyContentLength: UInt64 do { - guard let fileSize = try FileManager.default.attributesOfItem(atPath: path)[.size] as? NSNumber else { + guard let fileSize = try fileManager.attributesOfItem(atPath: path)[.size] as? NSNumber else { setBodyPartError(withReason: .bodyPartFileSizeNotAvailable(at: fileURL)) return } @@ -340,7 +308,7 @@ open class MultipartFormData { /// /// It is important to note that this method will load all the appended body parts into memory all at the same /// time. This method should only be used when the encoded data will have a small memory footprint. For large data - /// cases, please use the `writeEncodedDataToDisk(fileURL:completionHandler:)` method. + /// cases, please use the `writeEncodedData(to:))` method. /// /// - throws: An `AFError` if encoding encounters an error. /// @@ -376,7 +344,7 @@ open class MultipartFormData { throw bodyPartError } - if FileManager.default.fileExists(atPath: fileURL.path) { + if fileManager.fileExists(atPath: fileURL.path) { throw AFError.multipartEncodingFailed(reason: .outputStreamFileAlreadyExists(at: fileURL)) } else if !fileURL.isFileURL { throw AFError.multipartEncodingFailed(reason: .outputStreamURLInvalid(url: fileURL)) @@ -419,14 +387,11 @@ open class MultipartFormData { } private func encodeHeaders(for bodyPart: BodyPart) -> Data { - var headerText = "" - - for (key, value) in bodyPart.headers { - headerText += "\(key): \(value)\(EncodingCharacters.crlf)" - } - headerText += EncodingCharacters.crlf + let headerText = bodyPart.headers.map { "\($0.name): \($0.value)\(EncodingCharacters.crlf)" } + .joined() + + EncodingCharacters.crlf - return headerText.data(using: String.Encoding.utf8, allowLossyConversion: false)! + return Data(headerText.utf8) } private func encodeBodyStream(for bodyPart: BodyPart) throws -> Data { @@ -547,12 +512,12 @@ open class MultipartFormData { // MARK: - Private - Content Headers - private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> [String: String] { + private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> HTTPHeaders { var disposition = "form-data; name=\"\(name)\"" if let fileName = fileName { disposition += "; filename=\"\(fileName)\"" } - var headers = ["Content-Disposition": disposition] - if let mimeType = mimeType { headers["Content-Type"] = mimeType } + var headers: HTTPHeaders = [.contentDisposition(disposition)] + if let mimeType = mimeType { headers.add(.contentType(mimeType)) } return headers } diff --git a/Example/Pods/Alamofire/Source/MultipartUpload.swift b/Example/Pods/Alamofire/Source/MultipartUpload.swift new file mode 100644 index 0000000..fc26e01 --- /dev/null +++ b/Example/Pods/Alamofire/Source/MultipartUpload.swift @@ -0,0 +1,86 @@ +// +// MultipartUpload.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +final class MultipartUpload { + lazy var result = AFResult { try build() } + + let isInBackgroundSession: Bool + let multipartFormData: MultipartFormData + let encodingMemoryThreshold: UInt64 + let request: URLRequestConvertible + let fileManager: FileManager + + init(isInBackgroundSession: Bool, + encodingMemoryThreshold: UInt64, + request: URLRequestConvertible, + multipartFormData: MultipartFormData) { + self.isInBackgroundSession = isInBackgroundSession + self.encodingMemoryThreshold = encodingMemoryThreshold + self.request = request + self.fileManager = multipartFormData.fileManager + self.multipartFormData = multipartFormData + } + + func build() throws -> (request: URLRequest, uploadable: UploadRequest.Uploadable) { + var urlRequest = try request.asURLRequest() + urlRequest.setValue(multipartFormData.contentType, forHTTPHeaderField: "Content-Type") + + let uploadable: UploadRequest.Uploadable + if multipartFormData.contentLength < encodingMemoryThreshold && !isInBackgroundSession { + let data = try multipartFormData.encode() + + uploadable = .data(data) + } else { + let tempDirectoryURL = fileManager.temporaryDirectory + let directoryURL = tempDirectoryURL.appendingPathComponent("org.alamofire.manager/multipart.form.data") + let fileName = UUID().uuidString + let fileURL = directoryURL.appendingPathComponent(fileName) + + try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil) + + do { + try multipartFormData.writeEncodedData(to: fileURL) + } catch { + // Cleanup after attempted write if it fails. + try? fileManager.removeItem(at: fileURL) + } + + uploadable = .file(fileURL, shouldRemove: true) + } + + return (request: urlRequest, uploadable: uploadable) + } +} + +extension MultipartUpload: UploadConvertible { + func asURLRequest() throws -> URLRequest { + return try result.get().request + } + + func createUploadable() throws -> UploadRequest.Uploadable { + return try result.get().uploadable + } +} diff --git a/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift b/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift index 5470eec..7a06bbe 100644 --- a/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +++ b/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift @@ -1,7 +1,7 @@ // // NetworkReachabilityManager.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal diff --git a/Example/Pods/Alamofire/Source/Notifications.swift b/Example/Pods/Alamofire/Source/Notifications.swift index e1ac31b..1e4ac34 100644 --- a/Example/Pods/Alamofire/Source/Notifications.swift +++ b/Example/Pods/Alamofire/Source/Notifications.swift @@ -1,7 +1,7 @@ // // Notifications.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,32 +24,92 @@ import Foundation -extension Notification.Name { - /// Used as a namespace for all `URLSessionTask` related notifications. - public struct Task { - /// Posted when a `URLSessionTask` is resumed. The notification `object` contains the resumed `URLSessionTask`. - public static let DidResume = Notification.Name(rawValue: "org.alamofire.notification.name.task.didResume") +public extension Request { + /// Posted when a `Request` is resumed. The `Notification` contains the resumed `Request`. + static let didResumeNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didResume") + /// Posted when a `Request` is suspended. The `Notification` contains the suspended `Request`. + static let didSuspendNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didSuspend") + /// Posted when a `Request` is cancelled. The `Notification` contains the cancelled `Request`. + static let didCancelNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancel") + /// Posted when a `Request` is finished. The `Notification` contains the completed `Request`. + static let didFinishNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didFinish") - /// Posted when a `URLSessionTask` is suspended. The notification `object` contains the suspended `URLSessionTask`. - public static let DidSuspend = Notification.Name(rawValue: "org.alamofire.notification.name.task.didSuspend") + /// Posted when a `URLSessionTask` is resumed. The `Notification` contains the `Request` associated with the `URLSessionTask`. + static let didResumeTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didResumeTask") + /// Posted when a `URLSessionTask` is suspended. The `Notification` contains the `Request` associated with the `URLSessionTask`. + static let didSuspendTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didSuspendTask") + /// Posted when a `URLSessionTask` is cancelled. The `Notification` contains the `Request` associated with the `URLSessionTask`. + static let didCancelTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancelTask") + /// Posted when a `URLSessionTask` is completed. The `Notification` contains the `Request` associated with the `URLSessionTask`. + static let didCompleteTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCompleteTask") +} + +// MARK: - - /// Posted when a `URLSessionTask` is cancelled. The notification `object` contains the cancelled `URLSessionTask`. - public static let DidCancel = Notification.Name(rawValue: "org.alamofire.notification.name.task.didCancel") +extension Notification { + /// The `Request` contained by the instance's `userInfo`, `nil` otherwise. + public var request: Request? { + return userInfo?[String.requestKey] as? Request + } - /// Posted when a `URLSessionTask` is completed. The notification `object` contains the completed `URLSessionTask`. - public static let DidComplete = Notification.Name(rawValue: "org.alamofire.notification.name.task.didComplete") + /// Convenience initializer for a `Notification` containing a `Request` payload. + /// + /// - Parameters: + /// - name: The name of the notification. + /// - request: The `Request` payload. + init(name: Notification.Name, request: Request) { + self.init(name: name, object: nil, userInfo: [String.requestKey: request]) } } -// MARK: - +extension NotificationCenter { + /// Convenience function for posting notifications with `Request` payloads. + /// + /// - Parameters: + /// - name: The name of the notification. + /// - request: The `Request` payload. + func postNotification(named name: Notification.Name, with request: Request) { + let notification = Notification(name: name, request: request) + post(notification) + } +} -extension Notification { - /// Used as a namespace for all `Notification` user info dictionary keys. - public struct Key { - /// User info dictionary key representing the `URLSessionTask` associated with the notification. - public static let Task = "org.alamofire.notification.key.task" +extension String { + /// User info dictionary key representing the `Request` associated with the notification. + fileprivate static let requestKey = "org.alamofire.notification.key.request" +} + +/// `EventMonitor` that provides Alamofire's notifications. +public final class AlamofireNotifications: EventMonitor { + public func requestDidResume(_ request: Request) { + NotificationCenter.default.postNotification(named: Request.didResumeNotification, with: request) + } + + public func requestDidSuspend(_ request: Request) { + NotificationCenter.default.postNotification(named: Request.didSuspendNotification, with: request) + } + + public func requestDidCancel(_ request: Request) { + NotificationCenter.default.postNotification(named: Request.didCancelNotification, with: request) + } + + public func requestDidFinish(_ request: Request) { + NotificationCenter.default.postNotification(named: Request.didFinishNotification, with: request) + } + + public func request(_ request: Request, didResumeTask task: URLSessionTask) { + NotificationCenter.default.postNotification(named: Request.didResumeTaskNotification, with: request) + } + + public func request(_ request: Request, didSuspendTask task: URLSessionTask) { + NotificationCenter.default.postNotification(named: Request.didSuspendTaskNotification, with: request) + } + + public func request(_ request: Request, didCancelTask task: URLSessionTask) { + NotificationCenter.default.postNotification(named: Request.didCancelTaskNotification, with: request) + } - /// User info dictionary key representing the responseData associated with the notification. - public static let ResponseData = "org.alamofire.notification.key.responseData" + public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: Error?) { + NotificationCenter.default.postNotification(named: Request.didCompleteTaskNotification, with: request) } } diff --git a/Example/Pods/ObjectMapper/Sources/DataTransform.swift b/Example/Pods/Alamofire/Source/OperationQueue+Alamofire.swift similarity index 60% rename from Example/Pods/ObjectMapper/Sources/DataTransform.swift rename to Example/Pods/Alamofire/Source/OperationQueue+Alamofire.swift index 87cb25c..be630f5 100644 --- a/Example/Pods/ObjectMapper/Sources/DataTransform.swift +++ b/Example/Pods/Alamofire/Source/OperationQueue+Alamofire.swift @@ -1,12 +1,7 @@ // -// DataTransform.swift -// ObjectMapper +// OperationQueue+Alamofire.swift // -// Created by Yagrushkin, Evgeny on 8/30/16. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -25,26 +20,21 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// import Foundation -open class DataTransform: TransformType { - public typealias Object = Data - public typealias JSON = String - - public init() {} - - open func transformFromJSON(_ value: Any?) -> Data? { - guard let string = value as? String else{ - return nil - } - return Data(base64Encoded: string) - } - - open func transformToJSON(_ value: Data?) -> String? { - guard let data = value else{ - return nil - } - return data.base64EncodedString() - } +extension OperationQueue { + convenience init(qualityOfService: QualityOfService = .default, + maxConcurrentOperationCount: Int = OperationQueue.defaultMaxConcurrentOperationCount, + underlyingQueue: DispatchQueue? = nil, + name: String? = nil, + startSuspended: Bool = false) { + self.init() + self.qualityOfService = qualityOfService + self.maxConcurrentOperationCount = maxConcurrentOperationCount + self.underlyingQueue = underlyingQueue + self.name = name + self.isSuspended = startSuspended + } } diff --git a/Example/Pods/Alamofire/Source/ParameterEncoder.swift b/Example/Pods/Alamofire/Source/ParameterEncoder.swift new file mode 100644 index 0000000..356feb9 --- /dev/null +++ b/Example/Pods/Alamofire/Source/ParameterEncoder.swift @@ -0,0 +1,813 @@ +// +// ParameterEncoder.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// A type that can encode any `Encodable` type into a `URLRequest`. +public protocol ParameterEncoder { + /// Encode the provided `Encodable` parameters into `request`. + /// + /// - Parameters: + /// - parameters: The `Encodable` parameter value. + /// - request: The `URLRequest` into which to encode the parameters. + /// - Returns: A `URLRequest` with the result of the encoding. + /// - Throws: An `Error` when encoding fails. For Alamofire provided encoders, this will be an instance of + /// `AFError.parameterEncoderFailed` with an associated `ParameterEncoderFailureReason`. + func encode(_ parameters: Parameters?, into request: URLRequest) throws -> URLRequest +} + +/// A `ParameterEncoder` that encodes types as JSON body data. +/// +/// If no `Content-Type` header is already set on the provided `URLRequest`s, it's set to `application/json`. +open class JSONParameterEncoder: ParameterEncoder { + /// Returns an encoder with default parameters. + public static var `default`: JSONParameterEncoder { return JSONParameterEncoder() } + + /// Returns an encoder with `JSONEncoder.outputFormatting` set to `.prettyPrinted`. + public static var prettyPrinted: JSONParameterEncoder { + let encoder = JSONEncoder() + encoder.outputFormatting = .prettyPrinted + + return JSONParameterEncoder(encoder: encoder) + } + + /// Returns an encoder with `JSONEncoder.outputFormatting` set to `.sortedKeys`. + @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) + public static var sortedKeys: JSONParameterEncoder { + let encoder = JSONEncoder() + encoder.outputFormatting = .sortedKeys + + return JSONParameterEncoder(encoder: encoder) + } + + /// `JSONEncoder` used to encode parameters. + public let encoder: JSONEncoder + + /// Creates an instance with the provided `JSONEncoder`. + /// + /// - Parameter encoder: The `JSONEncoder`. Defaults to `JSONEncoder()`. + public init(encoder: JSONEncoder = JSONEncoder()) { + self.encoder = encoder + } + + open func encode(_ parameters: Parameters?, + into request: URLRequest) throws -> URLRequest { + guard let parameters = parameters else { return request } + + var request = request + + do { + let data = try encoder.encode(parameters) + request.httpBody = data + if request.headers["Content-Type"] == nil { + request.headers.update(.contentType("application/json")) + } + } catch { + throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error)) + } + + return request + } +} + +/// A `ParameterEncoder` that encodes types as URL-encoded query strings to be set on the URL or as body data, depending +/// on the `Destination` set. +/// +/// If no `Content-Type` header is already set on the provided `URLRequest`s, it will be set to +/// `application/x-www-form-urlencoded; charset=utf-8`. +/// +/// There is no published specification for how to encode collection types. By default, the convention of appending +/// `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for +/// nested dictionary values (`foo[bar]=baz`) is used. Optionally, `ArrayEncoding` can be used to omit the +/// square brackets appended to array keys. +/// +/// `BoolEncoding` can be used to configure how boolean values are encoded. The default behavior is to encode +/// `true` as 1 and `false` as 0. +open class URLEncodedFormParameterEncoder: ParameterEncoder { + /// Defines where the URL-encoded string should be set for each `URLRequest`. + public enum Destination { + /// Applies the encoded query string to any existing query string for `.get`, `.head`, and `.delete` request. + /// Sets it to the `httpBody` for all other methods. + case methodDependent + /// Applies the encoded query string to any existing query string from the `URLRequest`. + case queryString + /// Applies the encoded query string to the `httpBody` of the `URLRequest`. + case httpBody + + /// Determines whether the URL-encoded string should be applied to the `URLRequest`'s `url`. + /// + /// - Parameter method: The `HTTPMethod`. + /// - Returns: Whether the URL-encoded string should be applied to a `URL`. + func encodesParametersInURL(for method: HTTPMethod) -> Bool { + switch self { + case .methodDependent: return [.get, .head, .delete].contains(method) + case .queryString: return true + case .httpBody: return false + } + } + } + + /// Returns an encoder with default parameters. + public static var `default`: URLEncodedFormParameterEncoder { return URLEncodedFormParameterEncoder() } + + /// The `URLEncodedFormEncoder` to use. + public let encoder: URLEncodedFormEncoder + + /// The `Destination` for the URL-encoded string. + public let destination: Destination + + /// Creates an instance with the provided `URLEncodedFormEncoder` instance and `Destination` value. + /// + /// - Parameters: + /// - encoder: The `URLEncodedFormEncoder`. Defaults to `URLEncodedFormEncoder()`. + /// - destination: The `Destination`. Defaults to `.methodDependent`. + public init(encoder: URLEncodedFormEncoder = URLEncodedFormEncoder(), destination: Destination = .methodDependent) { + self.encoder = encoder + self.destination = destination + } + + open func encode(_ parameters: Parameters?, + into request: URLRequest) throws -> URLRequest { + guard let parameters = parameters else { return request } + + var request = request + + guard let url = request.url else { + throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.url)) + } + + guard let rawMethod = request.httpMethod, let method = HTTPMethod(rawValue: rawMethod) else { + let rawValue = request.httpMethod ?? "nil" + throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.httpMethod(rawValue: rawValue))) + } + + if destination.encodesParametersInURL(for: method), + var components = URLComponents(url: url, resolvingAgainstBaseURL: false) { + let query: String = try AFResult { try encoder.encode(parameters) } + .mapError { AFError.parameterEncoderFailed(reason: .encoderFailed(error: $0)) }.get() + let newQueryString = [components.percentEncodedQuery, query].compactMap { $0 }.joinedWithAmpersands() + components.percentEncodedQuery = newQueryString + + guard let newURL = components.url else { + throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.url)) + } + + request.url = newURL + } else { + if request.headers["Content-Type"] == nil { + request.headers.update(.contentType("application/x-www-form-urlencoded; charset=utf-8")) + } + + request.httpBody = try AFResult { try encoder.encode(parameters) } + .mapError { AFError.parameterEncoderFailed(reason: .encoderFailed(error: $0)) }.get() + } + + return request + } +} + +/// An object that encodes instances into URL-encoded query strings. +/// +/// There is no published specification for how to encode collection types. By default, the convention of appending +/// `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for +/// nested dictionary values (`foo[bar]=baz`) is used. Optionally, `ArrayEncoding` can be used to omit the +/// square brackets appended to array keys. +/// +/// `BoolEncoding` can be used to configure how `Bool` values are encoded. The default behavior is to encode +/// `true` as 1 and `false` as 0. +/// +/// `SpaceEncoding` can be used to configure how spaces are encoded. Modern encodings use percent replacement (%20), +/// while older encoding may expect spaces to be replaced with +. +/// +/// This type is largely based on Vapor's [`url-encoded-form`](https://github.com/vapor/url-encoded-form) project. +public final class URLEncodedFormEncoder { + /// Configures how `Bool` parameters are encoded. + public enum BoolEncoding { + /// Encodes `true` as `1`, `false` as `0`. + case numeric + /// Encodes `true` as "true", `false` as "false". + case literal + + /// Encodes the given `Bool` as a `String`. + /// + /// - Parameter value: The `Bool` to encode. + /// - Returns: The encoded `String`. + func encode(_ value: Bool) -> String { + switch self { + case .numeric: return value ? "1" : "0" + case .literal: return value ? "true" : "false" + } + } + } + + /// Configures how `Array` parameters are encoded. + public enum ArrayEncoding { + /// An empty set of square brackets ("[]") are sppended to the key for every value. + case brackets + /// No brackets are appended to the key and the key is encoded as is. + case noBrackets + + func encode(_ key: String) -> String { + switch self { + case .brackets: return "\(key)[]" + case .noBrackets: return key + } + } + } + + /// Configures how spaces are encoded. + public enum SpaceEncoding { + /// Encodes spaces according to normal percent escaping rules (%20). + case percentEscaped + /// Encodes spaces as `+`, + case plusReplaced + + /// Encodes the string according to the encoding. + /// + /// - Parameter string: The `String` to encode. + /// - Returns: The encoded `String`. + func encode(_ string: String) -> String { + switch self { + case .percentEscaped: return string.replacingOccurrences(of: " ", with: "%20") + case .plusReplaced: return string.replacingOccurrences(of: " ", with: "+") + } + } + } + + /// `URLEncodedFormEncoder` error. + public enum Error: Swift.Error { + /// An invalid root object was created by the encoder. Only keyed values are valid. + case invalidRootObject(String) + + var localizedDescription: String { + switch self { + case let .invalidRootObject(object): return "URLEncodedFormEncoder requires keyed root object. Received \(object) instead." + } + } + } + + /// The `ArrayEncoding` to use. + public let arrayEncoding: ArrayEncoding + /// The `BoolEncoding` to use. + public let boolEncoding: BoolEncoding + /// The `SpaceEncoding` to use. + public let spaceEncoding: SpaceEncoding + /// The `CharacterSet` of allowed characters. + public var allowedCharacters: CharacterSet + + /// Creates an instance from the supplied parameters. + /// + /// - Parameters: + /// - arrayEncoding: The `ArrayEncoding` instance. Defaults to `.brackets`. + /// - boolEncoding: The `BoolEncoding` instance. Defaults to `.numeric`. + /// - spaceEncoding: The `SpaceEncoding` instance. Defaults to `.percentEscaped`. + /// - allowedCharacters: The `CharacterSet` of allowed (non-escaped) characters. Defaults to `.afURLQueryAllowed`. + public init(arrayEncoding: ArrayEncoding = .brackets, + boolEncoding: BoolEncoding = .numeric, + spaceEncoding: SpaceEncoding = .percentEscaped, + allowedCharacters: CharacterSet = .afURLQueryAllowed) { + self.arrayEncoding = arrayEncoding + self.boolEncoding = boolEncoding + self.spaceEncoding = spaceEncoding + self.allowedCharacters = allowedCharacters + } + + func encode(_ value: Encodable) throws -> URLEncodedFormComponent { + let context = URLEncodedFormContext(.object([:])) + let encoder = _URLEncodedFormEncoder(context: context, boolEncoding: boolEncoding) + try value.encode(to: encoder) + + return context.component + } + + /// Encodes the `value` as a URL form encoded `String`. + /// + /// - Parameter value: The `Encodable` value.` + /// - Returns: The encoded `String`. + /// - Throws: An `Error` or `EncodingError` instance if encoding fails. + public func encode(_ value: Encodable) throws -> String { + let component: URLEncodedFormComponent = try encode(value) + + guard case let .object(object) = component else { + throw Error.invalidRootObject("\(component)") + } + + let serializer = URLEncodedFormSerializer(arrayEncoding: arrayEncoding, + spaceEncoding: spaceEncoding, + allowedCharacters: allowedCharacters) + let query = serializer.serialize(object) + + return query + } + + /// Encodes the value as `Data`. This is performed by first creating an encoded `String` and then returning the + /// `.utf8` data. + /// + /// - Parameter value: The `Encodable` value. + /// - Returns: The encoded `Data`. + /// - Throws: An `Error` or `EncodingError` instance if encoding fails. + public func encode(_ value: Encodable) throws -> Data { + let string: String = try encode(value) + + return Data(string.utf8) + } +} + +final class _URLEncodedFormEncoder { + var codingPath: [CodingKey] + // Returns an empty dictionary, as this encoder doesn't support userInfo. + var userInfo: [CodingUserInfoKey : Any] { return [:] } + + let context: URLEncodedFormContext + + private let boolEncoding: URLEncodedFormEncoder.BoolEncoding + + public init(context: URLEncodedFormContext, + codingPath: [CodingKey] = [], + boolEncoding: URLEncodedFormEncoder.BoolEncoding) { + self.context = context + self.codingPath = codingPath + self.boolEncoding = boolEncoding + } +} + +extension _URLEncodedFormEncoder: Encoder { + func container(keyedBy type: Key.Type) -> KeyedEncodingContainer where Key : CodingKey { + let container = _URLEncodedFormEncoder.KeyedContainer(context: context, + codingPath: codingPath, + boolEncoding: boolEncoding) + return KeyedEncodingContainer(container) + } + + func unkeyedContainer() -> UnkeyedEncodingContainer { + return _URLEncodedFormEncoder.UnkeyedContainer(context: context, + codingPath: codingPath, + boolEncoding: boolEncoding) + } + + func singleValueContainer() -> SingleValueEncodingContainer { + return _URLEncodedFormEncoder.SingleValueContainer(context: context, + codingPath: codingPath, + boolEncoding: boolEncoding) + } +} + +final class URLEncodedFormContext { + var component: URLEncodedFormComponent + + init(_ component: URLEncodedFormComponent) { + self.component = component + } +} + +enum URLEncodedFormComponent { + case string(String) + case array([URLEncodedFormComponent]) + case object([String: URLEncodedFormComponent]) + + /// Converts self to an `[URLEncodedFormData]` or returns `nil` if not convertible. + var array: [URLEncodedFormComponent]? { + switch self { + case let .array(array): return array + default: return nil + } + } + + /// Converts self to an `[String: URLEncodedFormData]` or returns `nil` if not convertible. + var object: [String: URLEncodedFormComponent]? { + switch self { + case let .object(object): return object + default: return nil + } + } + + /// Sets self to the supplied value at a given path. + /// + /// data.set(to: "hello", at: ["path", "to", "value"]) + /// + /// - parameters: + /// - value: Value of `Self` to set at the supplied path. + /// - path: `CodingKey` path to update with the supplied value. + public mutating func set(to value: URLEncodedFormComponent, at path: [CodingKey]) { + set(&self, to: value, at: path) + } + + /// Recursive backing method to `set(to:at:)`. + private func set(_ context: inout URLEncodedFormComponent, to value: URLEncodedFormComponent, at path: [CodingKey]) { + guard path.count >= 1 else { + context = value + return + } + + let end = path[0] + var child: URLEncodedFormComponent + switch path.count { + case 1: + child = value + case 2...: + if let index = end.intValue { + let array = context.array ?? [] + if array.count > index { + child = array[index] + } else { + child = .array([]) + } + set(&child, to: value, at: Array(path[1...])) + } else { + child = context.object?[end.stringValue] ?? .object([:]) + set(&child, to: value, at: Array(path[1...])) + } + default: fatalError("Unreachable") + } + + if let index = end.intValue { + if var array = context.array { + if array.count > index { + array[index] = child + } else { + array.append(child) + } + context = .array(array) + } else { + context = .array([child]) + } + } else { + if var object = context.object { + object[end.stringValue] = child + context = .object(object) + } else { + context = .object([end.stringValue: child]) + } + } + } +} + +struct AnyCodingKey: CodingKey, Hashable { + let stringValue: String + let intValue: Int? + + init?(stringValue: String) { + self.stringValue = stringValue + intValue = nil + } + + init?(intValue: Int) { + stringValue = "\(intValue)" + self.intValue = intValue + } + + init(_ base: Key) where Key : CodingKey { + if let intValue = base.intValue { + self.init(intValue: intValue)! + } else { + self.init(stringValue: base.stringValue)! + } + } +} + +extension _URLEncodedFormEncoder { + final class KeyedContainer where Key: CodingKey { + var codingPath: [CodingKey] + + private let context: URLEncodedFormContext + private let boolEncoding: URLEncodedFormEncoder.BoolEncoding + + init(context: URLEncodedFormContext, + codingPath: [CodingKey], + boolEncoding: URLEncodedFormEncoder.BoolEncoding) { + self.context = context + self.codingPath = codingPath + self.boolEncoding = boolEncoding + } + + private func nestedCodingPath(for key: CodingKey) -> [CodingKey] { + return codingPath + [key] + } + } +} + +extension _URLEncodedFormEncoder.KeyedContainer: KeyedEncodingContainerProtocol { + func encodeNil(forKey key: Key) throws { + let context = EncodingError.Context(codingPath: codingPath, + debugDescription: "URLEncodedFormEncoder cannot encode nil values.") + throw EncodingError.invalidValue("\(key): nil", context) + } + + func encode(_ value: T, forKey key: Key) throws where T : Encodable { + var container = nestedSingleValueEncoder(for: key) + try container.encode(value) + } + + func nestedSingleValueEncoder(for key: Key) -> SingleValueEncodingContainer { + let container = _URLEncodedFormEncoder.SingleValueContainer(context: context, + codingPath: nestedCodingPath(for: key), + boolEncoding: boolEncoding) + + return container + } + + func nestedUnkeyedContainer(forKey key: Key) -> UnkeyedEncodingContainer { + let container = _URLEncodedFormEncoder.UnkeyedContainer(context: context, + codingPath: nestedCodingPath(for: key), + boolEncoding: boolEncoding) + + return container + } + + func nestedContainer(keyedBy keyType: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer where NestedKey : CodingKey { + let container = _URLEncodedFormEncoder.KeyedContainer(context: context, + codingPath: nestedCodingPath(for: key), + boolEncoding: boolEncoding) + + return KeyedEncodingContainer(container) + } + + func superEncoder() -> Encoder { + return _URLEncodedFormEncoder(context: context, codingPath: codingPath, boolEncoding: boolEncoding) + } + + func superEncoder(forKey key: Key) -> Encoder { + return _URLEncodedFormEncoder(context: context, codingPath: nestedCodingPath(for: key), boolEncoding: boolEncoding) + } +} + +extension _URLEncodedFormEncoder { + final class SingleValueContainer { + var codingPath: [CodingKey] + + private var canEncodeNewValue = true + + private let context: URLEncodedFormContext + private let boolEncoding: URLEncodedFormEncoder.BoolEncoding + + init(context: URLEncodedFormContext, codingPath: [CodingKey], boolEncoding: URLEncodedFormEncoder.BoolEncoding) { + self.context = context + self.codingPath = codingPath + self.boolEncoding = boolEncoding + } + + private func checkCanEncode(value: Any?) throws { + guard canEncodeNewValue else { + let context = EncodingError.Context(codingPath: codingPath, + debugDescription: "Attempt to encode value through single value container when previously value already encoded.") + throw EncodingError.invalidValue(value as Any, context) + } + } + } +} + +extension _URLEncodedFormEncoder.SingleValueContainer: SingleValueEncodingContainer { + func encodeNil() throws { + try checkCanEncode(value: nil) + defer { canEncodeNewValue = false } + + let context = EncodingError.Context(codingPath: codingPath, + debugDescription: "URLEncodedFormEncoder cannot encode nil values.") + throw EncodingError.invalidValue("nil", context) + } + + func encode(_ value: Bool) throws { + try encode(value, as: String(boolEncoding.encode(value))) + } + + func encode(_ value: String) throws { + try encode(value, as: value) + } + + func encode(_ value: Double) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: Float) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: Int) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: Int8) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: Int16) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: Int32) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: Int64) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: UInt) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: UInt8) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: UInt16) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: UInt32) throws { + try encode(value, as: String(value)) + } + + func encode(_ value: UInt64) throws { + try encode(value, as: String(value)) + } + + private func encode(_ value: T, as string: String) throws where T : Encodable { + try checkCanEncode(value: value) + defer { canEncodeNewValue = false } + + context.component.set(to: .string(string), at: codingPath) + } + + func encode(_ value: T) throws where T : Encodable { + try checkCanEncode(value: value) + defer { canEncodeNewValue = false } + + let encoder = _URLEncodedFormEncoder(context: context, + codingPath: codingPath, + boolEncoding: boolEncoding) + try value.encode(to: encoder) + } +} + +extension _URLEncodedFormEncoder { + final class UnkeyedContainer { + var codingPath: [CodingKey] + + var count = 0 + var nestedCodingPath: [CodingKey] { + return codingPath + [AnyCodingKey(intValue: count)!] + } + + private let context: URLEncodedFormContext + private let boolEncoding: URLEncodedFormEncoder.BoolEncoding + + init(context: URLEncodedFormContext, + codingPath: [CodingKey], + boolEncoding: URLEncodedFormEncoder.BoolEncoding) { + self.context = context + self.codingPath = codingPath + self.boolEncoding = boolEncoding + } + } +} + +extension _URLEncodedFormEncoder.UnkeyedContainer: UnkeyedEncodingContainer { + func encodeNil() throws { + let context = EncodingError.Context(codingPath: codingPath, + debugDescription: "URLEncodedFormEncoder cannot encode nil values.") + throw EncodingError.invalidValue("nil", context) + } + + func encode(_ value: T) throws where T : Encodable { + var container = nestedSingleValueContainer() + try container.encode(value) + } + + func nestedSingleValueContainer() -> SingleValueEncodingContainer { + defer { count += 1 } + + return _URLEncodedFormEncoder.SingleValueContainer(context: context, + codingPath: nestedCodingPath, + boolEncoding: boolEncoding) + } + + func nestedContainer(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer where NestedKey : CodingKey { + defer { count += 1 } + let container = _URLEncodedFormEncoder.KeyedContainer(context: context, + codingPath: nestedCodingPath, + boolEncoding: boolEncoding) + + return KeyedEncodingContainer(container) + } + + func nestedUnkeyedContainer() -> UnkeyedEncodingContainer { + defer { count += 1 } + + return _URLEncodedFormEncoder.UnkeyedContainer(context: context, + codingPath: nestedCodingPath, + boolEncoding: boolEncoding) + } + + func superEncoder() -> Encoder { + defer { count += 1 } + + return _URLEncodedFormEncoder(context: context, codingPath: codingPath, boolEncoding: boolEncoding) + } +} + +final class URLEncodedFormSerializer { + let arrayEncoding: URLEncodedFormEncoder.ArrayEncoding + let spaceEncoding: URLEncodedFormEncoder.SpaceEncoding + let allowedCharacters: CharacterSet + + init(arrayEncoding: URLEncodedFormEncoder.ArrayEncoding, + spaceEncoding: URLEncodedFormEncoder.SpaceEncoding, + allowedCharacters: CharacterSet) { + self.arrayEncoding = arrayEncoding + self.spaceEncoding = spaceEncoding + self.allowedCharacters = allowedCharacters + } + + func serialize(_ object: [String: URLEncodedFormComponent]) -> String { + var output: [String] = [] + for (key, component) in object { + let value = serialize(component, forKey: key) + output.append(value) + } + + return output.joinedWithAmpersands() + } + + func serialize(_ component: URLEncodedFormComponent, forKey key: String) -> String { + switch component { + case let .string(string): return "\(escape(key))=\(escape(string))" + case let .array(array): return serialize(array, forKey: key) + case let .object(dictionary): return serialize(dictionary, forKey: key) + } + } + + func serialize(_ object: [String: URLEncodedFormComponent], forKey key: String) -> String { + let segments: [String] = object.map { (subKey, value) in + let keyPath = "[\(subKey)]" + return serialize(value, forKey: key + keyPath) + } + + return segments.joinedWithAmpersands() + } + + func serialize(_ array: [URLEncodedFormComponent], forKey key: String) -> String { + let segments: [String] = array.map { (component) in + let keyPath = arrayEncoding.encode(key) + return serialize(component, forKey: keyPath) + } + + return segments.joinedWithAmpersands() + } + + func escape(_ query: String) -> String { + var allowedCharactersWithSpace = allowedCharacters + allowedCharactersWithSpace.insert(charactersIn: " ") + let escapedQuery = query.addingPercentEncoding(withAllowedCharacters: allowedCharactersWithSpace) ?? query + let spaceEncodedQuery = spaceEncoding.encode(escapedQuery) + + return spaceEncodedQuery + } +} + +extension Array where Element == String { + func joinedWithAmpersands() -> String { + return joined(separator: "&") + } +} + +extension CharacterSet { + /// Creates a CharacterSet from RFC 3986 allowed characters. + /// + /// RFC 3986 states that the following characters are "reserved" characters. + /// + /// - General Delimiters: ":", "#", "[", "]", "@", "?", "/" + /// - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" + /// + /// In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow + /// query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" + /// should be percent-escaped in the query string. + public static let afURLQueryAllowed: CharacterSet = { + let generalDelimitersToEncode = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4 + let subDelimitersToEncode = "!$&'()*+,;=" + let encodableDelimiters = CharacterSet(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)") + + return CharacterSet.urlQueryAllowed.subtracting(encodableDelimiters) + }() +} diff --git a/Example/Pods/Alamofire/Source/ParameterEncoding.swift b/Example/Pods/Alamofire/Source/ParameterEncoding.swift index 6195809..2e73049 100644 --- a/Example/Pods/Alamofire/Source/ParameterEncoding.swift +++ b/Example/Pods/Alamofire/Source/ParameterEncoding.swift @@ -1,7 +1,7 @@ // // ParameterEncoding.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,23 +24,6 @@ import Foundation -/// HTTP method definitions. -/// -/// See https://tools.ietf.org/html/rfc7231#section-4.3 -public enum HTTPMethod: String { - case options = "OPTIONS" - case get = "GET" - case head = "HEAD" - case post = "POST" - case put = "PUT" - case patch = "PATCH" - case delete = "DELETE" - case trace = "TRACE" - case connect = "CONNECT" -} - -// MARK: - - /// A dictionary of parameters to apply to a `URLRequest`. public typealias Parameters = [String: Any] @@ -86,6 +69,14 @@ public struct URLEncoding: ParameterEncoding { /// - httpBody: Sets encoded query string result as the HTTP body of the URL request. public enum Destination { case methodDependent, queryString, httpBody + + func encodesParametersInURL(for method: HTTPMethod) -> Bool { + switch self { + case .methodDependent: return [.get, .head, .delete].contains(method) + case .queryString: return true + case .httpBody: return false + } + } } /// Configures how `Array` parameters are encoded. @@ -125,12 +116,9 @@ public struct URLEncoding: ParameterEncoding { // MARK: Properties - /// Returns a default `URLEncoding` instance. + /// Returns a default `URLEncoding` instance with a `.methodDependent` destination. public static var `default`: URLEncoding { return URLEncoding() } - /// Returns a `URLEncoding` instance with a `.methodDependent` destination. - public static var methodDependent: URLEncoding { return URLEncoding() } - /// Returns a `URLEncoding` instance with a `.queryString` destination. public static var queryString: URLEncoding { return URLEncoding(destination: .queryString) } @@ -176,7 +164,7 @@ public struct URLEncoding: ParameterEncoding { guard let parameters = parameters else { return urlRequest } - if let method = HTTPMethod(rawValue: urlRequest.httpMethod ?? "GET"), encodesParametersInURL(with: method) { + if let method = urlRequest.method, destination.encodesParametersInURL(for: method) { guard let url = urlRequest.url else { throw AFError.parameterEncodingFailed(reason: .missingURL) } @@ -191,7 +179,7 @@ public struct URLEncoding: ParameterEncoding { urlRequest.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type") } - urlRequest.httpBody = query(parameters).data(using: .utf8, allowLossyConversion: false) + urlRequest.httpBody = Data(query(parameters).utf8) } return urlRequest @@ -231,58 +219,11 @@ public struct URLEncoding: ParameterEncoding { /// Returns a percent-escaped string following RFC 3986 for a query string key or value. /// - /// RFC 3986 states that the following characters are "reserved" characters. - /// - /// - General Delimiters: ":", "#", "[", "]", "@", "?", "/" - /// - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" - /// - /// In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow - /// query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" - /// should be percent-escaped in the query string. - /// /// - parameter string: The string to be percent-escaped. /// /// - returns: The percent-escaped string. public func escape(_ string: String) -> String { - let generalDelimitersToEncode = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4 - let subDelimitersToEncode = "!$&'()*+,;=" - - var allowedCharacterSet = CharacterSet.urlQueryAllowed - allowedCharacterSet.remove(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)") - - var escaped = "" - - //========================================================================================================== - // - // Batching is required for escaping due to an internal bug in iOS 8.1 and 8.2. Encoding more than a few - // hundred Chinese characters causes various malloc error crashes. To avoid this issue until iOS 8 is no - // longer supported, batching MUST be used for encoding. This introduces roughly a 20% overhead. For more - // info, please refer to: - // - // - https://github.com/Alamofire/Alamofire/issues/206 - // - //========================================================================================================== - - if #available(iOS 8.3, *) { - escaped = string.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? string - } else { - let batchSize = 50 - var index = string.startIndex - - while index != string.endIndex { - let startIndex = index - let endIndex = string.index(index, offsetBy: batchSize, limitedBy: string.endIndex) ?? string.endIndex - let range = startIndex.. String { @@ -294,24 +235,6 @@ public struct URLEncoding: ParameterEncoding { } return components.map { "\($0)=\($1)" }.joined(separator: "&") } - - private func encodesParametersInURL(with method: HTTPMethod) -> Bool { - switch destination { - case .queryString: - return true - case .httpBody: - return false - default: - break - } - - switch method { - case .get, .head, .delete: - return true - default: - return false - } - } } // MARK: - @@ -403,81 +326,6 @@ public struct JSONEncoding: ParameterEncoding { // MARK: - -/// Uses `PropertyListSerialization` to create a plist representation of the parameters object, according to the -/// associated format and write options values, which is set as the body of the request. The `Content-Type` HTTP header -/// field of an encoded request is set to `application/x-plist`. -public struct PropertyListEncoding: ParameterEncoding { - - // MARK: Properties - - /// Returns a default `PropertyListEncoding` instance. - public static var `default`: PropertyListEncoding { return PropertyListEncoding() } - - /// Returns a `PropertyListEncoding` instance with xml formatting and default writing options. - public static var xml: PropertyListEncoding { return PropertyListEncoding(format: .xml) } - - /// Returns a `PropertyListEncoding` instance with binary formatting and default writing options. - public static var binary: PropertyListEncoding { return PropertyListEncoding(format: .binary) } - - /// The property list serialization format. - public let format: PropertyListSerialization.PropertyListFormat - - /// The options for writing the parameters as plist data. - public let options: PropertyListSerialization.WriteOptions - - // MARK: Initialization - - /// Creates a `PropertyListEncoding` instance using the specified format and options. - /// - /// - parameter format: The property list serialization format. - /// - parameter options: The options for writing the parameters as plist data. - /// - /// - returns: The new `PropertyListEncoding` instance. - public init( - format: PropertyListSerialization.PropertyListFormat = .xml, - options: PropertyListSerialization.WriteOptions = 0) - { - self.format = format - self.options = options - } - - // MARK: Encoding - - /// Creates a URL request by encoding parameters and applying them onto an existing request. - /// - /// - parameter urlRequest: The request to have parameters applied. - /// - parameter parameters: The parameters to apply. - /// - /// - throws: An `Error` if the encoding process encounters an error. - /// - /// - returns: The encoded request. - public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { - var urlRequest = try urlRequest.asURLRequest() - - guard let parameters = parameters else { return urlRequest } - - do { - let data = try PropertyListSerialization.data( - fromPropertyList: parameters, - format: format, - options: options - ) - - if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { - urlRequest.setValue("application/x-plist", forHTTPHeaderField: "Content-Type") - } - - urlRequest.httpBody = data - } catch { - throw AFError.parameterEncodingFailed(reason: .propertyListEncodingFailed(error: error)) - } - - return urlRequest - } -} - -// MARK: - - extension NSNumber { fileprivate var isBool: Bool { return CFBooleanGetTypeID() == CFGetTypeID(self) } } diff --git a/Example/Pods/Alamofire/Source/Protector.swift b/Example/Pods/Alamofire/Source/Protector.swift new file mode 100644 index 0000000..c9c33e8 --- /dev/null +++ b/Example/Pods/Alamofire/Source/Protector.swift @@ -0,0 +1,153 @@ +// +// Protector.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +// MARK: - + +/// An `os_unfair_lock` wrapper. +final class UnfairLock { + private var unfairLock = os_unfair_lock() + + fileprivate func lock() { + os_unfair_lock_lock(&unfairLock) + } + + fileprivate func unlock() { + os_unfair_lock_unlock(&unfairLock) + } + + /// Executes a closure returning a value while acquiring the lock. + /// + /// - Parameter closure: The closure to run. + /// - Returns: The value the closure generated. + func around(_ closure: () -> T) -> T { + lock(); defer { unlock() } + return closure() + } + + /// Execute a closure while aquiring the lock. + /// + /// - Parameter closure: The closure to run. + func around(_ closure: () -> Void) { + lock(); defer { unlock() } + return closure() + } +} + +/// A thread-safe wrapper around a value. +final class Protector { + private let lock = UnfairLock() + private var value: T + + init(_ value: T) { + self.value = value + } + + /// The contained value. Unsafe for anything more than direct read or write. + var directValue: T { + get { return lock.around { value } } + set { lock.around { value = newValue } } + } + + /// Synchronously read or transform the contained value. + /// + /// - Parameter closure: The closure to execute. + /// - Returns: The return value of the closure passed. + func read(_ closure: (T) -> U) -> U { + return lock.around { closure(self.value) } + } + + /// Synchronously modify the protected value. + /// + /// - Parameter closure: The closure to execute. + /// - Returns: The modified value. + @discardableResult + func write(_ closure: (inout T) -> U) -> U { + return lock.around { closure(&self.value) } + } +} + +extension Protector where T: RangeReplaceableCollection { + /// Adds a new element to the end of this protected collection. + /// + /// - Parameter newElement: The `Element` to append. + func append(_ newElement: T.Element) { + write { (ward: inout T) in + ward.append(newElement) + } + } + + /// Adds the elements of a sequence to the end of this protected collection. + /// + /// - Parameter newElements: The `Sequence` to append. + func append(contentsOf newElements: S) where S.Element == T.Element { + write { (ward: inout T) in + ward.append(contentsOf: newElements) + } + } + + /// Add the elements of a collection to the end of the protected collection. + /// + /// - Parameter newElements: The `Collection` to append. + func append(contentsOf newElements: C) where C.Element == T.Element { + write { (ward: inout T) in + ward.append(contentsOf: newElements) + } + } +} + +extension Protector where T == Data? { + /// Adds the contents of a `Data` value to the end of the protected `Data`. + /// + /// - Parameter data: The `Data` to be appended. + func append(_ data: Data) { + write { (ward: inout T) in + ward?.append(data) + } + } +} + +extension Protector where T == Request.MutableState { + /// Attempts to transition to the passed `State`. + /// + /// - Parameter state: The `State` to attempt transition to. + /// - Returns: Whether the transtion occured. + func attemptToTransitionTo(_ state: Request.State) -> Bool { + return lock.around { + guard value.state.canTransitionTo(state) else { return false } + + value.state = state + + return true + } + } + + /// Perform a closure while locked with the provided `Request.State`. + /// + /// - Parameter perform: The closure to perform while locked. + func withState(perform: (Request.State) -> Void) { + lock.around { perform(value.state) } + } +} diff --git a/Example/Pods/Alamofire/Source/RedirectHandler.swift b/Example/Pods/Alamofire/Source/RedirectHandler.swift new file mode 100644 index 0000000..7cd8842 --- /dev/null +++ b/Example/Pods/Alamofire/Source/RedirectHandler.swift @@ -0,0 +1,96 @@ +// +// RedirectHandler.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// A type that handles how an HTTP redirect response from a remote server should be redirected to the new request. +public protocol RedirectHandler { + /// Determines how the HTTP redirect response should be redirected to the new request. + /// + /// The `completion` closure should be passed one of three possible options: + /// + /// 1. The new request specified by the redirect (this is the most common use case). + /// 2. A modified version of the new request (you may want to route it somewhere else). + /// 3. A `nil` value to deny the redirect request and return the body of the redirect response. + /// + /// - Parameters: + /// - task: The task whose request resulted in a redirect. + /// - request: The URL request object to the new location specified by the redirect response. + /// - response: The response containing the server's response to the original request. + /// - completion: The closure to execute containing the new request, a modified request, or `nil`. + func task(_ task: URLSessionTask, + willBeRedirectedTo request: URLRequest, + for response: HTTPURLResponse, + completion: @escaping (URLRequest?) -> Void) +} + +// MARK: - + +/// `Redirector` is a convenience `RedirectHandler` making it easy to follow, not follow, or modify a redirect. +public struct Redirector { + /// Defines the behavior of the `Redirector` type. + /// + /// - follow: Follows the redirect as defined in the response. + /// - doNotFollow: Does not follow the redirect defined in the response. + /// - modify: Modifies the redirect request defined in the response. + public enum Behavior { + case follow + case doNotFollow + case modify((URLSessionTask, URLRequest, HTTPURLResponse) -> URLRequest?) + } + + /// Returns a `Redirector` with a follow `Behavior`. + public static let follow = Redirector(behavior: .follow) + /// Returns a `Redirector` with a do not follow `Behavior`. + public static let doNotFollow = Redirector(behavior: .doNotFollow) + + /// The `Behavior` of the `Redirector`. + public let behavior: Behavior + + /// Creates a `Redirector` instance from the `Behavior`. + /// + /// - Parameter behavior: The `Behavior`. + public init(behavior: Behavior) { + self.behavior = behavior + } +} + +// MARK: - + +extension Redirector: RedirectHandler { + public func task(_ task: URLSessionTask, + willBeRedirectedTo request: URLRequest, + for response: HTTPURLResponse, + completion: @escaping (URLRequest?) -> Void) { + switch behavior { + case .follow: + completion(request) + case .doNotFollow: + completion(nil) + case .modify(let closure): + let request = closure(task, request, response) + completion(request) + } + } +} diff --git a/Example/Pods/Alamofire/Source/Request.swift b/Example/Pods/Alamofire/Source/Request.swift index a2efaa0..3116f57 100644 --- a/Example/Pods/Alamofire/Source/Request.swift +++ b/Example/Pods/Alamofire/Source/Request.swift @@ -1,7 +1,7 @@ // // Request.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,265 +24,698 @@ import Foundation -/// A type that can inspect and optionally adapt a `URLRequest` in some manner if necessary. -public protocol RequestAdapter { - /// Inspects and adapts the specified `URLRequest` in some manner if necessary and returns the result. +/// `Request` is the common superclass of all Alamofire request types and provides common state, delegate, and callback +/// handling. +public class Request { + /// State of the `Request`, with managed transitions between states set when calling `resume()`, `suspend()`, or + /// `cancel()` on the `Request`. /// - /// - parameter urlRequest: The URL request to adapt. + /// - initialized: Initial state of the `Request`. + /// - resumed: Set when `resume()` is called. Any tasks created for the `Request` will have `resume()` called on + /// them in this state. + /// - suspended: Set when `suspend()` is called. Any tasks created for the `Request` will have `suspend()` called on + /// them in this state. + /// - cancelled: Set when `cancel()` is called. Any tasks created for the `Request` will have `cancel()` called on + /// them. Unlike `resumed` or `suspended`, once in the `cancelled` state, the `Request` can no longer + /// transition to any other state. + /// - finished: Set when all response serialization completion closures have been cleared on the `Request` and + /// queued on their respective queues. + public enum State { + case initialized, resumed, suspended, cancelled, finished + + /// Determines whether `self` can be transitioned to `state`. + func canTransitionTo(_ state: State) -> Bool { + switch (self, state) { + case (.initialized, _): + return true + case (_, .initialized), (.cancelled, _), (.finished, _): + return false + case (.resumed, .cancelled), (.suspended, .cancelled), (.resumed, .suspended), (.suspended, .resumed): + return true + case (.suspended, .suspended), (.resumed, .resumed): + return false + case (_, .finished): + return true + } + } + } + + // MARK: - Initial State + + /// `UUID` prividing a unique identifier for the `Request`, used in the `Hashable` and `Equatable` conformances. + public let id: UUID + /// The serial queue for all internal async actions. + public let underlyingQueue: DispatchQueue + /// The queue used for all serialization actions. By default it's a serial queue that targets `underlyingQueue`. + public let serializationQueue: DispatchQueue + /// `EventMonitor` used for event callbacks. + public let eventMonitor: EventMonitor? + /// The `Request`'s interceptor. + public let interceptor: RequestInterceptor? + /// The `Request`'s delegate. + public private(set) weak var delegate: RequestDelegate? + + // MARK: - Updated State + + /// Type encapsulating all mutable state that may need to be accessed from anything other than the `underlyingQueue`. + struct MutableState { + /// State of the `Request`. + var state: State = .initialized + /// `ProgressHandler` and `DispatchQueue` provided for upload progress callbacks. + var uploadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? + /// `ProgressHandler` and `DispatchQueue` provided for download progress callbacks. + var downloadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? + /// `RetryHandler` provided for redirect responses. + var redirectHandler: RedirectHandler? + /// `CachedResponseHandler` provided to handle caching responses. + var cachedResponseHandler: CachedResponseHandler? + /// Response serialization closures that handle parsing responses. + var responseSerializers: [() -> Void] = [] + /// Response serialization completion closures executed once all response serialization is complete. + var responseSerializerCompletions: [() -> Void] = [] + /// Whether response serializer processing is finished. + var responseSerializerProcessingFinished = false + /// `URLCredential` used for authentication challenges. + var credential: URLCredential? + /// All `URLRequest`s created by Alamofire on behalf of the `Request`. + var requests: [URLRequest] = [] + /// All `URLSessionTask`s created by Alamofire on behalf of the `Request`. + var tasks: [URLSessionTask] = [] + /// All `URLSessionTaskMetrics` values gathered by Alamofire on behalf of the `Request`. Should correspond + /// exactly the the `tasks` created. + var metrics: [URLSessionTaskMetrics] = [] + /// Number of times any retriers provided retried the `Request`. + var retryCount = 0 + /// Final `Error` for the `Request`, whether from various internal Alamofire calls or as a result of a `task`. + var error: Error? + } + + /// Protected `MutableState` value that provides threadsafe access to state values. + fileprivate let protectedMutableState: Protector = Protector(MutableState()) + + /// `State` of the `Request`. + public var state: State { return protectedMutableState.directValue.state } + /// Returns whether `state` is `.initialized`. + public var isInitialized: Bool { return state == .initialized } + /// Returns whether `state is `.resumed`. + public var isResumed: Bool { return state == .resumed } + /// Returns whether `state` is `.suspended`. + public var isSuspended: Bool { return state == .suspended } + /// Returns whether `state` is `.cancelled`. + public var isCancelled: Bool { return state == .cancelled } + /// Returns whether `state` is `.finished`. + public var isFinished: Bool { return state == .finished } + + // Progress + + /// Closure type executed when monitoring the upload or download progress of a request. + public typealias ProgressHandler = (Progress) -> Void + + /// `Progress` of the upload of the body of the executed `URLRequest`. Reset to `0` if the `Request` is retried. + public let uploadProgress = Progress(totalUnitCount: 0) + /// `Progress` of the download of any response data. Reset to `0` if the `Request` is retried. + public let downloadProgress = Progress(totalUnitCount: 0) + /// `ProgressHandler` called when `uploadProgress` is updated, on the provided `DispatchQueue`. + fileprivate var uploadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? { + get { return protectedMutableState.directValue.uploadProgressHandler } + set { protectedMutableState.write { $0.uploadProgressHandler = newValue } } + } + /// `ProgressHandler` called when `downloadProgress` is updated, on the provided `DispatchQueue`. + fileprivate var downloadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? { + get { return protectedMutableState.directValue.downloadProgressHandler } + set { protectedMutableState.write { $0.downloadProgressHandler = newValue } } + } + + // Redirects + + public private(set) var redirectHandler: RedirectHandler? { + get { return protectedMutableState.directValue.redirectHandler } + set { protectedMutableState.write { $0.redirectHandler = newValue } } + } + + // Cached Responses + + public private(set) var cachedResponseHandler: CachedResponseHandler? { + get { return protectedMutableState.directValue.cachedResponseHandler } + set { protectedMutableState.write { $0.cachedResponseHandler = newValue } } + } + + // Credential + + /// `URLCredential` used for authentication challenges. Created by calling one of the `authenticate` methods. + public private(set) var credential: URLCredential? { + get { return protectedMutableState.directValue.credential } + set { protectedMutableState.write { $0.credential = newValue } } + } + + // Validators + + /// `Validator` callback closures that store the validation calls enqueued. + fileprivate var protectedValidators: Protector<[() -> Void]> = Protector([]) + + // Requests + + /// All `URLRequests` created on behalf of the `Request`, including original and adapted requests. + public var requests: [URLRequest] { return protectedMutableState.directValue.requests } + /// First `URLRequest` created on behalf of the `Request`. May not be the first one actually executed. + public var firstRequest: URLRequest? { return requests.first } + /// Last `URLRequest` created on behalf of the `Request`. + public var lastRequest: URLRequest? { return requests.last } + /// Current `URLRequest` created on behalf of the `Request`. + public var request: URLRequest? { return lastRequest } + + /// `URLRequest`s from all of the `URLSessionTask`s executed on behalf of the `Request`. + public var performedRequests: [URLRequest] { + return protectedMutableState.read { $0.tasks.compactMap { $0.currentRequest } } + } + + // Response + + /// `HTTPURLResponse` received from the server, if any. If the `Request` was retried, this is the response of the + /// last `URLSessionTask`. + public var response: HTTPURLResponse? { return lastTask?.response as? HTTPURLResponse } + + // Tasks + + /// All `URLSessionTask`s created on behalf of the `Request`. + public var tasks: [URLSessionTask] { return protectedMutableState.directValue.tasks } + /// First `URLSessionTask` created on behalf of the `Request`. + public var firstTask: URLSessionTask? { return tasks.first } + /// Last `URLSessionTask` crated on behalf of the `Request`. + public var lastTask: URLSessionTask? { return tasks.last } + /// Current `URLSessionTask` created on behalf of the `Request`. + public var task: URLSessionTask? { return lastTask } + + // Metrics + + /// All `URLSessionTaskMetrics` gathered on behalf of the `Request`. Should correspond to the `tasks` created. + public var allMetrics: [URLSessionTaskMetrics] { return protectedMutableState.directValue.metrics } + /// First `URLSessionTaskMetrics` gathered on behalf of the `Request`. + public var firstMetrics: URLSessionTaskMetrics? { return allMetrics.first } + /// Last `URLSessionTaskMetrics` gathered on behalf of the `Request`. + public var lastMetrics: URLSessionTaskMetrics? { return allMetrics.last } + /// Current `URLSessionTaskMetrics` gathered on behalf of the `Request`. + public var metrics: URLSessionTaskMetrics? { return lastMetrics } + + /// Number of times the `Request` has been retried. + public var retryCount: Int { return protectedMutableState.directValue.retryCount } + + /// `Error` returned from Alamofire internally, from the network request directly, or any validators executed. + fileprivate(set) public var error: Error? { + get { return protectedMutableState.directValue.error } + set { protectedMutableState.write { $0.error = newValue } } + } + + /// Default initializer for the `Request` superclass. /// - /// - throws: An `Error` if the adaptation encounters an error. + /// - Parameters: + /// - id: `UUID` used for the `Hashable` and `Equatable` implementations. Defaults to a random `UUID`. + /// - underlyingQueue: `DispatchQueue` on which all internal `Request` work is performed. + /// - serializationQueue: `DispatchQueue` on which all serialization work is performed. Targets the + /// `underlyingQueue` when created by a `SessionManager`. + /// - eventMonitor: `EventMonitor` used for event callbacks from internal `Request` actions. + /// - interceptor: `RequestInterceptor` used throughout the request lifecycle. + /// - delegate: `RequestDelegate` that provides an interface to actions not performed by the `Request`. + public init(id: UUID = UUID(), + underlyingQueue: DispatchQueue, + serializationQueue: DispatchQueue, + eventMonitor: EventMonitor?, + interceptor: RequestInterceptor?, + delegate: RequestDelegate) { + self.id = id + self.underlyingQueue = underlyingQueue + self.serializationQueue = serializationQueue + self.eventMonitor = eventMonitor + self.interceptor = interceptor + self.delegate = delegate + } + + // MARK: - Internal API + // Called from underlyingQueue. + + /// Called when a `URLRequest` has been created on behalf of the `Request`. /// - /// - returns: The adapted `URLRequest`. - func adapt(_ urlRequest: URLRequest) throws -> URLRequest -} + /// - Parameter request: `URLRequest` created. + func didCreateURLRequest(_ request: URLRequest) { + protectedMutableState.write { $0.requests.append(request) } -// MARK: - + eventMonitor?.request(self, didCreateURLRequest: request) + } -/// A closure executed when the `RequestRetrier` determines whether a `Request` should be retried or not. -public typealias RequestRetryCompletion = (_ shouldRetry: Bool, _ timeDelay: TimeInterval) -> Void + /// Called when initial `URLRequest` creation has failed, typically through a `URLRequestConvertible`. Triggers retry. + /// + /// - Parameter error: `Error` thrown from the failed creation. + func didFailToCreateURLRequest(with error: Error) { + self.error = error -/// A type that determines whether a request should be retried after being executed by the specified session manager -/// and encountering an error. -public protocol RequestRetrier { - /// Determines whether the `Request` should be retried by calling the `completion` closure. + eventMonitor?.request(self, didFailToCreateURLRequestWithError: error) + + retryOrFinish(error: error) + } + + /// Called when a `RequestAdapter` has successfully adapted a `URLRequest`. /// - /// This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs - /// to be retried. The one requirement is that the completion closure is called to ensure the request is properly - /// cleaned up after. + /// - Parameters: + /// - initialRequest: The `URLRequest` that was adapted. + /// - adaptedRequest: The `URLRequest` returned by the `RequestAdapter`. + func didAdaptInitialRequest(_ initialRequest: URLRequest, to adaptedRequest: URLRequest) { + protectedMutableState.write { $0.requests.append(adaptedRequest) } + + eventMonitor?.request(self, didAdaptInitialRequest: initialRequest, to: adaptedRequest) + } + + /// Called when a `RequestAdapter` fails to adapt a `URLRequest`. Triggers retry. /// - /// - parameter manager: The session manager the request was executed on. - /// - parameter request: The request that failed due to the encountered error. - /// - parameter error: The error encountered when executing the request. - /// - parameter completion: The completion closure to be executed when retry decision has been determined. - func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion) -} + /// - Parameters: + /// - request: The `URLRequest` the adapter was called with. + /// - error: The `Error` returned by the `RequestAdapter`. + func didFailToAdaptURLRequest(_ request: URLRequest, withError error: Error) { + self.error = error -// MARK: - + eventMonitor?.request(self, didFailToAdaptURLRequest: request, withError: error) -protocol TaskConvertible { - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask -} + retryOrFinish(error: error) + } -/// A dictionary of headers to apply to a `URLRequest`. -public typealias HTTPHeaders = [String: String] + /// Called when a `URLSessionTask` is created on behalf of the `Request`. + /// + /// - Parameter task: The `URLSessionTask` created. + func didCreateTask(_ task: URLSessionTask) { + protectedMutableState.write { $0.tasks.append(task) } -// MARK: - + eventMonitor?.request(self, didCreateTask: task) + } -/// Responsible for sending a request and receiving the response and associated data from the server, as well as -/// managing its underlying `URLSessionTask`. -open class Request { + /// Called when resumption is completed. + func didResume() { + eventMonitor?.requestDidResume(self) + } - // MARK: Helper Types + /// Called when a `URLSessionTask` is resumed on behalf of the instance. + func didResumeTask(_ task: URLSessionTask) { + eventMonitor?.request(self, didResumeTask: task) + } - /// A closure executed when monitoring upload or download progress of a request. - public typealias ProgressHandler = (Progress) -> Void + /// Called when suspension is completed. + func didSuspend() { + eventMonitor?.requestDidSuspend(self) + } - enum RequestTask { - case data(TaskConvertible?, URLSessionTask?) - case download(TaskConvertible?, URLSessionTask?) - case upload(TaskConvertible?, URLSessionTask?) - case stream(TaskConvertible?, URLSessionTask?) + /// Callend when a `URLSessionTask` is suspended on behalf of the instance. + func didSuspendTask(_ task: URLSessionTask) { + eventMonitor?.request(self, didSuspendTask: task) } - // MARK: Properties + /// Called when cancellation is completed, sets `error` to `AFError.explicitlyCancelled`. + func didCancel() { + error = AFError.explicitlyCancelled + + eventMonitor?.requestDidCancel(self) + } + + /// Called when a `URLSessionTask` is cancelled on behalf of the instance. + func didCancelTask(_ task: URLSessionTask) { + eventMonitor?.request(self, didCancelTask: task) + } + + /// Called when a `URLSessionTaskMetrics` value is gathered on behalf of the `Request`. + func didGatherMetrics(_ metrics: URLSessionTaskMetrics) { + protectedMutableState.write { $0.metrics.append(metrics) } + + eventMonitor?.request(self, didGatherMetrics: metrics) + } + + /// Called when a `URLSessionTask` fails before it is finished, typically during certificate pinning. + func didFailTask(_ task: URLSessionTask, earlyWithError error: Error) { + self.error = error + + // Task will still complete, so didCompleteTask(_:with:) will handle retry. + eventMonitor?.request(self, didFailTask: task, earlyWithError: error) + } + + /// Called when a `URLSessionTask` completes. All tasks will eventually call this method. + func didCompleteTask(_ task: URLSessionTask, with error: Error?) { + self.error = self.error ?? error + protectedValidators.directValue.forEach { $0() } + + eventMonitor?.request(self, didCompleteTask: task, with: error) + + retryOrFinish(error: self.error) + } + + /// Called when the `RequestDelegate` is going to retry this `Request`. Calls `reset()`. + func prepareForRetry() { + protectedMutableState.write { $0.retryCount += 1 } + + reset() + + eventMonitor?.requestIsRetrying(self) + } - /// The delegate for the underlying task. - open internal(set) var delegate: TaskDelegate { - get { - taskDelegateLock.lock() ; defer { taskDelegateLock.unlock() } - return taskDelegate + /// Called to trigger retry or finish this `Request`. + func retryOrFinish(error: Error?) { + guard let error = error, let delegate = delegate else { finish(); return } + + delegate.retryResult(for: self, dueTo: error) { retryResult in + switch retryResult { + case .doNotRetry, .doNotRetryWithError: + self.finish(error: retryResult.error) + case .retry, .retryWithDelay: + delegate.retryRequest(self, withDelay: retryResult.delay) + } } - set { - taskDelegateLock.lock() ; defer { taskDelegateLock.unlock() } - taskDelegate = newValue + } + + /// Finishes this `Request` and starts the response serializers. + func finish(error: Error? = nil) { + if let error = error { self.error = error } + + // Start response handlers + processNextResponseSerializer() + + eventMonitor?.requestDidFinish(self) + } + + /// Appends the response serialization closure to the `Request`. + func appendResponseSerializer(_ closure: @escaping () -> Void) { + protectedMutableState.write { mutableState in + mutableState.responseSerializers.append(closure) + + if mutableState.state == .finished { + mutableState.error = AFError.responseSerializationFailed(reason: .responseSerializerAddedAfterRequestFinished) + } + + if mutableState.responseSerializerProcessingFinished { + underlyingQueue.async { self.processNextResponseSerializer() } + } } } - /// The underlying task. - open var task: URLSessionTask? { return delegate.task } + /// Returns the next response serializer closure to execute if there's one left. + func nextResponseSerializer() -> (() -> Void)? { + var responseSerializer: (() -> Void)? - /// The session belonging to the underlying task. - public let session: URLSession + protectedMutableState.write { mutableState in + let responseSerializerIndex = mutableState.responseSerializerCompletions.count - /// The request sent or to be sent to the server. - open var request: URLRequest? { return task?.originalRequest } + if responseSerializerIndex < mutableState.responseSerializers.count { + responseSerializer = mutableState.responseSerializers[responseSerializerIndex] + } + } - /// The response received from the server, if any. - open var response: HTTPURLResponse? { return task?.response as? HTTPURLResponse } + return responseSerializer + } - /// The number of times the request has been retried. - open internal(set) var retryCount: UInt = 0 + /// Processes the next response serializer and calls all completions if response serialization is complete. + func processNextResponseSerializer() { + guard let responseSerializer = nextResponseSerializer() else { + // Execute all response serializer completions and clear them + var completions: [() -> Void] = [] - let originalTask: TaskConvertible? + protectedMutableState.write { mutableState in + completions = mutableState.responseSerializerCompletions - var startTime: CFAbsoluteTime? - var endTime: CFAbsoluteTime? + // Clear out all response serializers and response serializer completions in mutable state since the + // request is complete. It's important to do this prior to calling the completion closures in case + // the completions call back into the request triggering a re-processing of the response serializers. + // An example of how this can happen is by calling cancel inside a response completion closure. + mutableState.responseSerializers.removeAll() + mutableState.responseSerializerCompletions.removeAll() - var validations: [() -> Void] = [] + if mutableState.state.canTransitionTo(.finished) { + mutableState.state = .finished + } - private var taskDelegate: TaskDelegate - private var taskDelegateLock = NSLock() + mutableState.responseSerializerProcessingFinished = true + } - // MARK: Lifecycle + completions.forEach { $0() } - init(session: URLSession, requestTask: RequestTask, error: Error? = nil) { - self.session = session + // Cleanup the request + cleanup() - switch requestTask { - case .data(let originalTask, let task): - taskDelegate = DataTaskDelegate(task: task) - self.originalTask = originalTask - case .download(let originalTask, let task): - taskDelegate = DownloadTaskDelegate(task: task) - self.originalTask = originalTask - case .upload(let originalTask, let task): - taskDelegate = UploadTaskDelegate(task: task) - self.originalTask = originalTask - case .stream(let originalTask, let task): - taskDelegate = TaskDelegate(task: task) - self.originalTask = originalTask + return } - delegate.error = error - delegate.queue.addOperation { self.endTime = CFAbsoluteTimeGetCurrent() } + serializationQueue.async { responseSerializer() } } - // MARK: Authentication + /// Notifies the `Request` that the response serializer is complete. + func responseSerializerDidComplete(completion: @escaping () -> Void) { + protectedMutableState.write { $0.responseSerializerCompletions.append(completion) } + processNextResponseSerializer() + } + + /// Resets all task and response serializer related state for retry. + func reset() { + error = nil + + uploadProgress.totalUnitCount = 0 + uploadProgress.completedUnitCount = 0 + downloadProgress.totalUnitCount = 0 + downloadProgress.completedUnitCount = 0 + + protectedMutableState.write { $0.responseSerializerCompletions = [] } + } + + /// Called when updating the upload progress. + func updateUploadProgress(totalBytesSent: Int64, totalBytesExpectedToSend: Int64) { + uploadProgress.totalUnitCount = totalBytesExpectedToSend + uploadProgress.completedUnitCount = totalBytesSent - /// Associates an HTTP Basic credential with the request. + uploadProgressHandler?.queue.async { self.uploadProgressHandler?.handler(self.uploadProgress) } + } + + /// Perform a closure on the current `state` while locked. /// - /// - parameter user: The user. - /// - parameter password: The password. - /// - parameter persistence: The URL credential persistence. `.ForSession` by default. + /// - Parameter perform: The closure to perform. + func withState(perform: (State) -> Void) { + protectedMutableState.withState(perform: perform) + } + + // MARK: Task Creation + + /// Called when creating a `URLSessionTask` for this `Request`. Subclasses must override. + func task(for request: URLRequest, using session: URLSession) -> URLSessionTask { + fatalError("Subclasses must override.") + } + + // MARK: - Public API + + // These APIs are callable from any queue. + + // MARK: - State + + /// Cancels the `Request`. Once cancelled, a `Request` can no longer be resumed or suspended. /// - /// - returns: The request. + /// - Returns: The `Request`. @discardableResult - open func authenticate( - user: String, - password: String, - persistence: URLCredential.Persistence = .forSession) - -> Self - { - let credential = URLCredential(user: user, password: password, persistence: persistence) - return authenticate(usingCredential: credential) + public func cancel() -> Self { + protectedMutableState.write { (mutableState) in + guard mutableState.state.canTransitionTo(.cancelled) else { return } + + mutableState.state = .cancelled + + underlyingQueue.async { self.didCancel() } + + guard let task = mutableState.tasks.last, task.state != .completed else { + underlyingQueue.async { self.finish() } + return + } + + task.cancel() + underlyingQueue.async { self.didCancelTask(task) } + } + + return self } - /// Associates a specified credential with the request. + /// Suspends the `Request`. /// - /// - parameter credential: The credential. + /// - Returns: The `Request`. + @discardableResult + public func suspend() -> Self { + protectedMutableState.write { (mutableState) in + guard mutableState.state.canTransitionTo(.suspended) else { return } + + mutableState.state = .suspended + + underlyingQueue.async { self.didSuspend() } + + guard let task = mutableState.tasks.last, task.state != .completed else { return } + + task.suspend() + underlyingQueue.async { self.didSuspendTask(task) } + } + + return self + } + + + /// Resumes the `Request`. /// - /// - returns: The request. + /// - Returns: The `Request`. @discardableResult - open func authenticate(usingCredential credential: URLCredential) -> Self { - delegate.credential = credential + public func resume() -> Self { + protectedMutableState.write { (mutableState) in + guard mutableState.state.canTransitionTo(.resumed) else { return } + + mutableState.state = .resumed + + underlyingQueue.async { self.didResume() } + + guard let task = mutableState.tasks.last, task.state != .completed else { return } + + task.resume() + underlyingQueue.async { self.didResumeTask(task) } + } + return self } - /// Returns a base64 encoded basic authentication credential as an authorization header tuple. + // MARK: - Closure API + + /// Associates a credential using the provided values with the `Request`. /// - /// - parameter user: The user. - /// - parameter password: The password. + /// - Parameters: + /// - username: The username. + /// - password: The password. + /// - persistence: The `URLCredential.Persistence` for the created `URLCredential`. + /// - Returns: The `Request`. + @discardableResult + public func authenticate(username: String, password: String, persistence: URLCredential.Persistence = .forSession) -> Self { + let credential = URLCredential(user: username, password: password, persistence: persistence) + + return authenticate(with: credential) + } + + /// Associates the provided credential with the `Request`. /// - /// - returns: A tuple with Authorization header and credential value if encoding succeeds, `nil` otherwise. - open class func authorizationHeader(user: String, password: String) -> (key: String, value: String)? { - guard let data = "\(user):\(password)".data(using: .utf8) else { return nil } + /// - Parameter credential: The `URLCredential`. + /// - Returns: The `Request`. + @discardableResult + public func authenticate(with credential: URLCredential) -> Self { + protectedMutableState.write { $0.credential = credential } + + return self + } - let credential = data.base64EncodedString(options: []) + /// Sets a closure to be called periodically during the lifecycle of the `Request` as data is read from the server. + /// + /// Only the last closure provided is used. + /// + /// - Parameters: + /// - queue: The `DispatchQueue` to execute the closure on. Defaults to `.main`. + /// - closure: The code to be executed periodically as data is read from the server. + /// - Returns: The `Request`. + @discardableResult + public func downloadProgress(queue: DispatchQueue = .main, closure: @escaping ProgressHandler) -> Self { + protectedMutableState.write { $0.downloadProgressHandler = (handler: closure, queue: queue) } - return (key: "Authorization", value: "Basic \(credential)") + return self } - // MARK: State + /// Sets a closure to be called periodically during the lifecycle of the `Request` as data is sent to the server. + /// + /// Only the last closure provided is used. + /// + /// - Parameters: + /// - queue: The `DispatchQueue` to execute the closure on. Defaults to `.main`. + /// - closure: The closure to be executed periodically as data is sent to the server. + /// - Returns: The `Request`. + @discardableResult + public func uploadProgress(queue: DispatchQueue = .main, closure: @escaping ProgressHandler) -> Self { + protectedMutableState.write { $0.uploadProgressHandler = (handler: closure, queue: queue) } - /// Resumes the request. - open func resume() { - guard let task = task else { delegate.queue.isSuspended = false ; return } + return self + } - if startTime == nil { startTime = CFAbsoluteTimeGetCurrent() } + // MARK: - Redirects - task.resume() + /// Sets the redirect handler for the `Request` which will be used if a redirect response is encountered. + /// + /// - Parameter handler: The `RedirectHandler`. + /// - Returns: The `Request`. + @discardableResult + public func redirect(using handler: RedirectHandler) -> Self { + protectedMutableState.write { mutableState in + precondition(mutableState.redirectHandler == nil, "Redirect handler has already been set") + mutableState.redirectHandler = handler + } - NotificationCenter.default.post( - name: Notification.Name.Task.DidResume, - object: self, - userInfo: [Notification.Key.Task: task] - ) + return self } - /// Suspends the request. - open func suspend() { - guard let task = task else { return } + // MARK: - Cached Responses - task.suspend() + /// Sets the cached response handler for the `Request` which will be used when attempting to cache a response. + /// + /// - Parameter handler: The `CachedResponseHandler`. + /// - Returns: The `Request`. + @discardableResult + public func cacheResponse(using handler: CachedResponseHandler) -> Self { + protectedMutableState.write { mutableState in + precondition(mutableState.cachedResponseHandler == nil, "Cached response handler has already been set") + mutableState.cachedResponseHandler = handler + } - NotificationCenter.default.post( - name: Notification.Name.Task.DidSuspend, - object: self, - userInfo: [Notification.Key.Task: task] - ) + return self } - /// Cancels the request. - open func cancel() { - guard let task = task else { return } - - task.cancel() + // MARK: - Cleanup - NotificationCenter.default.post( - name: Notification.Name.Task.DidCancel, - object: self, - userInfo: [Notification.Key.Task: task] - ) + /// Final cleanup step executed when a `Request` finishes response serialization. + open func cleanup() { + // No-op: override in subclass } } -// MARK: - CustomStringConvertible +// MARK: - Protocol Conformances -extension Request: CustomStringConvertible { - /// The textual representation used when written to an output stream, which includes the HTTP method and URL, as - /// well as the response status code if a response has been received. - open var description: String { - var components: [String] = [] +extension Request: Equatable { + public static func == (lhs: Request, rhs: Request) -> Bool { + return lhs.id == rhs.id + } +} - if let HTTPMethod = request?.httpMethod { - components.append(HTTPMethod) - } +extension Request: Hashable { + public func hash(into hasher: inout Hasher) { + hasher.combine(id) + } +} - if let urlString = request?.url?.absoluteString { - components.append(urlString) - } +extension Request: CustomStringConvertible { + /// A textual representation of this instance, including the `HTTPMethod` and `URL` if the `URLRequest` has been + /// created, as well as the response status code, if a response has been received. + public var description: String { + guard let request = performedRequests.last ?? lastRequest, + let url = request.url, + let method = request.httpMethod else { return "No request created yet." } - if let response = response { - components.append("(\(response.statusCode))") - } + let requestDescription = "\(method) \(url.absoluteString)" - return components.joined(separator: " ") + return response.map { "\(requestDescription) (\($0.statusCode))" } ?? requestDescription } } -// MARK: - CustomDebugStringConvertible - extension Request: CustomDebugStringConvertible { - /// The textual representation used when written to an output stream, in the form of a cURL command. - open var debugDescription: String { + /// A textual representation of this instance in the form of a cURL command. + public var debugDescription: String { return cURLRepresentation() } func cURLRepresentation() -> String { + guard + let request = lastRequest, + let url = request.url, + let host = url.host, + let method = request.httpMethod else { return "$ curl command could not be created" } + var components = ["$ curl -v"] - guard let request = self.request, - let url = request.url, - let host = url.host - else { - return "$ curl command could not be created" - } + components.append("-X \(method)") - if let httpMethod = request.httpMethod, httpMethod != "GET" { - components.append("-X \(httpMethod)") - } - - if let credentialStorage = self.session.configuration.urlCredentialStorage { + if let credentialStorage = delegate?.sessionConfiguration.urlCredentialStorage { let protectionSpace = URLProtectionSpace( host: host, port: url.port ?? 0, @@ -297,39 +730,40 @@ extension Request: CustomDebugStringConvertible { components.append("-u \(user):\(password)") } } else { - if let credential = delegate.credential, let user = credential.user, let password = credential.password { + if let credential = credential, let user = credential.user, let password = credential.password { components.append("-u \(user):\(password)") } } } - if session.configuration.httpShouldSetCookies { + if let configuration = delegate?.sessionConfiguration, configuration.httpShouldSetCookies { if - let cookieStorage = session.configuration.httpCookieStorage, + let cookieStorage = configuration.httpCookieStorage, let cookies = cookieStorage.cookies(for: url), !cookies.isEmpty { - let string = cookies.reduce("") { $0 + "\($1.name)=\($1.value);" } + let allCookies = cookies.map { "\($0.name)=\($0.value)" }.joined(separator: ";") - #if swift(>=3.2) - components.append("-b \"\(string[.. Void) + func retryRequest(_ request: Request, withDelay timeDelay: TimeInterval?) +} - // MARK: Helper Types +// MARK: - Subclasses - struct Requestable: TaskConvertible { - let urlRequest: URLRequest +// MARK: DataRequest - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { - do { - let urlRequest = try self.urlRequest.adapt(using: adapter) - return queue.sync { session.dataTask(with: urlRequest) } - } catch { - throw AdaptError(error: error) - } - } +public class DataRequest: Request { + public let convertible: URLRequestConvertible + + private var protectedData: Protector = Protector(nil) + public var data: Data? { return protectedData.directValue } + + init(id: UUID = UUID(), + convertible: URLRequestConvertible, + underlyingQueue: DispatchQueue, + serializationQueue: DispatchQueue, + eventMonitor: EventMonitor?, + interceptor: RequestInterceptor?, + delegate: RequestDelegate) { + self.convertible = convertible + + super.init(id: id, + underlyingQueue: underlyingQueue, + serializationQueue: serializationQueue, + eventMonitor: eventMonitor, + interceptor: interceptor, + delegate: delegate) } - // MARK: Properties + override func reset() { + super.reset() - /// The request sent or to be sent to the server. - open override var request: URLRequest? { - if let request = super.request { return request } - if let requestable = originalTask as? Requestable { return requestable.urlRequest } + protectedData.directValue = nil + } + + func didReceive(data: Data) { + if self.data == nil { + protectedData.directValue = data + } else { + protectedData.append(data) + } - return nil + updateDownloadProgress() } - /// The progress of fetching the response data from the server for the request. - open var progress: Progress { return dataDelegate.progress } + override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask { + let copiedRequest = request + return session.dataTask(with: copiedRequest) + } - var dataDelegate: DataTaskDelegate { return delegate as! DataTaskDelegate } + func updateDownloadProgress() { + let totalBytesRecieved = Int64(data?.count ?? 0) + let totalBytesExpected = task?.response?.expectedContentLength ?? NSURLSessionTransferSizeUnknown - // MARK: Stream + downloadProgress.totalUnitCount = totalBytesExpected + downloadProgress.completedUnitCount = totalBytesRecieved - /// Sets a closure to be called periodically during the lifecycle of the request as data is read from the server. + downloadProgressHandler?.queue.async { self.downloadProgressHandler?.handler(self.downloadProgress) } + } + + /// Validates the request, using the specified closure. /// - /// This closure returns the bytes most recently received from the server, not including data from previous calls. - /// If this closure is set, data will only be available within this closure, and will not be saved elsewhere. It is - /// also important to note that the server data in any `Response` object will be `nil`. + /// If validation fails, subsequent calls to response handlers will have an associated error. /// - /// - parameter closure: The code to be executed periodically during the lifecycle of the request. + /// - parameter validation: A closure to validate the request. /// /// - returns: The request. @discardableResult - open func stream(closure: ((Data) -> Void)? = nil) -> Self { - dataDelegate.dataStream = closure - return self - } + public func validate(_ validation: @escaping Validation) -> Self { + let validator: () -> Void = { [unowned self] in + guard self.error == nil, let response = self.response else { return } - // MARK: Progress + let result = validation(self.request, response, self.data) - /// Sets a closure to be called periodically during the lifecycle of the `Request` as data is read from the server. - /// - /// - parameter queue: The dispatch queue to execute the closure on. - /// - parameter closure: The code to be executed periodically as data is read from the server. - /// - /// - returns: The request. - @discardableResult - open func downloadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self { - dataDelegate.progressHandler = (closure, queue) - return self - } -} + if case .failure(let error) = result { self.error = error } -// MARK: - + self.eventMonitor?.request(self, + didValidateRequest: self.request, + response: response, + data: self.data, + withResult: result) + } -/// Specific type of `Request` that manages an underlying `URLSessionDownloadTask`. -open class DownloadRequest: Request { + protectedValidators.append(validator) - // MARK: Helper Types + return self + } +} +public class DownloadRequest: Request { /// A collection of options to be executed prior to moving a downloaded file from the temporary URL to the /// destination URL. - public struct DownloadOptions: OptionSet { - /// Returns the raw bitmask value of the option and satisfies the `RawRepresentable` protocol. - public let rawValue: UInt - + public struct Options: OptionSet { /// A `DownloadOptions` flag that creates intermediate directories for the destination URL if specified. - public static let createIntermediateDirectories = DownloadOptions(rawValue: 1 << 0) + public static let createIntermediateDirectories = Options(rawValue: 1 << 0) /// A `DownloadOptions` flag that removes a previous file from the destination URL if specified. - public static let removePreviousFile = DownloadOptions(rawValue: 1 << 1) + public static let removePreviousFile = Options(rawValue: 1 << 1) + + /// Returns the raw bitmask value of the option and satisfies the `RawRepresentable` protocol. + public let rawValue: Int - /// Creates a `DownloadFileDestinationOptions` instance with the specified raw value. + /// Creates a `DownloadRequest.Options` instance with the specified raw value. /// /// - parameter rawValue: The raw bitmask value for the option. /// - /// - returns: A new log level instance. - public init(rawValue: UInt) { + /// - returns: A new `DownloadRequest.Options` instance. + public init(rawValue: Int) { self.rawValue = rawValue } } @@ -445,205 +901,256 @@ open class DownloadRequest: Request { /// temporary file written to during the download process. The closure takes two arguments: the temporary file URL /// and the URL response, and returns a two arguments: the file URL where the temporary file should be moved and /// the options defining how the file should be moved. - public typealias DownloadFileDestination = ( - _ temporaryURL: URL, - _ response: HTTPURLResponse) - -> (destinationURL: URL, options: DownloadOptions) - - enum Downloadable: TaskConvertible { - case request(URLRequest) - case resumeData(Data) + public typealias Destination = (_ temporaryURL: URL, + _ response: HTTPURLResponse) -> (destinationURL: URL, options: Options) - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { - do { - let task: URLSessionTask + // MARK: Destination - switch self { - case let .request(urlRequest): - let urlRequest = try urlRequest.adapt(using: adapter) - task = queue.sync { session.downloadTask(with: urlRequest) } - case let .resumeData(resumeData): - task = queue.sync { session.downloadTask(withResumeData: resumeData) } - } + /// Creates a download file destination closure which uses the default file manager to move the temporary file to a + /// file URL in the first available directory with the specified search path directory and search path domain mask. + /// + /// - parameter directory: The search path directory. `.documentDirectory` by default. + /// - parameter domain: The search path domain mask. `.userDomainMask` by default. + /// + /// - returns: A download file destination closure. + public class func suggestedDownloadDestination(for directory: FileManager.SearchPathDirectory = .documentDirectory, + in domain: FileManager.SearchPathDomainMask = .userDomainMask, + options: Options = []) -> Destination { + return { temporaryURL, response in + let directoryURLs = FileManager.default.urls(for: directory, in: domain) + let url = directoryURLs.first?.appendingPathComponent(response.suggestedFilename!) ?? temporaryURL - return task - } catch { - throw AdaptError(error: error) - } + return (url, options) } } - // MARK: Properties + static let defaultDestination: Destination = { (url, _) in + let filename = "Alamofire_\(url.lastPathComponent)" + let destination = url.deletingLastPathComponent().appendingPathComponent(filename) - /// The request sent or to be sent to the server. - open override var request: URLRequest? { - if let request = super.request { return request } + return (destination, []) + } - if let downloadable = originalTask as? Downloadable, case let .request(urlRequest) = downloadable { - return urlRequest - } + public enum Downloadable { + case request(URLRequestConvertible) + case resumeData(Data) + } + + // MARK: Initial State + public let downloadable: Downloadable + let destination: Destination? + + // MARK: Updated State - return nil + private struct DownloadRequestMutableState { + var resumeData: Data? + var fileURL: URL? } - /// The resume data of the underlying download task if available after a failure. - open var resumeData: Data? { return downloadDelegate.resumeData } + private let protectedDownloadMutableState: Protector = Protector(DownloadRequestMutableState()) + + public var resumeData: Data? { return protectedDownloadMutableState.directValue.resumeData } + public var fileURL: URL? { return protectedDownloadMutableState.directValue.fileURL } + + // MARK: Init + + init(id: UUID = UUID(), + downloadable: Downloadable, + underlyingQueue: DispatchQueue, + serializationQueue: DispatchQueue, + eventMonitor: EventMonitor?, + interceptor: RequestInterceptor?, + delegate: RequestDelegate, + destination: Destination? = nil) { + self.downloadable = downloadable + self.destination = destination + + super.init(id: id, + underlyingQueue: underlyingQueue, + serializationQueue: serializationQueue, + eventMonitor: eventMonitor, + interceptor: interceptor, + delegate: delegate) + } + + override func reset() { + super.reset() - /// The progress of downloading the response data from the server for the request. - open var progress: Progress { return downloadDelegate.progress } + protectedDownloadMutableState.write { $0.resumeData = nil } + protectedDownloadMutableState.write { $0.fileURL = nil } + } - var downloadDelegate: DownloadTaskDelegate { return delegate as! DownloadTaskDelegate } + func didFinishDownloading(using task: URLSessionTask, with result: AFResult) { + eventMonitor?.request(self, didFinishDownloadingUsing: task, with: result) - // MARK: State + switch result { + case .success(let url): protectedDownloadMutableState.write { $0.fileURL = url } + case .failure(let error): self.error = error + } + } - /// Cancels the request. - open override func cancel() { - downloadDelegate.downloadTask.cancel { self.downloadDelegate.resumeData = $0 } + func updateDownloadProgress(bytesWritten: Int64, totalBytesExpectedToWrite: Int64) { + downloadProgress.totalUnitCount = totalBytesExpectedToWrite + downloadProgress.completedUnitCount += bytesWritten - NotificationCenter.default.post( - name: Notification.Name.Task.DidCancel, - object: self, - userInfo: [Notification.Key.Task: task as Any] - ) + downloadProgressHandler?.queue.async { self.downloadProgressHandler?.handler(self.downloadProgress) } } - // MARK: Progress + override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask { + return session.downloadTask(with: request) + } + + public func task(forResumeData data: Data, using session: URLSession) -> URLSessionTask { + return session.downloadTask(withResumeData: data) + } - /// Sets a closure to be called periodically during the lifecycle of the `Request` as data is read from the server. - /// - /// - parameter queue: The dispatch queue to execute the closure on. - /// - parameter closure: The code to be executed periodically as data is read from the server. - /// - /// - returns: The request. @discardableResult - open func downloadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self { - downloadDelegate.progressHandler = (closure, queue) + public override func cancel() -> Self { + protectedMutableState.write { (mutableState) in + guard mutableState.state.canTransitionTo(.cancelled) else { return } + + mutableState.state = .cancelled + + underlyingQueue.async { self.didCancel() } + + guard let task = mutableState.tasks.last as? URLSessionDownloadTask, task.state != .completed else { + underlyingQueue.async { self.finish() } + return + } + + task.cancel { (resumeData) in + self.protectedDownloadMutableState.write { $0.resumeData = resumeData } + self.underlyingQueue.async { self.didCancelTask(task) } + } + } + return self } - // MARK: Destination - - /// Creates a download file destination closure which uses the default file manager to move the temporary file to a - /// file URL in the first available directory with the specified search path directory and search path domain mask. + /// Validates the request, using the specified closure. /// - /// - parameter directory: The search path directory. `.DocumentDirectory` by default. - /// - parameter domain: The search path domain mask. `.UserDomainMask` by default. + /// If validation fails, subsequent calls to response handlers will have an associated error. /// - /// - returns: A download file destination closure. - open class func suggestedDownloadDestination( - for directory: FileManager.SearchPathDirectory = .documentDirectory, - in domain: FileManager.SearchPathDomainMask = .userDomainMask) - -> DownloadFileDestination - { - return { temporaryURL, response in - let directoryURLs = FileManager.default.urls(for: directory, in: domain) + /// - parameter validation: A closure to validate the request. + /// + /// - returns: The request. + @discardableResult + public func validate(_ validation: @escaping Validation) -> Self { + let validator: () -> Void = { [unowned self] in + guard self.error == nil, let response = self.response else { return } - if !directoryURLs.isEmpty { - return (directoryURLs[0].appendingPathComponent(response.suggestedFilename!), []) - } + let result = validation(self.request, response, self.fileURL) - return (temporaryURL, []) + if case .failure(let error) = result { self.error = error } + + self.eventMonitor?.request(self, + didValidateRequest: self.request, + response: response, + fileURL: self.fileURL, + withResult: result) } + + protectedValidators.append(validator) + + return self } } -// MARK: - +public class UploadRequest: DataRequest { + public enum Uploadable { + case data(Data) + case file(URL, shouldRemove: Bool) + case stream(InputStream) + } -/// Specific type of `Request` that manages an underlying `URLSessionUploadTask`. -open class UploadRequest: DataRequest { + // MARK: - Initial State - // MARK: Helper Types + public let upload: UploadableConvertible - enum Uploadable: TaskConvertible { - case data(Data, URLRequest) - case file(URL, URLRequest) - case stream(InputStream, URLRequest) + // MARK: - Updated State - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { - do { - let task: URLSessionTask + public var uploadable: Uploadable? - switch self { - case let .data(data, urlRequest): - let urlRequest = try urlRequest.adapt(using: adapter) - task = queue.sync { session.uploadTask(with: urlRequest, from: data) } - case let .file(url, urlRequest): - let urlRequest = try urlRequest.adapt(using: adapter) - task = queue.sync { session.uploadTask(with: urlRequest, fromFile: url) } - case let .stream(_, urlRequest): - let urlRequest = try urlRequest.adapt(using: adapter) - task = queue.sync { session.uploadTask(withStreamedRequest: urlRequest) } - } + init(id: UUID = UUID(), + convertible: UploadConvertible, + underlyingQueue: DispatchQueue, + serializationQueue: DispatchQueue, + eventMonitor: EventMonitor?, + interceptor: RequestInterceptor?, + delegate: RequestDelegate) { + self.upload = convertible - return task - } catch { - throw AdaptError(error: error) - } - } + super.init(id: id, + convertible: convertible, + underlyingQueue: underlyingQueue, + serializationQueue: serializationQueue, + eventMonitor: eventMonitor, + interceptor: interceptor, + delegate: delegate) + } + + func didCreateUploadable(_ uploadable: Uploadable) { + self.uploadable = uploadable + + eventMonitor?.request(self, didCreateUploadable: uploadable) } - // MARK: Properties + func didFailToCreateUploadable(with error: Error) { + self.error = error + + eventMonitor?.request(self, didFailToCreateUploadableWithError: error) - /// The request sent or to be sent to the server. - open override var request: URLRequest? { - if let request = super.request { return request } + retryOrFinish(error: error) + } - guard let uploadable = originalTask as? Uploadable else { return nil } + override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask { + guard let uploadable = uploadable else { + fatalError("Attempting to create a URLSessionUploadTask when Uploadable value doesn't exist.") + } switch uploadable { - case .data(_, let urlRequest), .file(_, let urlRequest), .stream(_, let urlRequest): - return urlRequest + case let .data(data): return session.uploadTask(with: request, from: data) + case let .file(url, _): return session.uploadTask(with: request, fromFile: url) + case .stream: return session.uploadTask(withStreamedRequest: request) } } - /// The progress of uploading the payload to the server for the upload request. - open var uploadProgress: Progress { return uploadDelegate.uploadProgress } + func inputStream() -> InputStream { + guard let uploadable = uploadable else { + fatalError("Attempting to access the input stream but the uploadable doesn't exist.") + } - var uploadDelegate: UploadTaskDelegate { return delegate as! UploadTaskDelegate } + guard case let .stream(stream) = uploadable else { + fatalError("Attempted to access the stream of an UploadRequest that wasn't created with one.") + } - // MARK: Upload Progress + eventMonitor?.request(self, didProvideInputStream: stream) - /// Sets a closure to be called periodically during the lifecycle of the `UploadRequest` as data is sent to - /// the server. - /// - /// After the data is sent to the server, the `progress(queue:closure:)` APIs can be used to monitor the progress - /// of data being read from the server. - /// - /// - parameter queue: The dispatch queue to execute the closure on. - /// - parameter closure: The code to be executed periodically as data is sent to the server. - /// - /// - returns: The request. - @discardableResult - open func uploadProgress(queue: DispatchQueue = DispatchQueue.main, closure: @escaping ProgressHandler) -> Self { - uploadDelegate.uploadProgressHandler = (closure, queue) - return self + return stream } -} - -// MARK: - -#if !os(watchOS) + public override func cleanup() { + super.cleanup() -/// Specific type of `Request` that manages an underlying `URLSessionStreamTask`. -@available(iOS 9.0, macOS 10.11, tvOS 9.0, *) -open class StreamRequest: Request { - enum Streamable: TaskConvertible { - case stream(hostName: String, port: Int) - case netService(NetService) + guard + let uploadable = self.uploadable, + case let .file(url, shouldRemove) = uploadable, + shouldRemove + else { return } - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { - let task: URLSessionTask + // TODO: Abstract file manager + try? FileManager.default.removeItem(at: url) + } +} - switch self { - case let .stream(hostName, port): - task = queue.sync { session.streamTask(withHostName: hostName, port: port) } - case let .netService(netService): - task = queue.sync { session.streamTask(with: netService) } - } +public protocol UploadableConvertible { + func createUploadable() throws -> UploadRequest.Uploadable +} - return task - } +extension UploadRequest.Uploadable: UploadableConvertible { + public func createUploadable() throws -> UploadRequest.Uploadable { + return self } } -#endif +public protocol UploadConvertible: UploadableConvertible & URLRequestConvertible { } diff --git a/Example/Pods/Alamofire/Source/RequestInterceptor.swift b/Example/Pods/Alamofire/Source/RequestInterceptor.swift new file mode 100644 index 0000000..76366e1 --- /dev/null +++ b/Example/Pods/Alamofire/Source/RequestInterceptor.swift @@ -0,0 +1,219 @@ +// +// RequestInterceptor.swift +// +// Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// A type that can inspect and optionally adapt a `URLRequest` in some manner if necessary. +public protocol RequestAdapter { + /// Inspects and adapts the specified `URLRequest` in some manner and calls the completion handler with the AFResult. + /// + /// - Parameters: + /// - urlRequest: The `URLRequest` to adapt. + /// - session: The `Session` that will execute the `URLRequest`. + /// - completion: The completion handler that must be called when adaptation is complete. + func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (AFResult) -> Void) +} + +// MARK: - + +public enum RetryResult { + case retry + case retryWithDelay(TimeInterval) + case doNotRetry + case doNotRetryWithError(Error) +} + +extension RetryResult { + var retryRequired: Bool { + switch self { + case .retry, .retryWithDelay: return true + default: return false + } + } + + var delay: TimeInterval? { + switch self { + case .retryWithDelay(let delay): return delay + default: return nil + } + } + + var error: Error? { + guard case .doNotRetryWithError(let error) = self else { return nil } + return error + } +} + +/// A type that determines whether a request should be retried after being executed by the specified session manager +/// and encountering an error. +public protocol RequestRetrier { + /// Determines whether the `Request` should be retried by calling the `completion` closure. + /// + /// This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs + /// to be retried. The one requirement is that the completion closure is called to ensure the request is properly + /// cleaned up after. + /// + /// - parameter request: The `Request` that failed due to the encountered error. + /// - parameter session: The `Session` the request was executed on. + /// - parameter error: The `Error` encountered when executing the request. + /// - parameter completion: The completion closure to be executed when retry decision has been determined. + func retry(_ request: Request, for session: Session, dueTo error: Error, completion: @escaping (RetryResult) -> Void) +} + +// MARK: - + +/// A type that intercepts requests to potentially adapt and retry them. +public protocol RequestInterceptor: RequestAdapter, RequestRetrier {} + +extension RequestInterceptor { + public func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (AFResult) -> Void) { + completion(.success(urlRequest)) + } + + public func retry( + _ request: Request, + for session: Session, + dueTo error: Error, + completion: @escaping (RetryResult) -> Void) + { + completion(.doNotRetry) + } +} + +public typealias AdaptHandler = (URLRequest, Session, _ completion: @escaping (AFResult) -> Void) -> Void +public typealias RetryHandler = (Request, Session, Error, _ completion: @escaping (RetryResult) -> Void) -> Void + +// MARK: - + +open class Adapter: RequestInterceptor { + private let adaptHandler: AdaptHandler + + public init(_ adaptHandler: @escaping AdaptHandler) { + self.adaptHandler = adaptHandler + } + + open func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (AFResult) -> Void) { + adaptHandler(urlRequest, session, completion) + } +} + +// MARK: - + +open class Retrier: RequestInterceptor { + private let retryHandler: RetryHandler + + public init(_ retryHandler: @escaping RetryHandler) { + self.retryHandler = retryHandler + } + + open func retry( + _ request: Request, + for session: Session, + dueTo error: Error, + completion: @escaping (RetryResult) -> Void) + { + retryHandler(request, session, error, completion) + } +} + +// MARK: - + +open class Interceptor: RequestInterceptor { + public let adapters: [RequestAdapter] + public let retriers: [RequestRetrier] + + public init(adaptHandler: @escaping AdaptHandler, retryHandler: @escaping RetryHandler) { + self.adapters = [Adapter(adaptHandler)] + self.retriers = [Retrier(retryHandler)] + } + + public init(adapter: RequestAdapter, retrier: RequestRetrier) { + self.adapters = [adapter] + self.retriers = [retrier] + } + + public init(adapters: [RequestAdapter] = [], retriers: [RequestRetrier] = []) { + self.adapters = adapters + self.retriers = retriers + } + + open func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (AFResult) -> Void) { + adapt(urlRequest, for: session, using: adapters, completion: completion) + } + + private func adapt( + _ urlRequest: URLRequest, + for session: Session, + using adapters: [RequestAdapter], + completion: @escaping (AFResult) -> Void) + { + var pendingAdapters = adapters + + guard !pendingAdapters.isEmpty else { completion(.success(urlRequest)); return } + + let adapter = pendingAdapters.removeFirst() + + adapter.adapt(urlRequest, for: session) { result in + switch result { + case .success(let urlRequest): + self.adapt(urlRequest, for: session, using: pendingAdapters, completion: completion) + case .failure: + completion(result) + } + } + } + + open func retry( + _ request: Request, + for session: Session, + dueTo error: Error, + completion: @escaping (RetryResult) -> Void) + { + retry(request, for: session, dueTo: error, using: retriers, completion: completion) + } + + private func retry( + _ request: Request, + for session: Session, + dueTo error: Error, + using retriers: [RequestRetrier], + completion: @escaping (RetryResult) -> Void) + { + var pendingRetriers = retriers + + guard !pendingRetriers.isEmpty else { completion(.doNotRetry); return } + + let retrier = pendingRetriers.removeFirst() + + retrier.retry(request, for: session, dueTo: error) { result in + switch result { + case .retry, .retryWithDelay, .doNotRetryWithError: + completion(result) + case .doNotRetry: + // Only continue to the next retrier if retry was not triggered and no error was encountered + self.retry(request, for: session, dueTo: error, using: pendingRetriers, completion: completion) + } + } + } +} diff --git a/Example/Pods/Alamofire/Source/RequestTaskMap.swift b/Example/Pods/Alamofire/Source/RequestTaskMap.swift new file mode 100644 index 0000000..8d4f33d --- /dev/null +++ b/Example/Pods/Alamofire/Source/RequestTaskMap.swift @@ -0,0 +1,136 @@ +// +// RequestTaskMap.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// A type that maintains a two way, one to one map of `URLSessionTask`s to `Request`s. +struct RequestTaskMap { + private var tasksToRequests: [URLSessionTask: Request] + private var requestsToTasks: [Request: URLSessionTask] + private var taskEvents: [URLSessionTask: (completed: Bool, metricsGathered: Bool)] + + var requests: [Request] { + return Array(tasksToRequests.values) + } + + init(tasksToRequests: [URLSessionTask: Request] = [:], + requestsToTasks: [Request: URLSessionTask] = [:], + taskEvents: [URLSessionTask: (completed: Bool, metricsGathered: Bool)] = [:]) { + self.tasksToRequests = tasksToRequests + self.requestsToTasks = requestsToTasks + self.taskEvents = taskEvents + } + + subscript(_ request: Request) -> URLSessionTask? { + get { return requestsToTasks[request] } + set { + guard let newValue = newValue else { + guard let task = requestsToTasks[request] else { + fatalError("RequestTaskMap consistency error: no task corresponding to request found.") + } + + requestsToTasks.removeValue(forKey: request) + tasksToRequests.removeValue(forKey: task) + taskEvents.removeValue(forKey: task) + + return + } + + requestsToTasks[request] = newValue + tasksToRequests[newValue] = request + taskEvents[newValue] = (completed: false, metricsGathered: false) + } + } + + subscript(_ task: URLSessionTask) -> Request? { + get { return tasksToRequests[task] } + set { + guard let newValue = newValue else { + guard let request = tasksToRequests[task] else { + fatalError("RequestTaskMap consistency error: no request corresponding to task found.") + } + + tasksToRequests.removeValue(forKey: task) + requestsToTasks.removeValue(forKey: request) + taskEvents.removeValue(forKey: task) + + return + } + + tasksToRequests[task] = newValue + requestsToTasks[newValue] = task + taskEvents[task] = (completed: false, metricsGathered: false) + } + } + + var count: Int { + precondition(tasksToRequests.count == requestsToTasks.count, + "RequestTaskMap.count invalid, requests.count: \(tasksToRequests.count) != tasks.count: \(requestsToTasks.count)") + + return tasksToRequests.count + } + + var eventCount: Int { + precondition(taskEvents.count == count, "RequestTaskMap.eventCount invalid, count: \(count) != taskEvents.count: \(taskEvents.count)") + + return taskEvents.count + } + + var isEmpty: Bool { + precondition(tasksToRequests.isEmpty == requestsToTasks.isEmpty, + "RequestTaskMap.isEmpty invalid, requests.isEmpty: \(tasksToRequests.isEmpty) != tasks.isEmpty: \(requestsToTasks.isEmpty)") + + return tasksToRequests.isEmpty + } + + var isEventsEmpty: Bool { + precondition(taskEvents.isEmpty == isEmpty, "RequestTaskMap.isEventsEmpty invalid, isEmpty: \(isEmpty) != taskEvents.isEmpty: \(taskEvents.isEmpty)") + + return taskEvents.isEmpty + } + + mutating func disassociateIfNecessaryAfterGatheringMetricsForTask(_ task: URLSessionTask) { + guard let events = taskEvents[task] else { + fatalError("RequestTaskMap consistency error: no events corresponding to task found.") + } + + switch (events.completed, events.metricsGathered) { + case (_, true): fatalError("RequestTaskMap consistency error: duplicate metricsGatheredForTask call.") + case (false, false): taskEvents[task] = (completed: false, metricsGathered: true) + case (true, false): self[task] = nil + } + } + + mutating func disassociateIfNecessaryAfterCompletingTask(_ task: URLSessionTask) { + guard let events = taskEvents[task] else { + fatalError("RequestTaskMap consistency error: no events corresponding to task found.") + } + + switch (events.completed, events.metricsGathered) { + case (true, _): fatalError("RequestTaskMap consistency error: duplicate completionReceivedForTask call.") + case (false, false): taskEvents[task] = (completed: true, metricsGathered: false) + case (false, true): self[task] = nil + } + } +} diff --git a/Example/Pods/Alamofire/Source/Response.swift b/Example/Pods/Alamofire/Source/Response.swift index 747a471..91d3d4d 100644 --- a/Example/Pods/Alamofire/Source/Response.swift +++ b/Example/Pods/Alamofire/Source/Response.swift @@ -1,7 +1,7 @@ // // Response.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,52 +24,6 @@ import Foundation -/// Used to store all data associated with an non-serialized response of a data or upload request. -public struct DefaultDataResponse { - /// The URL request sent to the server. - public let request: URLRequest? - - /// The server's response to the URL request. - public let response: HTTPURLResponse? - - /// The data returned by the server. - public let data: Data? - - /// The error encountered while executing or validating the request. - public let error: Error? - - /// The timeline of the complete lifecycle of the request. - public let timeline: Timeline - - var _metrics: AnyObject? - - /// Creates a `DefaultDataResponse` instance from the specified parameters. - /// - /// - Parameters: - /// - request: The URL request sent to the server. - /// - response: The server's response to the URL request. - /// - data: The data returned by the server. - /// - error: The error encountered while executing or validating the request. - /// - timeline: The timeline of the complete lifecycle of the request. `Timeline()` by default. - /// - metrics: The task metrics containing the request / response statistics. `nil` by default. - public init( - request: URLRequest?, - response: HTTPURLResponse?, - data: Data?, - error: Error?, - timeline: Timeline = Timeline(), - metrics: AnyObject? = nil) - { - self.request = request - self.response = response - self.data = data - self.error = error - self.timeline = timeline - } -} - -// MARK: - - /// Used to store all data associated with a serialized response of a data or upload request. public struct DataResponse { /// The URL request sent to the server. @@ -81,11 +35,14 @@ public struct DataResponse { /// The data returned by the server. public let data: Data? - /// The result of response serialization. - public let result: Result + /// The final metrics of the response. + public let metrics: URLSessionTaskMetrics? - /// The timeline of the complete lifecycle of the request. - public let timeline: Timeline + /// The time taken to serialize the response. + public let serializationDuration: TimeInterval + + /// The result of response serialization. + public let result: AFResult /// Returns the associated value of the result if it is a success, `nil` otherwise. public var value: Value? { return result.value } @@ -93,29 +50,27 @@ public struct DataResponse { /// Returns the associated error value if the result if it is a failure, `nil` otherwise. public var error: Error? { return result.error } - var _metrics: AnyObject? - - /// Creates a `DataResponse` instance with the specified parameters derived from response serialization. + /// Creates a `DataResponse` instance with the specified parameters derviced from the response serialization. /// - /// - parameter request: The URL request sent to the server. - /// - parameter response: The server's response to the URL request. - /// - parameter data: The data returned by the server. - /// - parameter result: The result of response serialization. - /// - parameter timeline: The timeline of the complete lifecycle of the `Request`. Defaults to `Timeline()`. - /// - /// - returns: The new `DataResponse` instance. - public init( - request: URLRequest?, - response: HTTPURLResponse?, - data: Data?, - result: Result, - timeline: Timeline = Timeline()) - { + /// - Parameters: + /// - request: The `URLRequest` sent to the server. + /// - response: The `HTTPURLResponse` from the server. + /// - data: The `Data` returned by the server. + /// - metrics: The `URLSessionTaskMetrics` of the serialized response. + /// - serializationDuration: The duration taken by serialization. + /// - result: The `AFResult` of response serialization. + public init(request: URLRequest?, + response: HTTPURLResponse?, + data: Data?, + metrics: URLSessionTaskMetrics?, + serializationDuration: TimeInterval, + result: AFResult) { self.request = request self.response = response self.data = data + self.metrics = metrics + self.serializationDuration = serializationDuration self.result = result - self.timeline = timeline } } @@ -125,21 +80,37 @@ extension DataResponse: CustomStringConvertible, CustomDebugStringConvertible { /// The textual representation used when written to an output stream, which includes whether the result was a /// success or failure. public var description: String { - return result.debugDescription + return "\(result)" } /// The debug textual representation used when written to an output stream, which includes the URL request, the URL - /// response, the server data, the response serialization result and the timeline. + /// response, the server data, the duration of the network and serializatino actions, and the response serialization + /// result. public var debugDescription: String { - var output: [String] = [] - - output.append(request != nil ? "[Request]: \(request!.httpMethod ?? "GET") \(request!)" : "[Request]: nil") - output.append(response != nil ? "[Response]: \(response!)" : "[Response]: nil") - output.append("[Data]: \(data?.count ?? 0) bytes") - output.append("[Result]: \(result.debugDescription)") - output.append("[Timeline]: \(timeline.debugDescription)") - - return output.joined(separator: "\n") + let requestDescription = request.map { "\($0.httpMethod!) \($0)" } ?? "nil" + let requestBody = request?.httpBody.map { String(decoding: $0, as: UTF8.self) } ?? "None" + let responseDescription = response.map { (response) in + let sortedHeaders = response.headers.sorted() + + return """ + [Status Code]: \(response.statusCode) + [Headers]: + \(sortedHeaders) + """ + } ?? "nil" + let responseBody = data.map { String(decoding: $0, as: UTF8.self) } ?? "None" + let metricsDescription = metrics.map { "\($0.taskInterval.duration)s" } ?? "None" + + return """ + [Request]: \(requestDescription) + [Request Body]: \n\(requestBody) + [Response]: \n\(responseDescription) + [Response Body]: \n\(responseBody) + [Data]: \(data?.description ?? "None") + [Network Duration]: \(metricsDescription) + [Serialization Duration]: \(serializationDuration)s + [Result]: \(result) + """ } } @@ -159,17 +130,12 @@ extension DataResponse { /// - returns: A `DataResponse` whose result wraps the value returned by the given closure. If this instance's /// result is a failure, returns a response wrapping the same failure. public func map(_ transform: (Value) -> T) -> DataResponse { - var response = DataResponse( - request: request, - response: self.response, - data: data, - result: result.map(transform), - timeline: timeline - ) - - response._metrics = _metrics - - return response + return DataResponse(request: request, + response: self.response, + data: data, + metrics: metrics, + serializationDuration: serializationDuration, + result: result.map(transform)) } /// Evaluates the given closure when the result of this `DataResponse` is a success, passing the unwrapped result @@ -187,17 +153,12 @@ extension DataResponse { /// - returns: A success or failure `DataResponse` depending on the result of the given closure. If this instance's /// result is a failure, returns the same failure. public func flatMap(_ transform: (Value) throws -> T) -> DataResponse { - var response = DataResponse( - request: request, - response: self.response, - data: data, - result: result.flatMap(transform), - timeline: timeline - ) - - response._metrics = _metrics - - return response + return DataResponse(request: request, + response: self.response, + data: data, + metrics: metrics, + serializationDuration: serializationDuration, + result: result.flatMap(transform)) } /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter. @@ -210,17 +171,12 @@ extension DataResponse { /// - Parameter transform: A closure that takes the error of the instance. /// - Returns: A `DataResponse` instance containing the result of the transform. public func mapError(_ transform: (Error) -> E) -> DataResponse { - var response = DataResponse( - request: request, - response: self.response, - data: data, - result: result.mapError(transform), - timeline: timeline - ) - - response._metrics = _metrics - - return response + return DataResponse(request: request, + response: self.response, + data: data, + metrics: metrics, + serializationDuration: serializationDuration, + result: result.mapError(transform)) } /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter. @@ -236,75 +192,12 @@ extension DataResponse { /// /// - Returns: A `DataResponse` instance containing the result of the transform. public func flatMapError(_ transform: (Error) throws -> E) -> DataResponse { - var response = DataResponse( - request: request, - response: self.response, - data: data, - result: result.flatMapError(transform), - timeline: timeline - ) - - response._metrics = _metrics - - return response - } -} - -// MARK: - - -/// Used to store all data associated with an non-serialized response of a download request. -public struct DefaultDownloadResponse { - /// The URL request sent to the server. - public let request: URLRequest? - - /// The server's response to the URL request. - public let response: HTTPURLResponse? - - /// The temporary destination URL of the data returned from the server. - public let temporaryURL: URL? - - /// The final destination URL of the data returned from the server if it was moved. - public let destinationURL: URL? - - /// The resume data generated if the request was cancelled. - public let resumeData: Data? - - /// The error encountered while executing or validating the request. - public let error: Error? - - /// The timeline of the complete lifecycle of the request. - public let timeline: Timeline - - var _metrics: AnyObject? - - /// Creates a `DefaultDownloadResponse` instance from the specified parameters. - /// - /// - Parameters: - /// - request: The URL request sent to the server. - /// - response: The server's response to the URL request. - /// - temporaryURL: The temporary destination URL of the data returned from the server. - /// - destinationURL: The final destination URL of the data returned from the server if it was moved. - /// - resumeData: The resume data generated if the request was cancelled. - /// - error: The error encountered while executing or validating the request. - /// - timeline: The timeline of the complete lifecycle of the request. `Timeline()` by default. - /// - metrics: The task metrics containing the request / response statistics. `nil` by default. - public init( - request: URLRequest?, - response: HTTPURLResponse?, - temporaryURL: URL?, - destinationURL: URL?, - resumeData: Data?, - error: Error?, - timeline: Timeline = Timeline(), - metrics: AnyObject? = nil) - { - self.request = request - self.response = response - self.temporaryURL = temporaryURL - self.destinationURL = destinationURL - self.resumeData = resumeData - self.error = error - self.timeline = timeline + return DataResponse(request: request, + response: self.response, + data: data, + metrics: metrics, + serializationDuration: serializationDuration, + result: result.flatMapError(transform)) } } @@ -318,20 +211,20 @@ public struct DownloadResponse { /// The server's response to the URL request. public let response: HTTPURLResponse? - /// The temporary destination URL of the data returned from the server. - public let temporaryURL: URL? - - /// The final destination URL of the data returned from the server if it was moved. - public let destinationURL: URL? + /// The final destination URL of the data returned from the server after it is moved. + public let fileURL: URL? /// The resume data generated if the request was cancelled. public let resumeData: Data? - /// The result of response serialization. - public let result: Result + /// The final metrics of the response. + public let metrics: URLSessionTaskMetrics? - /// The timeline of the complete lifecycle of the request. - public let timeline: Timeline + /// The time taken to serialize the response. + public let serializationDuration: TimeInterval + + /// The result of response serialization. + public let result: AFResult /// Returns the associated value of the result if it is a success, `nil` otherwise. public var value: Value? { return result.value } @@ -339,35 +232,33 @@ public struct DownloadResponse { /// Returns the associated error value if the result if it is a failure, `nil` otherwise. public var error: Error? { return result.error } - var _metrics: AnyObject? - /// Creates a `DownloadResponse` instance with the specified parameters derived from response serialization. /// - /// - parameter request: The URL request sent to the server. - /// - parameter response: The server's response to the URL request. - /// - parameter temporaryURL: The temporary destination URL of the data returned from the server. - /// - parameter destinationURL: The final destination URL of the data returned from the server if it was moved. - /// - parameter resumeData: The resume data generated if the request was cancelled. - /// - parameter result: The result of response serialization. - /// - parameter timeline: The timeline of the complete lifecycle of the `Request`. Defaults to `Timeline()`. - /// - /// - returns: The new `DownloadResponse` instance. + /// - Parameters: + /// - request: The `URLRequest` sent to the server. + /// - response: The `HTTPURLResponse` from the server. + /// - temporaryURL: The temporary destinatio `URL` of the data returned from the server. + /// - destinationURL: The final destination `URL` of the data returned from the server, if it was moved. + /// - resumeData: The resume `Data` generated if the request was cancelled. + /// - metrics: The `URLSessionTaskMetrics` of the serialized response. + /// - serializationDuration: The duration taken by serialization. + /// - result: The `AFResult` of response serialization. public init( request: URLRequest?, response: HTTPURLResponse?, - temporaryURL: URL?, - destinationURL: URL?, + fileURL: URL?, resumeData: Data?, - result: Result, - timeline: Timeline = Timeline()) + metrics: URLSessionTaskMetrics?, + serializationDuration: TimeInterval, + result: AFResult) { self.request = request self.response = response - self.temporaryURL = temporaryURL - self.destinationURL = destinationURL + self.fileURL = fileURL self.resumeData = resumeData + self.metrics = metrics + self.serializationDuration = serializationDuration self.result = result - self.timeline = timeline } } @@ -377,24 +268,37 @@ extension DownloadResponse: CustomStringConvertible, CustomDebugStringConvertibl /// The textual representation used when written to an output stream, which includes whether the result was a /// success or failure. public var description: String { - return result.debugDescription + return "\(result)" } /// The debug textual representation used when written to an output stream, which includes the URL request, the URL - /// response, the temporary and destination URLs, the resume data, the response serialization result and the - /// timeline. + /// response, the temporary and destination URLs, the resume data, the durations of the network and serialization + /// actions, and the response serialization result. public var debugDescription: String { - var output: [String] = [] - - output.append(request != nil ? "[Request]: \(request!.httpMethod ?? "GET") \(request!)" : "[Request]: nil") - output.append(response != nil ? "[Response]: \(response!)" : "[Response]: nil") - output.append("[TemporaryURL]: \(temporaryURL?.path ?? "nil")") - output.append("[DestinationURL]: \(destinationURL?.path ?? "nil")") - output.append("[ResumeData]: \(resumeData?.count ?? 0) bytes") - output.append("[Result]: \(result.debugDescription)") - output.append("[Timeline]: \(timeline.debugDescription)") - - return output.joined(separator: "\n") + let requestDescription = request.map { "\($0.httpMethod!) \($0)" } ?? "nil" + let requestBody = request?.httpBody.map { String(decoding: $0, as: UTF8.self) } ?? "None" + let responseDescription = response.map { (response) in + let sortedHeaders = response.headers.sorted() + + return """ + [Status Code]: \(response.statusCode) + [Headers]: + \(sortedHeaders) + """ + } ?? "nil" + let metricsDescription = metrics.map { "\($0.taskInterval.duration)s" } ?? "None" + let resumeDataDescription = resumeData.map { "\($0)" } ?? "None" + + return """ + [Request]: \(requestDescription) + [Request Body]: \n\(requestBody) + [Response]: \n\(responseDescription) + [File URL]: \(fileURL?.path ?? "nil") + [ResumeData]: \(resumeDataDescription) + [Network Duration]: \(metricsDescription) + [Serialization Duration]: \(serializationDuration)s + [Result]: \(result) + """ } } @@ -414,19 +318,15 @@ extension DownloadResponse { /// - returns: A `DownloadResponse` whose result wraps the value returned by the given closure. If this instance's /// result is a failure, returns a response wrapping the same failure. public func map(_ transform: (Value) -> T) -> DownloadResponse { - var response = DownloadResponse( + return DownloadResponse( request: request, - response: self.response, - temporaryURL: temporaryURL, - destinationURL: destinationURL, + response: response, + fileURL: fileURL, resumeData: resumeData, - result: result.map(transform), - timeline: timeline + metrics: metrics, + serializationDuration: serializationDuration, + result: result.map(transform) ) - - response._metrics = _metrics - - return response } /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped @@ -444,19 +344,15 @@ extension DownloadResponse { /// - returns: A success or failure `DownloadResponse` depending on the result of the given closure. If this /// instance's result is a failure, returns the same failure. public func flatMap(_ transform: (Value) throws -> T) -> DownloadResponse { - var response = DownloadResponse( + return DownloadResponse( request: request, - response: self.response, - temporaryURL: temporaryURL, - destinationURL: destinationURL, + response: response, + fileURL: fileURL, resumeData: resumeData, - result: result.flatMap(transform), - timeline: timeline + metrics: metrics, + serializationDuration: serializationDuration, + result: result.flatMap(transform) ) - - response._metrics = _metrics - - return response } /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter. @@ -469,19 +365,15 @@ extension DownloadResponse { /// - Parameter transform: A closure that takes the error of the instance. /// - Returns: A `DownloadResponse` instance containing the result of the transform. public func mapError(_ transform: (Error) -> E) -> DownloadResponse { - var response = DownloadResponse( + return DownloadResponse( request: request, - response: self.response, - temporaryURL: temporaryURL, - destinationURL: destinationURL, + response: response, + fileURL: fileURL, resumeData: resumeData, - result: result.mapError(transform), - timeline: timeline + metrics: metrics, + serializationDuration: serializationDuration, + result: result.mapError(transform) ) - - response._metrics = _metrics - - return response } /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter. @@ -497,71 +389,14 @@ extension DownloadResponse { /// /// - Returns: A `DownloadResponse` instance containing the result of the transform. public func flatMapError(_ transform: (Error) throws -> E) -> DownloadResponse { - var response = DownloadResponse( + return DownloadResponse( request: request, - response: self.response, - temporaryURL: temporaryURL, - destinationURL: destinationURL, + response: response, + fileURL: fileURL, resumeData: resumeData, - result: result.flatMapError(transform), - timeline: timeline + metrics: metrics, + serializationDuration: serializationDuration, + result: result.flatMapError(transform) ) - - response._metrics = _metrics - - return response } } - -// MARK: - - -protocol Response { - /// The task metrics containing the request / response statistics. - var _metrics: AnyObject? { get set } - mutating func add(_ metrics: AnyObject?) -} - -extension Response { - mutating func add(_ metrics: AnyObject?) { - #if !os(watchOS) - guard #available(iOS 10.0, macOS 10.12, tvOS 10.0, *) else { return } - guard let metrics = metrics as? URLSessionTaskMetrics else { return } - - _metrics = metrics - #endif - } -} - -// MARK: - - -@available(iOS 10.0, macOS 10.12, tvOS 10.0, *) -extension DefaultDataResponse: Response { -#if !os(watchOS) - /// The task metrics containing the request / response statistics. - public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics } -#endif -} - -@available(iOS 10.0, macOS 10.12, tvOS 10.0, *) -extension DataResponse: Response { -#if !os(watchOS) - /// The task metrics containing the request / response statistics. - public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics } -#endif -} - -@available(iOS 10.0, macOS 10.12, tvOS 10.0, *) -extension DefaultDownloadResponse: Response { -#if !os(watchOS) - /// The task metrics containing the request / response statistics. - public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics } -#endif -} - -@available(iOS 10.0, macOS 10.12, tvOS 10.0, *) -extension DownloadResponse: Response { -#if !os(watchOS) - /// The task metrics containing the request / response statistics. - public var metrics: URLSessionTaskMetrics? { return _metrics as? URLSessionTaskMetrics } -#endif -} diff --git a/Example/Pods/Alamofire/Source/ResponseSerialization.swift b/Example/Pods/Alamofire/Source/ResponseSerialization.swift index 9cc105a..a7c0b78 100644 --- a/Example/Pods/Alamofire/Source/ResponseSerialization.swift +++ b/Example/Pods/Alamofire/Source/ResponseSerialization.swift @@ -1,7 +1,7 @@ // // ResponseSerialization.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,80 +24,77 @@ import Foundation -/// The type in which all data response serializers must conform to in order to serialize a response. +// MARK: Protocols + +/// The type to which all data response serializers must conform in order to serialize a response. public protocol DataResponseSerializerProtocol { - /// The type of serialized object to be created by this `DataResponseSerializerType`. + /// The type of serialized object to be created by this serializer. associatedtype SerializedObject - /// A closure used by response handlers that takes a request, response, data and error and returns a result. - var serializeResponse: (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result { get } -} - -// MARK: - - -/// A generic `DataResponseSerializerType` used to serialize a request, response, and data into a serialized object. -public struct DataResponseSerializer: DataResponseSerializerProtocol { - /// The type of serialized object to be created by this `DataResponseSerializer`. - public typealias SerializedObject = Value - - /// A closure used by response handlers that takes a request, response, data and error and returns a result. - public var serializeResponse: (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result - - /// Initializes the `ResponseSerializer` instance with the given serialize response closure. - /// - /// - parameter serializeResponse: The closure used to serialize the response. - /// - /// - returns: The new generic response serializer instance. - public init(serializeResponse: @escaping (URLRequest?, HTTPURLResponse?, Data?, Error?) -> Result) { - self.serializeResponse = serializeResponse - } + /// The function used to serialize the response data in response handlers. + func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> SerializedObject } -// MARK: - - -/// The type in which all download response serializers must conform to in order to serialize a response. +/// The type to which all download response serializers must conform in order to serialize a response. public protocol DownloadResponseSerializerProtocol { /// The type of serialized object to be created by this `DownloadResponseSerializerType`. associatedtype SerializedObject - /// A closure used by response handlers that takes a request, response, url and error and returns a result. - var serializeResponse: (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result { get } + /// The function used to serialize the downloaded data in response handlers. + func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> SerializedObject } -// MARK: - +/// A serializer that can handle both data and download responses. +public protocol ResponseSerializer: DataResponseSerializerProtocol & DownloadResponseSerializerProtocol { + var emptyRequestMethods: Set { get } + var emptyResponseCodes: Set { get } +} -/// A generic `DownloadResponseSerializerType` used to serialize a request, response, and data into a serialized object. -public struct DownloadResponseSerializer: DownloadResponseSerializerProtocol { - /// The type of serialized object to be created by this `DownloadResponseSerializer`. - public typealias SerializedObject = Value +extension ResponseSerializer { + public static var defaultEmptyRequestMethods: Set { return [.head] } + public static var defaultEmptyResponseCodes: Set { return [204, 205] } - /// A closure used by response handlers that takes a request, response, url and error and returns a result. - public var serializeResponse: (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result + public var emptyRequestMethods: Set { return Self.defaultEmptyRequestMethods } + public var emptyResponseCodes: Set { return Self.defaultEmptyResponseCodes } - /// Initializes the `ResponseSerializer` instance with the given serialize response closure. - /// - /// - parameter serializeResponse: The closure used to serialize the response. - /// - /// - returns: The new generic response serializer instance. - public init(serializeResponse: @escaping (URLRequest?, HTTPURLResponse?, URL?, Error?) -> Result) { - self.serializeResponse = serializeResponse + public func requestAllowsEmptyResponseData(_ request: URLRequest?) -> Bool? { + return request.flatMap { $0.httpMethod } + .flatMap(HTTPMethod.init) + .map { emptyRequestMethods.contains($0) } + } + + public func responseAllowsEmptyResponseData(_ response: HTTPURLResponse?) -> Bool? { + return response.flatMap { $0.statusCode } + .map { emptyResponseCodes.contains($0) } + } + + public func emptyResponseAllowed(forRequest request: URLRequest?, response: HTTPURLResponse?) -> Bool { + return (requestAllowsEmptyResponseData(request) == true) || (responseAllowsEmptyResponseData(response) == true) } } -// MARK: - Timeline +/// By default, any serializer declared to conform to both types will get file serialization for free, as it just feeds +/// the data read from disk into the data response serializer. +public extension DownloadResponseSerializerProtocol where Self: DataResponseSerializerProtocol { + func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> Self.SerializedObject { + guard error == nil else { throw error! } + + guard let fileURL = fileURL else { + throw AFError.responseSerializationFailed(reason: .inputFileNil) + } -extension Request { - var timeline: Timeline { - let requestStartTime = self.startTime ?? CFAbsoluteTimeGetCurrent() - let requestCompletedTime = self.endTime ?? CFAbsoluteTimeGetCurrent() - let initialResponseTime = self.delegate.initialResponseTime ?? requestCompletedTime + let data: Data + do { + data = try Data(contentsOf: fileURL) + } catch { + throw AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL)) + } - return Timeline( - requestStartTime: requestStartTime, - initialResponseTime: initialResponseTime, - requestCompletedTime: requestCompletedTime, - serializationCompletedTime: CFAbsoluteTimeGetCurrent() - ) + do { + return try serialize(request: request, response: response, data: data, error: error) + } catch { + throw error + } } } @@ -106,26 +103,24 @@ extension Request { extension DataRequest { /// Adds a handler to be called once the request has finished. /// - /// - parameter queue: The queue on which the completion handler is dispatched. - /// - parameter completionHandler: The code to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - completionHandler: The code to be executed once the request has finished. + /// - Returns: The request. @discardableResult - public func response(queue: DispatchQueue? = nil, completionHandler: @escaping (DefaultDataResponse) -> Void) -> Self { - delegate.queue.addOperation { - (queue ?? DispatchQueue.main).async { - var dataResponse = DefaultDataResponse( - request: self.request, - response: self.response, - data: self.delegate.data, - error: self.delegate.error, - timeline: self.timeline - ) - - dataResponse.add(self.delegate.metrics) - - completionHandler(dataResponse) - } + public func response(queue: DispatchQueue = .main, completionHandler: @escaping (DataResponse) -> Void) -> Self { + appendResponseSerializer { + let result = AFResult(value: self.data, error: self.error) + let response = DataResponse(request: self.request, + response: self.response, + data: self.data, + metrics: self.metrics, + serializationDuration: 0, + result: result) + + self.eventMonitor?.request(self, didParseResponse: response) + + self.responseSerializerDidComplete { queue.async { completionHandler(response) } } } return self @@ -133,38 +128,69 @@ extension DataRequest { /// Adds a handler to be called once the request has finished. /// - /// - parameter queue: The queue on which the completion handler is dispatched. - /// - parameter responseSerializer: The response serializer responsible for serializing the request, response, - /// and data. - /// - parameter completionHandler: The code to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - responseSerializer: The response serializer responsible for serializing the request, response, and data. + /// - completionHandler: The code to be executed once the request has finished. + /// - Returns: The request. @discardableResult - public func response( - queue: DispatchQueue? = nil, - responseSerializer: T, - completionHandler: @escaping (DataResponse) -> Void) + public func response( + queue: DispatchQueue = .main, + responseSerializer: Serializer, + completionHandler: @escaping (DataResponse) -> Void) -> Self { - delegate.queue.addOperation { - let result = responseSerializer.serializeResponse( - self.request, - self.response, - self.delegate.data, - self.delegate.error - ) - - var dataResponse = DataResponse( - request: self.request, - response: self.response, - data: self.delegate.data, - result: result, - timeline: self.timeline - ) - - dataResponse.add(self.delegate.metrics) - - (queue ?? DispatchQueue.main).async { completionHandler(dataResponse) } + appendResponseSerializer { + let start = CFAbsoluteTimeGetCurrent() + let result = AFResult { try responseSerializer.serialize(request: self.request, + response: self.response, + data: self.data, + error: self.error) } + let end = CFAbsoluteTimeGetCurrent() + + let response = DataResponse(request: self.request, + response: self.response, + data: self.data, + metrics: self.metrics, + serializationDuration: (end - start), + result: result) + + self.eventMonitor?.request(self, didParseResponse: response) + + guard let serializerError = result.error, let delegate = self.delegate else { + self.responseSerializerDidComplete { queue.async { completionHandler(response) } } + return + } + + delegate.retryResult(for: self, dueTo: serializerError) { retryResult in + var didComplete: (() -> Void)? + + defer { + if let didComplete = didComplete { + self.responseSerializerDidComplete { queue.async { didComplete() } } + } + } + + switch retryResult { + case .doNotRetry: + didComplete = { completionHandler(response) } + + case .doNotRetryWithError(let retryError): + let result = AFResult.failure(retryError) + + let response = DataResponse(request: self.request, + response: self.response, + data: self.data, + metrics: self.metrics, + serializationDuration: (end - start), + result: result) + + didComplete = { completionHandler(response) } + + case .retry, .retryWithDelay: + delegate.retryRequest(self, withDelay: retryResult.delay) + } + } } return self @@ -174,32 +200,29 @@ extension DataRequest { extension DownloadRequest { /// Adds a handler to be called once the request has finished. /// - /// - parameter queue: The queue on which the completion handler is dispatched. - /// - parameter completionHandler: The code to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - completionHandler: The code to be executed once the request has finished. + /// - Returns: The request. @discardableResult public func response( - queue: DispatchQueue? = nil, - completionHandler: @escaping (DefaultDownloadResponse) -> Void) + queue: DispatchQueue = .main, + completionHandler: @escaping (DownloadResponse) -> Void) -> Self { - delegate.queue.addOperation { - (queue ?? DispatchQueue.main).async { - var downloadResponse = DefaultDownloadResponse( - request: self.request, - response: self.response, - temporaryURL: self.downloadDelegate.temporaryURL, - destinationURL: self.downloadDelegate.destinationURL, - resumeData: self.downloadDelegate.resumeData, - error: self.downloadDelegate.error, - timeline: self.timeline - ) - - downloadResponse.add(self.delegate.metrics) - - completionHandler(downloadResponse) - } + appendResponseSerializer { + let result = AFResult(value: self.fileURL , error: self.error) + let response = DownloadResponse(request: self.request, + response: self.response, + fileURL: self.fileURL, + resumeData: self.resumeData, + metrics: self.metrics, + serializationDuration: 0, + result: result) + + self.eventMonitor?.request(self, didParseResponse: response) + + self.responseSerializerDidComplete { queue.async { completionHandler(response) } } } return self @@ -207,133 +230,151 @@ extension DownloadRequest { /// Adds a handler to be called once the request has finished. /// - /// - parameter queue: The queue on which the completion handler is dispatched. - /// - parameter responseSerializer: The response serializer responsible for serializing the request, response, - /// and data contained in the destination url. - /// - parameter completionHandler: The code to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - responseSerializer: The response serializer responsible for serializing the request, response, and data + /// contained in the destination url. + /// - completionHandler: The code to be executed once the request has finished. + /// - Returns: The request. @discardableResult public func response( - queue: DispatchQueue? = nil, + queue: DispatchQueue = .main, responseSerializer: T, completionHandler: @escaping (DownloadResponse) -> Void) -> Self { - delegate.queue.addOperation { - let result = responseSerializer.serializeResponse( - self.request, - self.response, - self.downloadDelegate.fileURL, - self.downloadDelegate.error - ) - - var downloadResponse = DownloadResponse( - request: self.request, - response: self.response, - temporaryURL: self.downloadDelegate.temporaryURL, - destinationURL: self.downloadDelegate.destinationURL, - resumeData: self.downloadDelegate.resumeData, - result: result, - timeline: self.timeline - ) - - downloadResponse.add(self.delegate.metrics) - - (queue ?? DispatchQueue.main).async { completionHandler(downloadResponse) } - } + appendResponseSerializer { + let start = CFAbsoluteTimeGetCurrent() + let result = AFResult { try responseSerializer.serializeDownload(request: self.request, + response: self.response, + fileURL: self.fileURL, + error: self.error) } + let end = CFAbsoluteTimeGetCurrent() + + let response = DownloadResponse(request: self.request, + response: self.response, + fileURL: self.fileURL, + resumeData: self.resumeData, + metrics: self.metrics, + serializationDuration: (end - start), + result: result) + + self.eventMonitor?.request(self, didParseResponse: response) + + guard let serializerError = result.error, let delegate = self.delegate else { + self.responseSerializerDidComplete { queue.async { completionHandler(response) } } + return + } - return self - } -} + delegate.retryResult(for: self, dueTo: serializerError) { retryResult in + var didComplete: (() -> Void)? -// MARK: - Data + defer { + if let didComplete = didComplete { + self.responseSerializerDidComplete { queue.async { didComplete() } } + } + } -extension Request { - /// Returns a result data type that contains the response data as-is. - /// - /// - parameter response: The response from the server. - /// - parameter data: The data returned from the server. - /// - parameter error: The error already encountered if it exists. - /// - /// - returns: The result data type. - public static func serializeResponseData(response: HTTPURLResponse?, data: Data?, error: Error?) -> Result { - guard error == nil else { return .failure(error!) } + switch retryResult { + case .doNotRetry: + didComplete = { completionHandler(response) } + + case .doNotRetryWithError(let retryError): + let result = AFResult.failure(retryError) - if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(Data()) } + let response = DownloadResponse(request: self.request, + response: self.response, + fileURL: self.fileURL, + resumeData: self.resumeData, + metrics: self.metrics, + serializationDuration: (end - start), + result: result) - guard let validData = data else { - return .failure(AFError.responseSerializationFailed(reason: .inputDataNil)) + didComplete = { completionHandler(response) } + + case .retry, .retryWithDelay: + delegate.retryRequest(self, withDelay: retryResult.delay) + } + } } - return .success(validData) + return self } } -extension DataRequest { - /// Creates a response serializer that returns the associated data as-is. - /// - /// - returns: A data response serializer. - public static func dataResponseSerializer() -> DataResponseSerializer { - return DataResponseSerializer { _, response, data, error in - return Request.serializeResponseData(response: response, data: data, error: error) - } - } +// MARK: - Data +extension DataRequest { /// Adds a handler to be called once the request has finished. /// - /// - parameter completionHandler: The code to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - completionHandler: The code to be executed once the request has finished. + /// - Returns: The request. @discardableResult public func responseData( - queue: DispatchQueue? = nil, + queue: DispatchQueue = .main, completionHandler: @escaping (DataResponse) -> Void) -> Self { - return response( - queue: queue, - responseSerializer: DataRequest.dataResponseSerializer(), - completionHandler: completionHandler - ) + return response(queue: queue, + responseSerializer: DataResponseSerializer(), + completionHandler: completionHandler) } } -extension DownloadRequest { - /// Creates a response serializer that returns the associated data as-is. - /// - /// - returns: A data response serializer. - public static func dataResponseSerializer() -> DownloadResponseSerializer { - return DownloadResponseSerializer { _, response, fileURL, error in - guard error == nil else { return .failure(error!) } +/// A `ResponseSerializer` that performs minimal reponse checking and returns any response data as-is. By default, a +/// request returning `nil` or no data is considered an error. However, if the response is has a status code valid for +/// empty responses (`204`, `205`), then an empty `Data` value is returned. +public final class DataResponseSerializer: ResponseSerializer { + /// HTTP response codes for which empty responses are allowed. + public let emptyResponseCodes: Set + /// HTTP request methods for which empty responses are allowed. + public let emptyRequestMethods: Set + + /// Creates an instance using the provided values. + /// + /// - Parameters: + /// - emptyResponseCodes: The HTTP response codes for which empty responses are allowed. Defaults to + /// `[204, 205]`. + /// - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. Defaults to `[.head]`. + public init(emptyResponseCodes: Set = DataResponseSerializer.defaultEmptyResponseCodes, + emptyRequestMethods: Set = DataResponseSerializer.defaultEmptyRequestMethods) { + self.emptyResponseCodes = emptyResponseCodes + self.emptyRequestMethods = emptyRequestMethods + } - guard let fileURL = fileURL else { - return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) - } + public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> Data { + guard error == nil else { throw error! } - do { - let data = try Data(contentsOf: fileURL) - return Request.serializeResponseData(response: response, data: data, error: error) - } catch { - return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))) + guard let data = data, !data.isEmpty else { + guard emptyResponseAllowed(forRequest: request, response: response) else { + throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength) } + + return Data() } + + return data } +} +extension DownloadRequest { /// Adds a handler to be called once the request has finished. /// - /// - parameter completionHandler: The code to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - completionHandler: The code to be executed once the request has finished. + /// - Returns: The request. @discardableResult public func responseData( - queue: DispatchQueue? = nil, + queue: DispatchQueue = .main, completionHandler: @escaping (DownloadResponse) -> Void) -> Self { return response( queue: queue, - responseSerializer: DownloadRequest.dataResponseSerializer(), + responseSerializer: DataResponseSerializer(), completionHandler: completionHandler ) } @@ -341,129 +382,100 @@ extension DownloadRequest { // MARK: - String -extension Request { - /// Returns a result string type initialized from the response data with the specified string encoding. - /// - /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server - /// response, falling back to the default HTTP default character set, ISO-8859-1. - /// - parameter response: The response from the server. - /// - parameter data: The data returned from the server. - /// - parameter error: The error already encountered if it exists. - /// - /// - returns: The result data type. - public static func serializeResponseString( - encoding: String.Encoding?, - response: HTTPURLResponse?, - data: Data?, - error: Error?) - -> Result - { - guard error == nil else { return .failure(error!) } +/// A `ResponseSerializer` that decodes the response data as a `String`. By default, a request returning `nil` or no +/// data is considered an error. However, if the response is has a status code valid for empty responses (`204`, `205`), +/// then an empty `String` is returned. +public final class StringResponseSerializer: ResponseSerializer { + /// Optional string encoding used to validate the response. + public let encoding: String.Encoding? + /// HTTP response codes for which empty responses are allowed. + public let emptyResponseCodes: Set + /// HTTP request methods for which empty responses are allowed. + public let emptyRequestMethods: Set + + /// Creates an instance with the provided values. + /// + /// - Parameters: + /// - encoding: A string encoding. Defaults to `nil`, in which case the encoding will be determined + /// from the server response, falling back to the default HTTP character set, `ISO-8859-1`. + /// - emptyResponseCodes: The HTTP response codes for which empty responses are allowed. Defaults to + /// `[204, 205]`. + /// - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. Defaults to `[.head]`. + public init(encoding: String.Encoding? = nil, + emptyResponseCodes: Set = StringResponseSerializer.defaultEmptyResponseCodes, + emptyRequestMethods: Set = StringResponseSerializer.defaultEmptyRequestMethods) { + self.encoding = encoding + self.emptyResponseCodes = emptyResponseCodes + self.emptyRequestMethods = emptyRequestMethods + } - if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success("") } + public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> String { + guard error == nil else { throw error! } - guard let validData = data else { - return .failure(AFError.responseSerializationFailed(reason: .inputDataNil)) + guard let data = data, !data.isEmpty else { + guard emptyResponseAllowed(forRequest: request, response: response) else { + throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength) + } + + return "" } var convertedEncoding = encoding if let encodingName = response?.textEncodingName as CFString?, convertedEncoding == nil { - convertedEncoding = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding( - CFStringConvertIANACharSetNameToEncoding(encodingName)) - ) + let ianaCharSet = CFStringConvertIANACharSetNameToEncoding(encodingName) + let nsStringEncoding = CFStringConvertEncodingToNSStringEncoding(ianaCharSet) + convertedEncoding = String.Encoding(rawValue: nsStringEncoding) } let actualEncoding = convertedEncoding ?? .isoLatin1 - if let string = String(data: validData, encoding: actualEncoding) { - return .success(string) - } else { - return .failure(AFError.responseSerializationFailed(reason: .stringSerializationFailed(encoding: actualEncoding))) + guard let string = String(data: data, encoding: actualEncoding) else { + throw AFError.responseSerializationFailed(reason: .stringSerializationFailed(encoding: actualEncoding)) } + + return string } } extension DataRequest { - /// Creates a response serializer that returns a result string type initialized from the response data with - /// the specified string encoding. - /// - /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server - /// response, falling back to the default HTTP default character set, ISO-8859-1. - /// - /// - returns: A string response serializer. - public static func stringResponseSerializer(encoding: String.Encoding? = nil) -> DataResponseSerializer { - return DataResponseSerializer { _, response, data, error in - return Request.serializeResponseString(encoding: encoding, response: response, data: data, error: error) - } - } - /// Adds a handler to be called once the request has finished. /// - /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the - /// server response, falling back to the default HTTP default character set, - /// ISO-8859-1. - /// - parameter completionHandler: A closure to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - encoding: The string encoding. Defaults to `nil`, in which case the encoding will be determined from + /// the server response, falling back to the default HTTP character set, `ISO-8859-1`. + /// - completionHandler: A closure to be executed once the request has finished. + /// - Returns: The request. @discardableResult - public func responseString( - queue: DispatchQueue? = nil, - encoding: String.Encoding? = nil, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DataRequest.stringResponseSerializer(encoding: encoding), - completionHandler: completionHandler - ) + public func responseString(queue: DispatchQueue = .main, + encoding: String.Encoding? = nil, + completionHandler: @escaping (DataResponse) -> Void) -> Self { + return response(queue: queue, + responseSerializer: StringResponseSerializer(encoding: encoding), + completionHandler: completionHandler) } } extension DownloadRequest { - /// Creates a response serializer that returns a result string type initialized from the response data with - /// the specified string encoding. - /// - /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the server - /// response, falling back to the default HTTP default character set, ISO-8859-1. - /// - /// - returns: A string response serializer. - public static func stringResponseSerializer(encoding: String.Encoding? = nil) -> DownloadResponseSerializer { - return DownloadResponseSerializer { _, response, fileURL, error in - guard error == nil else { return .failure(error!) } - - guard let fileURL = fileURL else { - return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) - } - - do { - let data = try Data(contentsOf: fileURL) - return Request.serializeResponseString(encoding: encoding, response: response, data: data, error: error) - } catch { - return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))) - } - } - } - /// Adds a handler to be called once the request has finished. /// - /// - parameter encoding: The string encoding. If `nil`, the string encoding will be determined from the - /// server response, falling back to the default HTTP default character set, - /// ISO-8859-1. - /// - parameter completionHandler: A closure to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - encoding: The string encoding. Defaults to `nil`, in which case the encoding will be determined from + /// the server response, falling back to the default HTTP character set, `ISO-8859-1`. + /// - completionHandler: A closure to be executed once the request has finished. + /// - Returns: The request. @discardableResult public func responseString( - queue: DispatchQueue? = nil, + queue: DispatchQueue = .main, encoding: String.Encoding? = nil, completionHandler: @escaping (DownloadResponse) -> Void) -> Self { return response( queue: queue, - responseSerializer: DownloadRequest.stringResponseSerializer(encoding: encoding), + responseSerializer: StringResponseSerializer(encoding: encoding), completionHandler: completionHandler ) } @@ -471,245 +483,191 @@ extension DownloadRequest { // MARK: - JSON -extension Request { - /// Returns a JSON object contained in a result type constructed from the response data using `JSONSerialization` - /// with the specified reading options. - /// - /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. - /// - parameter response: The response from the server. - /// - parameter data: The data returned from the server. - /// - parameter error: The error already encountered if it exists. - /// - /// - returns: The result data type. - public static func serializeResponseJSON( - options: JSONSerialization.ReadingOptions, - response: HTTPURLResponse?, - data: Data?, - error: Error?) - -> Result - { - guard error == nil else { return .failure(error!) } +/// A `ResponseSerializer` that decodes the response data using `JSONSerialization`. By default, a request returning +/// `nil` or no data is considered an error. However, if the response is has a status code valid for empty responses +/// (`204`, `205`), then an `NSNull` value is returned. +public final class JSONResponseSerializer: ResponseSerializer { + /// `JSONSerialization.ReadingOptions` used when serializing a response. + public let options: JSONSerialization.ReadingOptions + /// HTTP response codes for which empty responses are allowed. + public let emptyResponseCodes: Set + /// HTTP request methods for which empty responses are allowed. + public let emptyRequestMethods: Set + + /// Creates an instance with the provided values. + /// + /// - Parameters: + /// - options: The options to use. Defaults to `.allowFragments`. + /// - emptyResponseCodes: The HTTP response codes for which empty responses are allowed. Defaults to + /// `[204, 205]`. + /// - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. Defaults to `[.head]`. + public init(options: JSONSerialization.ReadingOptions = .allowFragments, + emptyResponseCodes: Set = JSONResponseSerializer.defaultEmptyResponseCodes, + emptyRequestMethods: Set = JSONResponseSerializer.defaultEmptyRequestMethods) { + self.options = options + self.emptyResponseCodes = emptyResponseCodes + self.emptyRequestMethods = emptyRequestMethods + } + + public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> Any { + guard error == nil else { throw error! } - if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(NSNull()) } + guard let data = data, !data.isEmpty else { + guard emptyResponseAllowed(forRequest: request, response: response) else { + throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength) + } - guard let validData = data, validData.count > 0 else { - return .failure(AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)) + return NSNull() } do { - let json = try JSONSerialization.jsonObject(with: validData, options: options) - return .success(json) + return try JSONSerialization.jsonObject(with: data, options: options) } catch { - return .failure(AFError.responseSerializationFailed(reason: .jsonSerializationFailed(error: error))) + throw AFError.responseSerializationFailed(reason: .jsonSerializationFailed(error: error)) } } } extension DataRequest { - /// Creates a response serializer that returns a JSON object result type constructed from the response data using - /// `JSONSerialization` with the specified reading options. - /// - /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. - /// - /// - returns: A JSON object response serializer. - public static func jsonResponseSerializer( - options: JSONSerialization.ReadingOptions = .allowFragments) - -> DataResponseSerializer - { - return DataResponseSerializer { _, response, data, error in - return Request.serializeResponseJSON(options: options, response: response, data: data, error: error) - } - } - /// Adds a handler to be called once the request has finished. /// - /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. - /// - parameter completionHandler: A closure to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - options: The JSON serialization reading options. Defaults to `.allowFragments`. + /// - completionHandler: A closure to be executed once the request has finished. + /// - Returns: The request. @discardableResult - public func responseJSON( - queue: DispatchQueue? = nil, - options: JSONSerialization.ReadingOptions = .allowFragments, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DataRequest.jsonResponseSerializer(options: options), - completionHandler: completionHandler - ) + public func responseJSON(queue: DispatchQueue = .main, + options: JSONSerialization.ReadingOptions = .allowFragments, + completionHandler: @escaping (DataResponse) -> Void) -> Self { + return response(queue: queue, + responseSerializer: JSONResponseSerializer(options: options), + completionHandler: completionHandler) } } extension DownloadRequest { - /// Creates a response serializer that returns a JSON object result type constructed from the response data using - /// `JSONSerialization` with the specified reading options. - /// - /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. - /// - /// - returns: A JSON object response serializer. - public static func jsonResponseSerializer( - options: JSONSerialization.ReadingOptions = .allowFragments) - -> DownloadResponseSerializer - { - return DownloadResponseSerializer { _, response, fileURL, error in - guard error == nil else { return .failure(error!) } - - guard let fileURL = fileURL else { - return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) - } - - do { - let data = try Data(contentsOf: fileURL) - return Request.serializeResponseJSON(options: options, response: response, data: data, error: error) - } catch { - return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))) - } - } - } - /// Adds a handler to be called once the request has finished. /// - /// - parameter options: The JSON serialization reading options. Defaults to `.allowFragments`. - /// - parameter completionHandler: A closure to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - options: The JSON serialization reading options. Defaults to `.allowFragments`. + /// - completionHandler: A closure to be executed once the request has finished. + /// - Returns: The request. @discardableResult public func responseJSON( - queue: DispatchQueue? = nil, + queue: DispatchQueue = .main, options: JSONSerialization.ReadingOptions = .allowFragments, completionHandler: @escaping (DownloadResponse) -> Void) -> Self { - return response( - queue: queue, - responseSerializer: DownloadRequest.jsonResponseSerializer(options: options), - completionHandler: completionHandler - ) + return response(queue: queue, + responseSerializer: JSONResponseSerializer(options: options), + completionHandler: completionHandler) } } -// MARK: - Property List - -extension Request { - /// Returns a plist object contained in a result type constructed from the response data using - /// `PropertyListSerialization` with the specified reading options. - /// - /// - parameter options: The property list reading options. Defaults to `[]`. - /// - parameter response: The response from the server. - /// - parameter data: The data returned from the server. - /// - parameter error: The error already encountered if it exists. - /// - /// - returns: The result data type. - public static func serializeResponsePropertyList( - options: PropertyListSerialization.ReadOptions, - response: HTTPURLResponse?, - data: Data?, - error: Error?) - -> Result - { - guard error == nil else { return .failure(error!) } - - if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(NSNull()) } +// MARK: - Empty +/// A protocol for a type representing an empty response. Use `T.emptyValue` to get an instance. +public protocol EmptyResponse { + static func emptyValue() -> Self +} - guard let validData = data, validData.count > 0 else { - return .failure(AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)) - } +/// A type representing an empty response. Use `Empty.value` to get the instance. +public struct Empty: Decodable { + public static let value = Empty() +} - do { - let plist = try PropertyListSerialization.propertyList(from: validData, options: options, format: nil) - return .success(plist) - } catch { - return .failure(AFError.responseSerializationFailed(reason: .propertyListSerializationFailed(error: error))) - } +extension Empty: EmptyResponse { + public static func emptyValue() -> Empty { + return value } } -extension DataRequest { - /// Creates a response serializer that returns an object constructed from the response data using - /// `PropertyListSerialization` with the specified reading options. - /// - /// - parameter options: The property list reading options. Defaults to `[]`. - /// - /// - returns: A property list object response serializer. - public static func propertyListResponseSerializer( - options: PropertyListSerialization.ReadOptions = []) - -> DataResponseSerializer - { - return DataResponseSerializer { _, response, data, error in - return Request.serializeResponsePropertyList(options: options, response: response, data: data, error: error) - } - } +// MARK: - DataDecoder Protocol - /// Adds a handler to be called once the request has finished. - /// - /// - parameter options: The property list reading options. Defaults to `[]`. - /// - parameter completionHandler: A closure to be executed once the request has finished. +/// Any type which can decode `Data`. +public protocol DataDecoder { + /// Decode `Data` into the provided type. /// - /// - returns: The request. - @discardableResult - public func responsePropertyList( - queue: DispatchQueue? = nil, - options: PropertyListSerialization.ReadOptions = [], - completionHandler: @escaping (DataResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DataRequest.propertyListResponseSerializer(options: options), - completionHandler: completionHandler - ) - } + /// - Parameters: + /// - type: The `Type` to be decoded. + /// - data: The `Data` + /// - Returns: The decoded value of type `D`. + /// - Throws: Any error that occurs during decode. + func decode(_ type: D.Type, from data: Data) throws -> D } -extension DownloadRequest { - /// Creates a response serializer that returns an object constructed from the response data using - /// `PropertyListSerialization` with the specified reading options. - /// - /// - parameter options: The property list reading options. Defaults to `[]`. - /// - /// - returns: A property list object response serializer. - public static func propertyListResponseSerializer( - options: PropertyListSerialization.ReadOptions = []) - -> DownloadResponseSerializer - { - return DownloadResponseSerializer { _, response, fileURL, error in - guard error == nil else { return .failure(error!) } +/// `JSONDecoder` automatically conforms to `DataDecoder`. +extension JSONDecoder: DataDecoder { } + +// MARK: - Decodable + +/// A `ResponseSerializer` that decodes the response data as a generic value using any type that conforms to +/// `DataDecoder`. By default, this is an instance of `JSONDecoder`. Additionally, a request returning `nil` or no data +/// is considered an error. However, if the response is has a status code valid for empty responses (`204`, `205`), then +/// the `Empty.value` value is returned. +public final class DecodableResponseSerializer: ResponseSerializer { + /// The `JSONDecoder` instance used to decode responses. + public let decoder: DataDecoder + /// HTTP response codes for which empty responses are allowed. + public let emptyResponseCodes: Set + /// HTTP request methods for which empty responses are allowed. + public let emptyRequestMethods: Set + + /// Creates an instance using the values provided. + /// + /// - Parameters: + /// - decoder: The `JSONDecoder`. Defaults to a `JSONDecoder()`. + /// - emptyResponseCodes: The HTTP response codes for which empty responses are allowed. Defaults to + /// `[204, 205]`. + /// - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. Defaults to `[.head]`. + public init(decoder: DataDecoder = JSONDecoder(), + emptyResponseCodes: Set = DecodableResponseSerializer.defaultEmptyResponseCodes, + emptyRequestMethods: Set = DecodableResponseSerializer.defaultEmptyRequestMethods) { + self.decoder = decoder + self.emptyResponseCodes = emptyResponseCodes + self.emptyRequestMethods = emptyRequestMethods + } - guard let fileURL = fileURL else { - return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) + public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> T { + guard error == nil else { throw error! } + + guard let data = data, !data.isEmpty else { + guard emptyResponseAllowed(forRequest: request, response: response) else { + throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength) } - do { - let data = try Data(contentsOf: fileURL) - return Request.serializeResponsePropertyList(options: options, response: response, data: data, error: error) - } catch { - return .failure(AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))) + guard let emptyResponseType = T.self as? EmptyResponse.Type, let emptyValue = emptyResponseType.emptyValue() as? T else { + throw AFError.responseSerializationFailed(reason: .invalidEmptyResponse(type: "\(T.self)")) } + + return emptyValue + } + + do { + return try decoder.decode(T.self, from: data) + } catch { + throw AFError.responseSerializationFailed(reason: .decodingFailed(error: error)) } } +} +extension DataRequest { /// Adds a handler to be called once the request has finished. /// - /// - parameter options: The property list reading options. Defaults to `[]`. - /// - parameter completionHandler: A closure to be executed once the request has finished. - /// - /// - returns: The request. + /// - Parameters: + /// - queue: The queue on which the completion handler is dispatched. Defaults to `.main`. + /// - decoder: The `DataDecoder` to use to decode the response. Defaults to a `JSONDecoder` with default + /// settings. + /// - completionHandler: A closure to be executed once the request has finished. + /// - Returns: The request. @discardableResult - public func responsePropertyList( - queue: DispatchQueue? = nil, - options: PropertyListSerialization.ReadOptions = [], - completionHandler: @escaping (DownloadResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DownloadRequest.propertyListResponseSerializer(options: options), - completionHandler: completionHandler - ) + public func responseDecodable(queue: DispatchQueue = .main, + decoder: DataDecoder = JSONDecoder(), + completionHandler: @escaping (DataResponse) -> Void) -> Self { + return response(queue: queue, + responseSerializer: DecodableResponseSerializer(decoder: decoder), + completionHandler: completionHandler) } } - -/// A set of HTTP response status code that do not contain response data. -private let emptyDataStatusCodes: Set = [204, 205] diff --git a/Example/Pods/Alamofire/Source/Result.swift b/Example/Pods/Alamofire/Source/Result.swift deleted file mode 100644 index e092808..0000000 --- a/Example/Pods/Alamofire/Source/Result.swift +++ /dev/null @@ -1,300 +0,0 @@ -// -// Result.swift -// -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import Foundation - -/// Used to represent whether a request was successful or encountered an error. -/// -/// - success: The request and all post processing operations were successful resulting in the serialization of the -/// provided associated value. -/// -/// - failure: The request encountered an error resulting in a failure. The associated values are the original data -/// provided by the server as well as the error that caused the failure. -public enum Result { - case success(Value) - case failure(Error) - - /// Returns `true` if the result is a success, `false` otherwise. - public var isSuccess: Bool { - switch self { - case .success: - return true - case .failure: - return false - } - } - - /// Returns `true` if the result is a failure, `false` otherwise. - public var isFailure: Bool { - return !isSuccess - } - - /// Returns the associated value if the result is a success, `nil` otherwise. - public var value: Value? { - switch self { - case .success(let value): - return value - case .failure: - return nil - } - } - - /// Returns the associated error value if the result is a failure, `nil` otherwise. - public var error: Error? { - switch self { - case .success: - return nil - case .failure(let error): - return error - } - } -} - -// MARK: - CustomStringConvertible - -extension Result: CustomStringConvertible { - /// The textual representation used when written to an output stream, which includes whether the result was a - /// success or failure. - public var description: String { - switch self { - case .success: - return "SUCCESS" - case .failure: - return "FAILURE" - } - } -} - -// MARK: - CustomDebugStringConvertible - -extension Result: CustomDebugStringConvertible { - /// The debug textual representation used when written to an output stream, which includes whether the result was a - /// success or failure in addition to the value or error. - public var debugDescription: String { - switch self { - case .success(let value): - return "SUCCESS: \(value)" - case .failure(let error): - return "FAILURE: \(error)" - } - } -} - -// MARK: - Functional APIs - -extension Result { - /// Creates a `Result` instance from the result of a closure. - /// - /// A failure result is created when the closure throws, and a success result is created when the closure - /// succeeds without throwing an error. - /// - /// func someString() throws -> String { ... } - /// - /// let result = Result(value: { - /// return try someString() - /// }) - /// - /// // The type of result is Result - /// - /// The trailing closure syntax is also supported: - /// - /// let result = Result { try someString() } - /// - /// - parameter value: The closure to execute and create the result for. - public init(value: () throws -> Value) { - do { - self = try .success(value()) - } catch { - self = .failure(error) - } - } - - /// Returns the success value, or throws the failure error. - /// - /// let possibleString: Result = .success("success") - /// try print(possibleString.unwrap()) - /// // Prints "success" - /// - /// let noString: Result = .failure(error) - /// try print(noString.unwrap()) - /// // Throws error - public func unwrap() throws -> Value { - switch self { - case .success(let value): - return value - case .failure(let error): - throw error - } - } - - /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter. - /// - /// Use the `map` method with a closure that does not throw. For example: - /// - /// let possibleData: Result = .success(Data()) - /// let possibleInt = possibleData.map { $0.count } - /// try print(possibleInt.unwrap()) - /// // Prints "0" - /// - /// let noData: Result = .failure(error) - /// let noInt = noData.map { $0.count } - /// try print(noInt.unwrap()) - /// // Throws error - /// - /// - parameter transform: A closure that takes the success value of the `Result` instance. - /// - /// - returns: A `Result` containing the result of the given closure. If this instance is a failure, returns the - /// same failure. - public func map(_ transform: (Value) -> T) -> Result { - switch self { - case .success(let value): - return .success(transform(value)) - case .failure(let error): - return .failure(error) - } - } - - /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter. - /// - /// Use the `flatMap` method with a closure that may throw an error. For example: - /// - /// let possibleData: Result = .success(Data(...)) - /// let possibleObject = possibleData.flatMap { - /// try JSONSerialization.jsonObject(with: $0) - /// } - /// - /// - parameter transform: A closure that takes the success value of the instance. - /// - /// - returns: A `Result` containing the result of the given closure. If this instance is a failure, returns the - /// same failure. - public func flatMap(_ transform: (Value) throws -> T) -> Result { - switch self { - case .success(let value): - do { - return try .success(transform(value)) - } catch { - return .failure(error) - } - case .failure(let error): - return .failure(error) - } - } - - /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter. - /// - /// Use the `mapError` function with a closure that does not throw. For example: - /// - /// let possibleData: Result = .failure(someError) - /// let withMyError: Result = possibleData.mapError { MyError.error($0) } - /// - /// - Parameter transform: A closure that takes the error of the instance. - /// - Returns: A `Result` instance containing the result of the transform. If this instance is a success, returns - /// the same instance. - public func mapError(_ transform: (Error) -> T) -> Result { - switch self { - case .failure(let error): - return .failure(transform(error)) - case .success: - return self - } - } - - /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter. - /// - /// Use the `flatMapError` function with a closure that may throw an error. For example: - /// - /// let possibleData: Result = .success(Data(...)) - /// let possibleObject = possibleData.flatMapError { - /// try someFailableFunction(taking: $0) - /// } - /// - /// - Parameter transform: A throwing closure that takes the error of the instance. - /// - /// - Returns: A `Result` instance containing the result of the transform. If this instance is a success, returns - /// the same instance. - public func flatMapError(_ transform: (Error) throws -> T) -> Result { - switch self { - case .failure(let error): - do { - return try .failure(transform(error)) - } catch { - return .failure(error) - } - case .success: - return self - } - } - - /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter. - /// - /// Use the `withValue` function to evaluate the passed closure without modifying the `Result` instance. - /// - /// - Parameter closure: A closure that takes the success value of this instance. - /// - Returns: This `Result` instance, unmodified. - @discardableResult - public func withValue(_ closure: (Value) throws -> Void) rethrows -> Result { - if case let .success(value) = self { try closure(value) } - - return self - } - - /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter. - /// - /// Use the `withError` function to evaluate the passed closure without modifying the `Result` instance. - /// - /// - Parameter closure: A closure that takes the success value of this instance. - /// - Returns: This `Result` instance, unmodified. - @discardableResult - public func withError(_ closure: (Error) throws -> Void) rethrows -> Result { - if case let .failure(error) = self { try closure(error) } - - return self - } - - /// Evaluates the specified closure when the `Result` is a success. - /// - /// Use the `ifSuccess` function to evaluate the passed closure without modifying the `Result` instance. - /// - /// - Parameter closure: A `Void` closure. - /// - Returns: This `Result` instance, unmodified. - @discardableResult - public func ifSuccess(_ closure: () throws -> Void) rethrows -> Result { - if isSuccess { try closure() } - - return self - } - - /// Evaluates the specified closure when the `Result` is a failure. - /// - /// Use the `ifFailure` function to evaluate the passed closure without modifying the `Result` instance. - /// - /// - Parameter closure: A `Void` closure. - /// - Returns: This `Result` instance, unmodified. - @discardableResult - public func ifFailure(_ closure: () throws -> Void) rethrows -> Result { - if isFailure { try closure() } - - return self - } -} diff --git a/Example/Pods/Alamofire/Source/RetryPolicy.swift b/Example/Pods/Alamofire/Source/RetryPolicy.swift new file mode 100644 index 0000000..b86586c --- /dev/null +++ b/Example/Pods/Alamofire/Source/RetryPolicy.swift @@ -0,0 +1,375 @@ +// +// RetryPolicy.swift +// +// Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// A retry policy that retries requests using an exponential backoff for allowed HTTP methods and HTTP status codes +/// as well as certain types of networking errors. +open class RetryPolicy: RequestInterceptor { + /// The default retry limit for retry policies. + public static let defaultRetryLimit: UInt = 2 + + /// The default exponential backoff base for retry policies (must be a minimum of 2). + public static let defaultExponentialBackoffBase: UInt = 2 + + /// The default exponential backoff scale for retry policies. + public static let defaultExponentialBackoffScale: Double = 0.5 + + /// The default HTTP methods to retry. + /// See [RFC 2616 - Section 9.1.2](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) for more information. + public static let defaultRetryableHTTPMethods: Set = [ + .delete, // [Delete](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7) - not always idempotent + .get, // [GET](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3) - generally idempotent + .head, // [HEAD](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4) - generally idempotent + .options, // [OPTIONS](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2) - inherently idempotent + .put, // [PUT](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6) - not always idempotent + .trace // [TRACE](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8) - inherently idempotent + ] + + /// The default HTTP status codes to retry. + /// See [RFC 2616 - Section 10](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10) for more information. + public static let defaultRetryableHTTPStatusCodes: Set = [ + 408, // [Request Timeout](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.9) + 500, // [Internal Server Error](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1) + 502, // [Bad Gateway](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.3) + 503, // [Service Unavailable](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4) + 504 // [Gateway Timeout](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.5) + ] + + /// The default URL error codes to retry. + public static let defaultRetryableURLErrorCodes: Set = [ + // [Security] App Transport Security disallowed a connection because there is no secure network connection. + // - [Disabled] ATS settings do not change at runtime. + //.appTransportSecurityRequiresSecureConnection, + + // [System] An app or app extension attempted to connect to a background session that is already connected to a + // process. + // - [Enabled] The other process could release the background session. + .backgroundSessionInUseByAnotherProcess, + + // [System] The shared container identifier of the URL session configuration is needed but has not been set. + // - [Disabled] Cannot change at runtime. + //.backgroundSessionRequiresSharedContainer, + + // [System] The app is suspended or exits while a background data task is processing. + // - [Enabled] App can be foregrounded or launched to recover. + .backgroundSessionWasDisconnected, + + // [Network] The URL Loading system received bad data from the server. + // - [Enabled] Server could return valid data when retrying. + .badServerResponse, + + // [Resource] A malformed URL prevented a URL request from being initiated. + // - [Disabled] URL was most likely constructed incorrectly. + //.badURL, + + // [System] A connection was attempted while a phone call is active on a network that does not support + // simultaneous phone and data communication (EDGE or GPRS). + // - [Enabled] Phone call could be ended to allow request to recover. + .callIsActive, + + // [Client] An asynchronous load has been canceled. + // - [Disabled] Request was cancelled by the client. + //.cancelled, + + // [File System] A download task couldn’t close the downloaded file on disk. + // - [Disabled] File system error is unlikely to recover with retry. + //.cannotCloseFile, + + // [Network] An attempt to connect to a host failed. + // - [Enabled] Server or DNS lookup could recover during retry. + .cannotConnectToHost, + + // [File System] A download task couldn’t create the downloaded file on disk because of an I/O failure. + // - [Disabled] File system error is unlikely to recover with retry. + //.cannotCreateFile, + + // [Data] Content data received during a connection request had an unknown content encoding. + // - [Disabled] Server is unlikely to modify the content encoding during a retry. + //.cannotDecodeContentData, + + // [Data] Content data received during a connection request could not be decoded for a known content encoding. + // - [Disabled] Server is unlikely to modify the content encoding during a retry. + //.cannotDecodeRawData, + + // [Network] The host name for a URL could not be resolved. + // - [Enabled] Server or DNS lookup could recover during retry. + .cannotFindHost, + + // [Network] A request to load an item only from the cache could not be satisfied. + // - [Enabled] Cache could be populated during a retry. + .cannotLoadFromNetwork, + + // [File System] A download task was unable to move a downloaded file on disk. + // - [Disabled] File system error is unlikely to recover with retry. + //.cannotMoveFile, + + // [File System] A download task was unable to open the downloaded file on disk. + // - [Disabled] File system error is unlikely to recover with retry. + //.cannotOpenFile, + + // [Data] A task could not parse a response. + // - [Disabled] Invalid response is unlikely to recover with retry. + //.cannotParseResponse, + + // [File System] A download task was unable to remove a downloaded file from disk. + // - [Disabled] File system error is unlikely to recover with retry. + //.cannotRemoveFile, + + // [File System] A download task was unable to write to the downloaded file on disk. + // - [Disabled] File system error is unlikely to recover with retry. + //.cannotWriteToFile, + + // [Security] A client certificate was rejected. + // - [Disabled] Client certificate is unlikely to change with retry. + //.clientCertificateRejected, + + // [Security] A client certificate was required to authenticate an SSL connection during a request. + // - [Disabled] Client certificate is unlikely to be provided with retry. + //.clientCertificateRequired, + + // [Data] The length of the resource data exceeds the maximum allowed. + // - [Disabled] Resource will likely still exceed the length maximum on retry. + //.dataLengthExceedsMaximum, + + // [System] The cellular network disallowed a connection. + // - [Enabled] WiFi connection could be established during retry. + .dataNotAllowed, + + // [Network] The host address could not be found via DNS lookup. + // - [Enabled] DNS lookup could succeed during retry. + .dnsLookupFailed, + + // [Data] A download task failed to decode an encoded file during the download. + // - [Enabled] Server could correct the decoding issue with retry. + .downloadDecodingFailedMidStream, + + // [Data] A download task failed to decode an encoded file after downloading. + // - [Enabled] Server could correct the decoding issue with retry. + .downloadDecodingFailedToComplete, + + // [File System] A file does not exist. + // - [Disabled] File system error is unlikely to recover with retry. + //.fileDoesNotExist, + + // [File System] A request for an FTP file resulted in the server responding that the file is not a plain file, + // but a directory. + // - [Disabled] FTP directory is not likely to change to a file during a retry. + //.fileIsDirectory, + + // [Network] A redirect loop has been detected or the threshold for number of allowable redirects has been + // exceeded (currently 16). + // - [Disabled] The redirect loop is unlikely to be resolved within the retry window. + //.httpTooManyRedirects, + + // [System] The attempted connection required activating a data context while roaming, but international roaming + // is disabled. + // - [Enabled] WiFi connection could be established during retry. + .internationalRoamingOff, + + // [Connectivity] A client or server connection was severed in the middle of an in-progress load. + // - [Enabled] A network connection could be established during retry. + .networkConnectionLost, + + // [File System] A resource couldn’t be read because of insufficient permissions. + // - [Disabled] Permissions are unlikely to be granted during retry. + //.noPermissionsToReadFile, + + // [Connectivity] A network resource was requested, but an internet connection has not been established and + // cannot be established automatically. + // - [Enabled] A network connection could be established during retry. + .notConnectedToInternet, + + // [Resource] A redirect was specified by way of server response code, but the server did not accompany this + // code with a redirect URL. + // - [Disabled] The redirect URL is unlikely to be supplied during a retry. + //.redirectToNonExistentLocation, + + // [Client] A body stream is needed but the client did not provide one. + // - [Disabled] The client will be unlikely to supply a body stream during retry. + //.requestBodyStreamExhausted, + + // [Resource] A requested resource couldn’t be retrieved. + // - [Disabled] The resource is unlikely to become available during the retry window. + //.resourceUnavailable, + + // [Security] An attempt to establish a secure connection failed for reasons that can’t be expressed more + // specifically. + // - [Enabled] The secure connection could be established during a retry given the lack of specificity + // provided by the error. + .secureConnectionFailed, + + // [Security] A server certificate had a date which indicates it has expired, or is not yet valid. + // - [Enabled] The server certificate could become valid within the retry window. + .serverCertificateHasBadDate, + + // [Security] A server certificate was not signed by any root server. + // - [Disabled] The server certificate is unlikely to change during the retry window. + //.serverCertificateHasUnknownRoot, + + // [Security] A server certificate is not yet valid. + // - [Enabled] The server certificate could become valid within the retry window. + .serverCertificateNotYetValid, + + // [Security] A server certificate was signed by a root server that isn’t trusted. + // - [Disabled] The server certificate is unlikely to become trusted within the retry window. + //.serverCertificateUntrusted, + + // [Network] An asynchronous operation timed out. + // - [Enabled] The request timed out for an unknown reason and should be retried. + .timedOut + + // [System] The URL Loading System encountered an error that it can’t interpret. + // - [Disabled] The error could not be interpreted and is unlikely to be recovered from during a retry. + //.unknown, + + // [Resource] A properly formed URL couldn’t be handled by the framework. + // - [Disabled] The URL is unlikely to change during a retry. + //.unsupportedURL, + + // [Client] Authentication is required to access a resource. + // - [Disabled] The user authentication is unlikely to be provided by retrying. + //.userAuthenticationRequired, + + // [Client] An asynchronous request for authentication has been canceled by the user. + // - [Disabled] The user cancelled authentication and explicitly took action to not retry. + //.userCancelledAuthentication, + + // [Resource] A server reported that a URL has a non-zero content length, but terminated the network connection + // gracefully without sending any data. + // - [Disabled] The server is unlikely to provide data during the retry window. + //.zeroByteResource, + ] + + /// The total number of times the request is allowed to be retried. + public let retryLimit: UInt + + /// The base of the exponential backoff policy (should always be greater than or equal to 2). + public let exponentialBackoffBase: UInt + + /// The scale of the exponential backoff. + public let exponentialBackoffScale: Double + + /// The HTTP methods that are allowed to be retried. + public let retryableHTTPMethods: Set + + /// The HTTP status codes that are automatically retried by the policy. + public let retryableHTTPStatusCodes: Set + + /// The URL error codes that are automatically retried by the policy. + public let retryableURLErrorCodes: Set + + /// Creates an `ExponentialBackoffRetryPolicy` from the specified parameters. + /// + /// - Parameters: + /// - retryLimit: The total number of times the request is allowed to be retried. `2` by default. + /// - exponentialBackoffBase: The base of the exponential backoff policy. `2` by default. + /// - exponentialBackoffScale: The scale of the exponential backoff. `0.5` by default. + /// - retryableHTTPMethods: The HTTP methods that are allowed to be retried. + /// `RetryPolicy.defaultRetryableHTTPMethods` by default. + /// - retryableHTTPStatusCodes: The HTTP status codes that are automatically retried by the policy. + /// `RetryPolicy.defaultRetryableHTTPStatusCodes` by default. + /// - retryableURLErrorCodes: The URL error codes that are automatically retried by the policy. + /// `RetryPolicy.defaultRetryableURLErrorCodes` by default. + public init( + retryLimit: UInt = RetryPolicy.defaultRetryLimit, + exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase, + exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale, + retryableHTTPMethods: Set = RetryPolicy.defaultRetryableHTTPMethods, + retryableHTTPStatusCodes: Set = RetryPolicy.defaultRetryableHTTPStatusCodes, + retryableURLErrorCodes: Set = RetryPolicy.defaultRetryableURLErrorCodes) + { + precondition(exponentialBackoffBase >= 2, "The `exponentialBackoffBase` must be a minimum of 2.") + + self.retryLimit = retryLimit + self.exponentialBackoffBase = exponentialBackoffBase + self.exponentialBackoffScale = exponentialBackoffScale + self.retryableHTTPMethods = retryableHTTPMethods + self.retryableHTTPStatusCodes = retryableHTTPStatusCodes + self.retryableURLErrorCodes = retryableURLErrorCodes + } + + open func retry( + _ request: Request, + for session: Session, + dueTo error: Error, + completion: @escaping (RetryResult) -> Void) + { + if + request.retryCount < retryLimit, + let httpMethod = request.request?.method, + retryableHTTPMethods.contains(httpMethod), + shouldRetry(response: request.response, error: error) + { + let timeDelay = pow(Double(exponentialBackoffBase), Double(request.retryCount)) * exponentialBackoffScale + completion(.retryWithDelay(timeDelay)) + } else { + completion(.doNotRetry) + } + } + + private func shouldRetry(response: HTTPURLResponse?, error: Error) -> Bool { + if let statusCode = response?.statusCode, retryableHTTPStatusCodes.contains(statusCode) { + return true + } else if let errorCode = (error as? URLError)?.code, retryableURLErrorCodes.contains(errorCode) { + return true + } + + return false + } +} + +// MARK: - + +/// A retry policy that automatically retries idempotent requests for network connection lost errors. For more +/// information about retrying network connection lost errors, please refer to Apple's +/// [technical document](https://developer.apple.com/library/content/qa/qa1941/_index.html). +open class ConnectionLostRetryPolicy: RetryPolicy { + /// Creates a `ConnectionLostRetryPolicy` instance from the specified parameters. + /// + /// - Parameters: + /// - retryLimit: The total number of times the request is allowed to be retried. + /// `RetryPolicy.defaultRetryLimit` by default. + /// - exponentialBackoffBase: The base of the exponential backoff policy. + /// `RetryPolicy.defaultExponentialBackoffBase` by default. + /// - exponentialBackoffScale: The scale of the exponential backoff. + /// `RetryPolicy.defaultExponentialBackoffScale` by default. + /// - retryableHTTPMethods: The idempotent http methods to retry. + /// `RetryPolicy.defaultRetryableHTTPMethods` by default. + public init( + retryLimit: UInt = RetryPolicy.defaultRetryLimit, + exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase, + exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale, + retryableHTTPMethods: Set = RetryPolicy.defaultRetryableHTTPMethods) + { + super.init( + retryLimit: retryLimit, + exponentialBackoffBase: exponentialBackoffBase, + exponentialBackoffScale: exponentialBackoffScale, + retryableHTTPMethods: retryableHTTPMethods, + retryableHTTPStatusCodes: [], + retryableURLErrorCodes: [.networkConnectionLost] + ) + } +} diff --git a/Example/Pods/Alamofire/Source/ServerTrustEvaluation.swift b/Example/Pods/Alamofire/Source/ServerTrustEvaluation.swift new file mode 100644 index 0000000..690113b --- /dev/null +++ b/Example/Pods/Alamofire/Source/ServerTrustEvaluation.swift @@ -0,0 +1,553 @@ +// +// ServerTrustPolicy.swift +// +// Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Responsible for managing the mapping of `ServerTrustEvaluating` values to given hosts. +open class ServerTrustManager { + /// Determines whether all hosts for this `ServerTrustManager` must be evaluated. Defaults to `true`. + public let allHostsMustBeEvaluated: Bool + + /// The dictionary of policies mapped to a particular host. + public let evaluators: [String: ServerTrustEvaluating] + + /// Initializes the `ServerTrustManager` instance with the given evaluators. + /// + /// Since different servers and web services can have different leaf certificates, intermediate and even root + /// certficates, it is important to have the flexibility to specify evaluation policies on a per host basis. This + /// allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key + /// pinning for host3 and disabling evaluation for host4. + /// + /// - Parameters: + /// - allHostsMustBeEvaluated: The value determining whether all hosts for this instance must be evaluated. + /// Defaults to `true`. + /// - evaluators: A dictionary of evaluators mappend to hosts. + public init(allHostsMustBeEvaluated: Bool = true, evaluators: [String: ServerTrustEvaluating]) { + self.allHostsMustBeEvaluated = allHostsMustBeEvaluated + self.evaluators = evaluators + } + + /// Returns the `ServerTrustEvaluating` value for the given host, if one is set. + /// + /// By default, this method will return the policy that perfectly matches the given host. Subclasses could override + /// this method and implement more complex mapping implementations such as wildcards. + /// + /// - Parameter host: The host to use when searching for a matching policy. + /// - Returns: The `ServerTrustEvaluating` value for the given host if found, `nil` otherwise. + /// - Throws: `AFError.serverTrustEvaluationFailed` if `allHostsMustBeEvaluated` is `true` and no matching + /// evaluators are found. + open func serverTrustEvaluator(forHost host: String) throws -> ServerTrustEvaluating? { + guard let evaluator = evaluators[host] else { + if allHostsMustBeEvaluated { + throw AFError.serverTrustEvaluationFailed(reason: .noRequiredEvaluator(host: host)) + } + + return nil + } + + return evaluator + } +} + +/// A protocol describing the API used to evaluate server trusts. +public protocol ServerTrustEvaluating { + #if os(Linux) + // Implement this once Linux has API for evaluating server trusts. + #else + /// Evaluates the given `SecTrust` value for the given `host`. + /// + /// - Parameters: + /// - trust: The `SecTrust` value to evaluate. + /// - host: The host for which to evaluate the `SecTrust` value. + /// - Returns: A `Bool` indicating whether the evaluator considers the `SecTrust` value valid for `host`. + func evaluate(_ trust: SecTrust, forHost host: String) throws + #endif +} + +// MARK: - Server Trust Evaluators + +/// An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the +/// host provided by the challenge. Applications are encouraged to always validate the host in production environments +/// to guarantee the validity of the server's certificate chain. +public final class DefaultTrustEvaluator: ServerTrustEvaluating { + private let validateHost: Bool + + /// Creates a `DefaultTrustEvalutor`. + /// + /// - Parameter validateHost: Determines whether or not the evaluator should validate the host. Defaults to `true`. + public init(validateHost: Bool = true) { + self.validateHost = validateHost + } + + public func evaluate(_ trust: SecTrust, forHost host: String) throws { + if validateHost { + try trust.af.performValidation(forHost: host) + } + + try trust.af.performDefaultValidation(forHost: host) + } +} + +/// An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate +/// the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates. +/// Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS +/// 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production +/// environments to guarantee the validity of the server's certificate chain. +public final class RevocationTrustEvaluator: ServerTrustEvaluating { + /// Represents the options to be use when evaluating the status of a certificate. + /// Only Revocation Policy Constants are valid, and can be found in [Apple's documentation](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/policies/1563600-revocation_policy_constants). + public struct Options: OptionSet { + /// Perform revocation checking using the CRL (Certification Revocation List) method. + public static let crl = Options(rawValue: kSecRevocationCRLMethod) + /// Consult only locally cached replies; do not use network access. + public static let networkAccessDisabled = Options(rawValue: kSecRevocationNetworkAccessDisabled) + /// Perform revocation checking using OCSP (Online Certificate Status Protocol). + public static let ocsp = Options(rawValue: kSecRevocationOCSPMethod) + /// Prefer CRL revocation checking over OCSP; by default, OCSP is preferred. + public static let preferCRL = Options(rawValue: kSecRevocationPreferCRL) + /// Require a positive response to pass the policy. If the flag is not set, revocation checking is done on a + /// "best attempt" basis, where failure to reach the server is not considered fatal. + public static let requirePositiveResponse = Options(rawValue: kSecRevocationRequirePositiveResponse) + /// Perform either OCSP or CRL checking. The checking is performed according to the method(s) specified in the + /// certificate and the value of `preferCRL`. + public static let any = Options(rawValue: kSecRevocationUseAnyAvailableMethod) + + /// The raw value of the option. + public let rawValue: CFOptionFlags + + /// Creates an `Options` value with the given `CFOptionFlags`. + /// + /// - Parameter rawValue: The `CFOptionFlags` value to initialize with. + public init(rawValue: CFOptionFlags) { + self.rawValue = rawValue + } + } + + private let performDefaultValidation: Bool + private let validateHost: Bool + private let options: Options + + /// Creates a `RevocationTrustEvaluator`. + /// + /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use + /// `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates. + /// + /// - Parameters: + /// - performDefaultValidation: Determines whether default validation should be performed in addition to + /// evaluating the pinned certificates. Defaults to `true`. + /// - validateHost: Determines whether or not the evaluator should validate the host, in addition + /// to performing the default evaluation, even if `performDefaultValidation` is + /// `false`. Defaults to `true`. + /// - options: The `Options` to use to check the revocation status of the certificate. Defaults to `.any`. + public init(performDefaultValidation: Bool = true, validateHost: Bool = true, options: Options = .any) { + self.performDefaultValidation = performDefaultValidation + self.validateHost = validateHost + self.options = options + } + + public func evaluate(_ trust: SecTrust, forHost host: String) throws { + if performDefaultValidation { + try trust.af.performDefaultValidation(forHost: host) + } + + if validateHost { + try trust.af.performValidation(forHost: host) + } + + try trust.af.validate(policy: SecPolicy.af.revocation(options: options)) { (status, result) in + AFError.serverTrustEvaluationFailed(reason: .revocationCheckFailed(output: .init(host, trust, status, result), options: options)) + } + } +} + +/// Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned +/// certificates match one of the server certificates. By validating both the certificate chain and host, certificate +/// pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. +/// Applications are encouraged to always validate the host and require a valid certificate chain in production +/// environments. +public final class PinnedCertificatesTrustEvaluator: ServerTrustEvaluating { + private let certificates: [SecCertificate] + private let acceptSelfSignedCertificates: Bool + private let performDefaultValidation: Bool + private let validateHost: Bool + + /// Creates a `PinnedCertificatesTrustEvaluator`. + /// + /// - Parameters: + /// - certificates: The certificates to use to evalute the trust. Defaults to all `cer`, `crt`, + /// `der` certificates in `Bundle.main`. + /// - acceptSelfSignedCertificates: Adds the provided certificates as anchors for the trust evaulation, allowing + /// self-signed certificates to pass. Defaults to `false`. THIS SETTING SHOULD BE + /// FALSE IN PRODUCTION! + /// - performDefaultValidation: Determines whether default validation should be performed in addition to + /// evaluating the pinned certificates. Defaults to `true`. + /// - validateHost: Determines whether or not the evaluator should validate the host, in addition + /// to performing the default evaluation, even if `performDefaultValidation` is + /// `false`. Defaults to `true`. + public init(certificates: [SecCertificate] = Bundle.main.af.certificates, + acceptSelfSignedCertificates: Bool = false, + performDefaultValidation: Bool = true, + validateHost: Bool = true) { + self.certificates = certificates + self.acceptSelfSignedCertificates = acceptSelfSignedCertificates + self.performDefaultValidation = performDefaultValidation + self.validateHost = validateHost + } + + public func evaluate(_ trust: SecTrust, forHost host: String) throws { + guard !certificates.isEmpty else { + throw AFError.serverTrustEvaluationFailed(reason: .noCertificatesFound) + } + + if acceptSelfSignedCertificates { + try trust.af.setAnchorCertificates(certificates) + } + + if performDefaultValidation { + try trust.af.performDefaultValidation(forHost: host) + } + + if validateHost { + try trust.af.performValidation(forHost: host) + } + + let serverCertificatesData = Set(trust.af.certificateData) + let pinnedCertificatesData = Set(certificates.af.data) + let pinnedCertificatesInServerData = !serverCertificatesData.isDisjoint(with: pinnedCertificatesData) + if !pinnedCertificatesInServerData { + throw AFError.serverTrustEvaluationFailed(reason: .certificatePinningFailed(host: host, + trust: trust, + pinnedCertificates: certificates, + serverCertificates: trust.af.certificates)) + } + } +} + +/// Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned +/// public keys match one of the server certificate public keys. By validating both the certificate chain and host, +/// public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks. +/// Applications are encouraged to always validate the host and require a valid certificate chain in production +/// environments. +public final class PublicKeysTrustEvaluator: ServerTrustEvaluating { + private let keys: [SecKey] + private let performDefaultValidation: Bool + private let validateHost: Bool + + /// Creates a `PublicKeysTrustEvaluator`. + /// + /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use + /// `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates. + /// + /// - Parameters: + /// - keys: The `SecKey`s to use to validate public keys. Defaults to the public keys of all + /// certificates included in the main bundle. + /// - performDefaultValidation: Determines whether default validation should be performed in addition to + /// evaluating the pinned certificates. Defaults to `true`. + /// - validateHost: Determines whether or not the evaluator should validate the host, in addition to + /// performing the default evaluation, even if `performDefaultValidation` is `false`. + /// Defaults to `true`. + public init(keys: [SecKey] = Bundle.main.af.publicKeys, + performDefaultValidation: Bool = true, + validateHost: Bool = true) { + self.keys = keys + self.performDefaultValidation = performDefaultValidation + self.validateHost = validateHost + } + + public func evaluate(_ trust: SecTrust, forHost host: String) throws { + guard !keys.isEmpty else { + throw AFError.serverTrustEvaluationFailed(reason: .noPublicKeysFound) + } + + if performDefaultValidation { + try trust.af.performDefaultValidation(forHost: host) + } + + if validateHost { + try trust.af.performValidation(forHost: host) + } + + let pinnedKeysInServerKeys: Bool = { + for serverPublicKey in trust.af.publicKeys { + for pinnedPublicKey in keys { + if serverPublicKey == pinnedPublicKey { + return true + } + } + } + return false + }() + + if !pinnedKeysInServerKeys { + throw AFError.serverTrustEvaluationFailed(reason: .publicKeyPinningFailed(host: host, + trust: trust, + pinnedKeys: keys, + serverKeys: trust.af.publicKeys)) + } + } +} + +/// Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the +/// evaluators consider it valid. +public final class CompositeTrustEvaluator: ServerTrustEvaluating { + private let evaluators: [ServerTrustEvaluating] + + /// Creates a `CompositeTrustEvaluator`. + /// + /// - Parameter evaluators: The `ServerTrustEvaluating` values used to evaluate the server trust. + public init(evaluators: [ServerTrustEvaluating]) { + self.evaluators = evaluators + } + + public func evaluate(_ trust: SecTrust, forHost host: String) throws { + try evaluators.evaluate(trust, forHost: host) + } +} + +/// Disables all evaluation which in turn will always consider any server trust as valid. +/// +/// THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION! +public final class DisabledEvaluator: ServerTrustEvaluating { + public init() { } + + public func evaluate(_ trust: SecTrust, forHost host: String) throws { } +} + +// MARK: - Extensions + +public extension Array where Element == ServerTrustEvaluating { + #if os(Linux) + // Add this same convenience method for Linux. + #else + /// Evaluates the given `SecTrust` value for the given `host`. + /// + /// - Parameters: + /// - trust: The `SecTrust` value to evaluate. + /// - host: The host for which to evaluate the `SecTrust` value. + /// - Returns: Whether or not the evaluator considers the `SecTrust` value valid for `host`. + func evaluate(_ trust: SecTrust, forHost host: String) throws { + for evaluator in self { + try evaluator.evaluate(trust, forHost: host) + } + } + #endif +} + +extension Bundle: AlamofireExtended {} +public extension AlamofireExtension where ExtendedType: Bundle { + /// Returns all valid `cer`, `crt`, and `der` certificates in the bundle. + var certificates: [SecCertificate] { + return paths(forResourcesOfTypes: [".cer", ".CER", ".crt", ".CRT", ".der", ".DER"]).compactMap { path in + guard + let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData, + let certificate = SecCertificateCreateWithData(nil, certificateData) else { return nil } + + return certificate + } + } + + /// Returns all public keys for the valid certificates in the bundle. + var publicKeys: [SecKey] { + return certificates.af.publicKeys + } + + /// Returns all pathnames for the resources identified by the provided file extensions. + /// + /// - Parameter types: The filename extensions locate. + /// - Returns: All pathnames for the given filename extensions. + func paths(forResourcesOfTypes types: [String]) -> [String] { + return Array(Set(types.flatMap { type.paths(forResourcesOfType: $0, inDirectory: nil) })) + } +} + +extension SecTrust: AlamofireExtended {} +public extension AlamofireExtension where ExtendedType == SecTrust { + /// Attempts to validate `self` using the policy provided and transforming any error produced using the closure passed. + /// + /// - Parameters: + /// - policy: The `SecPolicy` used to evaluate `self`. + /// - errorProducer: The closure used transform the failed `OSStatus` and `SecTrustResultType`. + /// - Throws: Any error from applying the `policy`, or the result of `errorProducer` if validation fails. + func validate(policy: SecPolicy, errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws { + try apply(policy: policy).af.validate(errorProducer: errorProducer) + } + + /// Applies a `SecPolicy` to `self`, throwing if it fails. + /// + /// - Parameter policy: The `SecPolicy`. + /// - Returns: `self`, with the policy applied. + /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.policyApplicationFailed` reason. + func apply(policy: SecPolicy) throws -> SecTrust { + let status = SecTrustSetPolicies(type, policy) + + guard status.af.isSuccess else { + throw AFError.serverTrustEvaluationFailed(reason: .policyApplicationFailed(trust: type, + policy: policy, + status: status)) + } + + return type + } + + /// Validate `self`, passing any failure values through `errorProducer`. + /// + /// - Parameter errorProducer: The closure used to transform the failed `OSStatus` and `SecTrustResultType` into an + /// `Error`. + /// - Throws: The `Error` produced by the `errorProducer` closure. + func validate(errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws { + var result = SecTrustResultType.invalid + let status = SecTrustEvaluate(type, &result) + + guard status.af.isSuccess && result.af.isSuccess else { + throw errorProducer(status, result) + } + } + + /// Sets a custom certificate chain on `self`, allowing full validation of a self-signed certificate and its chain. + /// + /// - Parameter certificates: The `SecCertificate`s to add to the chain. + /// - Throws: Any error produced when applying the new certificate chain. + func setAnchorCertificates(_ certificates: [SecCertificate]) throws { + // Add additional anchor certificates. + let status = SecTrustSetAnchorCertificates(type, certificates as CFArray) + guard status.af.isSuccess else { + throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: status, + certificates: certificates)) + } + + // Reenable system anchor certificates. + let systemStatus = SecTrustSetAnchorCertificatesOnly(type, true) + guard systemStatus.af.isSuccess else { + throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: systemStatus, + certificates: certificates)) + } + } + + /// The public keys contained in `self`. + var publicKeys: [SecKey] { + return certificates.af.publicKeys + } + + /// The `SecCertificate`s contained i `self`. + var certificates: [SecCertificate] { + return (0.. SecPolicy { + return SecPolicyCreateSSL(true, hostname as CFString) + } + + /// Creates a `SecPolicy` which checks the revocation of certificates. + /// + /// - Parameter options: The `RevocationTrustEvaluator.Options` for evaluation. + /// - Returns: The `SecPolicy`. + /// - Throws: An `AFError.serverTrustEvaluationFailed` error with reason `.revocationPolicyCreationFailed` + /// if the policy cannot be created. + static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicy { + guard let policy = SecPolicyCreateRevocation(options.rawValue) else { + throw AFError.serverTrustEvaluationFailed(reason: .revocationPolicyCreationFailed) + } + + return policy + } +} + +extension Array: AlamofireExtended {} +public extension AlamofireExtension where ExtendedType == Array { + /// All `Data` values for the contained `SecCertificate`s. + var data: [Data] { + return type.map { SecCertificateCopyData($0) as Data } + } + + /// All public `SecKey` values for the contained `SecCertificate`s. + var publicKeys: [SecKey] { + return type.compactMap { $0.af.publicKey } + } +} + +extension SecCertificate: AlamofireExtended {} +public extension AlamofireExtension where ExtendedType == SecCertificate { + /// The public key for `self`, if it can be extracted. + var publicKey: SecKey? { + let policy = SecPolicyCreateBasicX509() + var trust: SecTrust? + let trustCreationStatus = SecTrustCreateWithCertificates(type, policy, &trust) + + guard let createdTrust = trust, trustCreationStatus == errSecSuccess else { return nil } + + return SecTrustCopyPublicKey(createdTrust) + } +} + +extension OSStatus: AlamofireExtended {} +public extension AlamofireExtension where ExtendedType == OSStatus { + /// Returns whether `self` is `errSecSuccess`. + var isSuccess: Bool { return type == errSecSuccess } +} + +extension SecTrustResultType: AlamofireExtended {} +public extension AlamofireExtension where ExtendedType == SecTrustResultType { + /// Returns whether `self is `.unspecified` or `.proceed`. + var isSuccess: Bool { + return (type == .unspecified || type == .proceed) + } +} diff --git a/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift b/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift deleted file mode 100644 index dea099e..0000000 --- a/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +++ /dev/null @@ -1,307 +0,0 @@ -// -// ServerTrustPolicy.swift -// -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import Foundation - -/// Responsible for managing the mapping of `ServerTrustPolicy` objects to a given host. -open class ServerTrustPolicyManager { - /// The dictionary of policies mapped to a particular host. - public let policies: [String: ServerTrustPolicy] - - /// Initializes the `ServerTrustPolicyManager` instance with the given policies. - /// - /// Since different servers and web services can have different leaf certificates, intermediate and even root - /// certficates, it is important to have the flexibility to specify evaluation policies on a per host basis. This - /// allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key - /// pinning for host3 and disabling evaluation for host4. - /// - /// - parameter policies: A dictionary of all policies mapped to a particular host. - /// - /// - returns: The new `ServerTrustPolicyManager` instance. - public init(policies: [String: ServerTrustPolicy]) { - self.policies = policies - } - - /// Returns the `ServerTrustPolicy` for the given host if applicable. - /// - /// By default, this method will return the policy that perfectly matches the given host. Subclasses could override - /// this method and implement more complex mapping implementations such as wildcards. - /// - /// - parameter host: The host to use when searching for a matching policy. - /// - /// - returns: The server trust policy for the given host if found. - open func serverTrustPolicy(forHost host: String) -> ServerTrustPolicy? { - return policies[host] - } -} - -// MARK: - - -extension URLSession { - private struct AssociatedKeys { - static var managerKey = "URLSession.ServerTrustPolicyManager" - } - - var serverTrustPolicyManager: ServerTrustPolicyManager? { - get { - return objc_getAssociatedObject(self, &AssociatedKeys.managerKey) as? ServerTrustPolicyManager - } - set (manager) { - objc_setAssociatedObject(self, &AssociatedKeys.managerKey, manager, .OBJC_ASSOCIATION_RETAIN_NONATOMIC) - } - } -} - -// MARK: - ServerTrustPolicy - -/// The `ServerTrustPolicy` evaluates the server trust generally provided by an `NSURLAuthenticationChallenge` when -/// connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust -/// with a given set of criteria to determine whether the server trust is valid and the connection should be made. -/// -/// Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other -/// vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged -/// to route all communication over an HTTPS connection with pinning enabled. -/// -/// - performDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to -/// validate the host provided by the challenge. Applications are encouraged to always -/// validate the host in production environments to guarantee the validity of the server's -/// certificate chain. -/// -/// - performRevokedEvaluation: Uses the default and revoked server trust evaluations allowing you to control whether to -/// validate the host provided by the challenge as well as specify the revocation flags for -/// testing for revoked certificates. Apple platforms did not start testing for revoked -/// certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is -/// demonstrated in our TLS tests. Applications are encouraged to always validate the host -/// in production environments to guarantee the validity of the server's certificate chain. -/// -/// - pinCertificates: Uses the pinned certificates to validate the server trust. The server trust is -/// considered valid if one of the pinned certificates match one of the server certificates. -/// By validating both the certificate chain and host, certificate pinning provides a very -/// secure form of server trust validation mitigating most, if not all, MITM attacks. -/// Applications are encouraged to always validate the host and require a valid certificate -/// chain in production environments. -/// -/// - pinPublicKeys: Uses the pinned public keys to validate the server trust. The server trust is considered -/// valid if one of the pinned public keys match one of the server certificate public keys. -/// By validating both the certificate chain and host, public key pinning provides a very -/// secure form of server trust validation mitigating most, if not all, MITM attacks. -/// Applications are encouraged to always validate the host and require a valid certificate -/// chain in production environments. -/// -/// - disableEvaluation: Disables all evaluation which in turn will always consider any server trust as valid. -/// -/// - customEvaluation: Uses the associated closure to evaluate the validity of the server trust. -public enum ServerTrustPolicy { - case performDefaultEvaluation(validateHost: Bool) - case performRevokedEvaluation(validateHost: Bool, revocationFlags: CFOptionFlags) - case pinCertificates(certificates: [SecCertificate], validateCertificateChain: Bool, validateHost: Bool) - case pinPublicKeys(publicKeys: [SecKey], validateCertificateChain: Bool, validateHost: Bool) - case disableEvaluation - case customEvaluation((_ serverTrust: SecTrust, _ host: String) -> Bool) - - // MARK: - Bundle Location - - /// Returns all certificates within the given bundle with a `.cer` file extension. - /// - /// - parameter bundle: The bundle to search for all `.cer` files. - /// - /// - returns: All certificates within the given bundle. - public static func certificates(in bundle: Bundle = Bundle.main) -> [SecCertificate] { - var certificates: [SecCertificate] = [] - - let paths = Set([".cer", ".CER", ".crt", ".CRT", ".der", ".DER"].map { fileExtension in - bundle.paths(forResourcesOfType: fileExtension, inDirectory: nil) - }.joined()) - - for path in paths { - if - let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData, - let certificate = SecCertificateCreateWithData(nil, certificateData) - { - certificates.append(certificate) - } - } - - return certificates - } - - /// Returns all public keys within the given bundle with a `.cer` file extension. - /// - /// - parameter bundle: The bundle to search for all `*.cer` files. - /// - /// - returns: All public keys within the given bundle. - public static func publicKeys(in bundle: Bundle = Bundle.main) -> [SecKey] { - var publicKeys: [SecKey] = [] - - for certificate in certificates(in: bundle) { - if let publicKey = publicKey(for: certificate) { - publicKeys.append(publicKey) - } - } - - return publicKeys - } - - // MARK: - Evaluation - - /// Evaluates whether the server trust is valid for the given host. - /// - /// - parameter serverTrust: The server trust to evaluate. - /// - parameter host: The host of the challenge protection space. - /// - /// - returns: Whether the server trust is valid. - public func evaluate(_ serverTrust: SecTrust, forHost host: String) -> Bool { - var serverTrustIsValid = false - - switch self { - case let .performDefaultEvaluation(validateHost): - let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) - SecTrustSetPolicies(serverTrust, policy) - - serverTrustIsValid = trustIsValid(serverTrust) - case let .performRevokedEvaluation(validateHost, revocationFlags): - let defaultPolicy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) - let revokedPolicy = SecPolicyCreateRevocation(revocationFlags) - SecTrustSetPolicies(serverTrust, [defaultPolicy, revokedPolicy] as CFTypeRef) - - serverTrustIsValid = trustIsValid(serverTrust) - case let .pinCertificates(pinnedCertificates, validateCertificateChain, validateHost): - if validateCertificateChain { - let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) - SecTrustSetPolicies(serverTrust, policy) - - SecTrustSetAnchorCertificates(serverTrust, pinnedCertificates as CFArray) - SecTrustSetAnchorCertificatesOnly(serverTrust, true) - - serverTrustIsValid = trustIsValid(serverTrust) - } else { - let serverCertificatesDataArray = certificateData(for: serverTrust) - let pinnedCertificatesDataArray = certificateData(for: pinnedCertificates) - - outerLoop: for serverCertificateData in serverCertificatesDataArray { - for pinnedCertificateData in pinnedCertificatesDataArray { - if serverCertificateData == pinnedCertificateData { - serverTrustIsValid = true - break outerLoop - } - } - } - } - case let .pinPublicKeys(pinnedPublicKeys, validateCertificateChain, validateHost): - var certificateChainEvaluationPassed = true - - if validateCertificateChain { - let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil) - SecTrustSetPolicies(serverTrust, policy) - - certificateChainEvaluationPassed = trustIsValid(serverTrust) - } - - if certificateChainEvaluationPassed { - outerLoop: for serverPublicKey in ServerTrustPolicy.publicKeys(for: serverTrust) as [AnyObject] { - for pinnedPublicKey in pinnedPublicKeys as [AnyObject] { - if serverPublicKey.isEqual(pinnedPublicKey) { - serverTrustIsValid = true - break outerLoop - } - } - } - } - case .disableEvaluation: - serverTrustIsValid = true - case let .customEvaluation(closure): - serverTrustIsValid = closure(serverTrust, host) - } - - return serverTrustIsValid - } - - // MARK: - Private - Trust Validation - - private func trustIsValid(_ trust: SecTrust) -> Bool { - var isValid = false - - var result = SecTrustResultType.invalid - let status = SecTrustEvaluate(trust, &result) - - if status == errSecSuccess { - let unspecified = SecTrustResultType.unspecified - let proceed = SecTrustResultType.proceed - - - isValid = result == unspecified || result == proceed - } - - return isValid - } - - // MARK: - Private - Certificate Data - - private func certificateData(for trust: SecTrust) -> [Data] { - var certificates: [SecCertificate] = [] - - for index in 0.. [Data] { - return certificates.map { SecCertificateCopyData($0) as Data } - } - - // MARK: - Private - Public Key Extraction - - private static func publicKeys(for trust: SecTrust) -> [SecKey] { - var publicKeys: [SecKey] = [] - - for index in 0.. SecKey? { - var publicKey: SecKey? - - let policy = SecPolicyCreateBasicX509() - var trust: SecTrust? - let trustCreationStatus = SecTrustCreateWithCertificates(certificate, policy, &trust) - - if let trust = trust, trustCreationStatus == errSecSuccess { - publicKey = SecTrustCopyPublicKey(trust) - } - - return publicKey - } -} diff --git a/Example/Pods/Alamofire/Source/Session.swift b/Example/Pods/Alamofire/Source/Session.swift new file mode 100644 index 0000000..336ab8a --- /dev/null +++ b/Example/Pods/Alamofire/Source/Session.swift @@ -0,0 +1,584 @@ +// +// Session.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +open class Session { + public static let `default` = Session() + + public let delegate: SessionDelegate + public let rootQueue: DispatchQueue + public let requestQueue: DispatchQueue + public let serializationQueue: DispatchQueue + public let interceptor: RequestInterceptor? + public let serverTrustManager: ServerTrustManager? + public let redirectHandler: RedirectHandler? + public let cachedResponseHandler: CachedResponseHandler? + + public let session: URLSession + public let eventMonitor: CompositeEventMonitor + public let defaultEventMonitors: [EventMonitor] = [AlamofireNotifications()] + + var requestTaskMap = RequestTaskMap() + public let startRequestsImmediately: Bool + + public init(session: URLSession, + delegate: SessionDelegate, + rootQueue: DispatchQueue, + startRequestsImmediately: Bool = true, + requestQueue: DispatchQueue? = nil, + serializationQueue: DispatchQueue? = nil, + interceptor: RequestInterceptor? = nil, + serverTrustManager: ServerTrustManager? = nil, + redirectHandler: RedirectHandler? = nil, + cachedResponseHandler: CachedResponseHandler? = nil, + eventMonitors: [EventMonitor] = []) { + precondition(session.delegateQueue.underlyingQueue === rootQueue, + "SessionManager(session:) intializer must be passed the DispatchQueue used as the delegateQueue's underlyingQueue as rootQueue.") + + self.session = session + self.delegate = delegate + self.rootQueue = rootQueue + self.startRequestsImmediately = startRequestsImmediately + self.requestQueue = requestQueue ?? DispatchQueue(label: "\(rootQueue.label).requestQueue", target: rootQueue) + self.serializationQueue = serializationQueue ?? DispatchQueue(label: "\(rootQueue.label).serializationQueue", target: rootQueue) + self.interceptor = interceptor + self.serverTrustManager = serverTrustManager + self.redirectHandler = redirectHandler + self.cachedResponseHandler = cachedResponseHandler + eventMonitor = CompositeEventMonitor(monitors: defaultEventMonitors + eventMonitors) + delegate.eventMonitor = eventMonitor + delegate.stateProvider = self + } + + public convenience init(configuration: URLSessionConfiguration = URLSessionConfiguration.af.default, + delegate: SessionDelegate = SessionDelegate(), + rootQueue: DispatchQueue = DispatchQueue(label: "org.alamofire.sessionManager.rootQueue"), + startRequestsImmediately: Bool = true, + requestQueue: DispatchQueue? = nil, + serializationQueue: DispatchQueue? = nil, + interceptor: RequestInterceptor? = nil, + serverTrustManager: ServerTrustManager? = nil, + redirectHandler: RedirectHandler? = nil, + cachedResponseHandler: CachedResponseHandler? = nil, + eventMonitors: [EventMonitor] = []) { + let delegateQueue = OperationQueue(maxConcurrentOperationCount: 1, underlyingQueue: rootQueue, name: "org.alamofire.sessionManager.sessionDelegateQueue") + let session = URLSession(configuration: configuration, delegate: delegate, delegateQueue: delegateQueue) + + self.init(session: session, + delegate: delegate, + rootQueue: rootQueue, + startRequestsImmediately: startRequestsImmediately, + requestQueue: requestQueue, + serializationQueue: serializationQueue, + interceptor: interceptor, + serverTrustManager: serverTrustManager, + redirectHandler: redirectHandler, + cachedResponseHandler: cachedResponseHandler, + eventMonitors: eventMonitors) + } + + deinit { + finishRequestsForDeinit() + session.invalidateAndCancel() + } + + // MARK: - Request + + struct RequestConvertible: URLRequestConvertible { + let url: URLConvertible + let method: HTTPMethod + let parameters: Parameters? + let encoding: ParameterEncoding + let headers: HTTPHeaders? + + func asURLRequest() throws -> URLRequest { + let request = try URLRequest(url: url, method: method, headers: headers) + return try encoding.encode(request, with: parameters) + } + } + + open func request(_ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoding: ParameterEncoding = URLEncoding.default, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> DataRequest { + let convertible = RequestConvertible(url: url, + method: method, + parameters: parameters, + encoding: encoding, + headers: headers) + + return request(convertible, interceptor: interceptor) + } + + struct RequestEncodableConvertible: URLRequestConvertible { + let url: URLConvertible + let method: HTTPMethod + let parameters: Parameters? + let encoder: ParameterEncoder + let headers: HTTPHeaders? + + func asURLRequest() throws -> URLRequest { + let request = try URLRequest(url: url, method: method, headers: headers) + + return try parameters.map { try encoder.encode($0, into: request) } ?? request + } + } + + open func request(_ url: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoder: ParameterEncoder = JSONParameterEncoder.default, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> DataRequest { + let convertible = RequestEncodableConvertible(url: url, + method: method, + parameters: parameters, + encoder: encoder, + headers: headers) + + return request(convertible, interceptor: interceptor) + } + + open func request(_ convertible: URLRequestConvertible, interceptor: RequestInterceptor? = nil) -> DataRequest { + let request = DataRequest(convertible: convertible, + underlyingQueue: rootQueue, + serializationQueue: serializationQueue, + eventMonitor: eventMonitor, + interceptor: interceptor, + delegate: self) + + perform(request) + + return request + } + + // MARK: - Download + + open func download(_ convertible: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoding: ParameterEncoding = URLEncoding.default, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil, + to destination: DownloadRequest.Destination? = nil) -> DownloadRequest { + let convertible = RequestConvertible(url: convertible, + method: method, + parameters: parameters, + encoding: encoding, + headers: headers) + + return download(convertible, interceptor: interceptor, to: destination) + } + + open func download(_ convertible: URLConvertible, + method: HTTPMethod = .get, + parameters: Parameters? = nil, + encoder: ParameterEncoder = JSONParameterEncoder.default, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil, + to destination: DownloadRequest.Destination? = nil) -> DownloadRequest { + let convertible = RequestEncodableConvertible(url: convertible, + method: method, + parameters: parameters, + encoder: encoder, + headers: headers) + + return download(convertible, interceptor: interceptor, to: destination) + } + + open func download(_ convertible: URLRequestConvertible, + interceptor: RequestInterceptor? = nil, + to destination: DownloadRequest.Destination? = nil) -> DownloadRequest { + let request = DownloadRequest(downloadable: .request(convertible), + underlyingQueue: rootQueue, + serializationQueue: serializationQueue, + eventMonitor: eventMonitor, + interceptor: interceptor, + delegate: self, + destination: destination) + + perform(request) + + return request + } + + open func download(resumingWith data: Data, + interceptor: RequestInterceptor? = nil, + to destination: DownloadRequest.Destination? = nil) -> DownloadRequest { + let request = DownloadRequest(downloadable: .resumeData(data), + underlyingQueue: rootQueue, + serializationQueue: serializationQueue, + eventMonitor: eventMonitor, + interceptor: interceptor, + delegate: self, + destination: destination) + + perform(request) + + return request + } + + // MARK: - Upload + + struct ParameterlessRequestConvertible: URLRequestConvertible { + let url: URLConvertible + let method: HTTPMethod + let headers: HTTPHeaders? + + func asURLRequest() throws -> URLRequest { + return try URLRequest(url: url, method: method, headers: headers) + } + } + + struct Upload: UploadConvertible { + let request: URLRequestConvertible + let uploadable: UploadableConvertible + + func createUploadable() throws -> UploadRequest.Uploadable { + return try uploadable.createUploadable() + } + + func asURLRequest() throws -> URLRequest { + return try request.asURLRequest() + } + } + + open func upload(_ data: Data, + to convertible: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + let convertible = ParameterlessRequestConvertible(url: convertible, method: method, headers: headers) + + return upload(data, with: convertible, interceptor: interceptor) + } + + open func upload(_ data: Data, + with convertible: URLRequestConvertible, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return upload(.data(data), with: convertible, interceptor: interceptor) + } + + open func upload(_ fileURL: URL, + to convertible: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + let convertible = ParameterlessRequestConvertible(url: convertible, method: method, headers: headers) + + return upload(fileURL, with: convertible, interceptor: interceptor) + } + + open func upload(_ fileURL: URL, + with convertible: URLRequestConvertible, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return upload(.file(fileURL, shouldRemove: false), with: convertible, interceptor: interceptor) + } + + open func upload(_ stream: InputStream, + to convertible: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + let convertible = ParameterlessRequestConvertible(url: convertible, method: method, headers: headers) + + return upload(stream, with: convertible, interceptor: interceptor) + } + + open func upload(_ stream: InputStream, + with convertible: URLRequestConvertible, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + return upload(.stream(stream), with: convertible, interceptor: interceptor) + } + + open func upload(multipartFormData: @escaping (MultipartFormData) -> Void, + usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold, + fileManager: FileManager = .default, + to url: URLConvertible, + method: HTTPMethod = .post, + headers: HTTPHeaders? = nil, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + let convertible = ParameterlessRequestConvertible(url: url, method: method, headers: headers) + + let formData = MultipartFormData(fileManager: fileManager) + multipartFormData(formData) + + return upload(multipartFormData: formData, + usingThreshold: encodingMemoryThreshold, + with: convertible, + interceptor: interceptor) + } + + open func upload(multipartFormData: MultipartFormData, + usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold, + with request: URLRequestConvertible, + interceptor: RequestInterceptor? = nil) -> UploadRequest { + let multipartUpload = MultipartUpload(isInBackgroundSession: (session.configuration.identifier != nil), + encodingMemoryThreshold: encodingMemoryThreshold, + request: request, + multipartFormData: multipartFormData) + + return upload(multipartUpload, interceptor: interceptor) + } + + // MARK: - Internal API + + // MARK: Uploadable + + func upload(_ uploadable: UploadRequest.Uploadable, + with convertible: URLRequestConvertible, + interceptor: RequestInterceptor?) -> UploadRequest { + let uploadable = Upload(request: convertible, uploadable: uploadable) + + return upload(uploadable, interceptor: interceptor) + } + + func upload(_ upload: UploadConvertible, interceptor: RequestInterceptor?) -> UploadRequest { + let request = UploadRequest(convertible: upload, + underlyingQueue: rootQueue, + serializationQueue: serializationQueue, + eventMonitor: eventMonitor, + interceptor: interceptor, + delegate: self) + + perform(request) + + return request + } + + // MARK: Perform + + func perform(_ request: Request) { + switch request { + case let r as DataRequest: perform(r) + case let r as UploadRequest: perform(r) + case let r as DownloadRequest: perform(r) + default: fatalError("Attempted to perform unsupported Request subclass: \(type(of: request))") + } + } + + func perform(_ request: DataRequest) { + requestQueue.async { + guard !request.isCancelled else { return } + + self.performSetupOperations(for: request, convertible: request.convertible) + } + } + + func perform(_ request: UploadRequest) { + requestQueue.async { + guard !request.isCancelled else { return } + + do { + let uploadable = try request.upload.createUploadable() + self.rootQueue.async { request.didCreateUploadable(uploadable) } + + self.performSetupOperations(for: request, convertible: request.convertible) + } catch { + self.rootQueue.async { request.didFailToCreateUploadable(with: error) } + } + } + } + + func perform(_ request: DownloadRequest) { + requestQueue.async { + guard !request.isCancelled else { return } + + switch request.downloadable { + case let .request(convertible): + self.performSetupOperations(for: request, convertible: convertible) + case let .resumeData(resumeData): + self.rootQueue.async { self.didReceiveResumeData(resumeData, for: request) } + } + } + } + + func performSetupOperations(for request: Request, convertible: URLRequestConvertible) { + do { + let initialRequest = try convertible.asURLRequest() + rootQueue.async { request.didCreateURLRequest(initialRequest) } + + guard !request.isCancelled else { return } + + if let adapter = adapter(for: request) { + adapter.adapt(initialRequest, for: self) { result in + do { + let adaptedRequest = try result.get() + + self.rootQueue.async { + request.didAdaptInitialRequest(initialRequest, to: adaptedRequest) + self.didCreateURLRequest(adaptedRequest, for: request) + } + } catch { + let adaptError = AFError.requestAdaptationFailed(error: error) + self.rootQueue.async { request.didFailToAdaptURLRequest(initialRequest, withError: adaptError) } + } + } + } else { + rootQueue.async { self.didCreateURLRequest(initialRequest, for: request) } + } + } catch { + rootQueue.async { request.didFailToCreateURLRequest(with: error) } + } + } + + // MARK: - Task Handling + + func didCreateURLRequest(_ urlRequest: URLRequest, for request: Request) { + guard !request.isCancelled else { return } + + let task = request.task(for: urlRequest, using: session) + requestTaskMap[request] = task + request.didCreateTask(task) + + updateStatesForTask(task, request: request) + } + + func didReceiveResumeData(_ data: Data, for request: DownloadRequest) { + guard !request.isCancelled else { return } + + let task = request.task(forResumeData: data, using: session) + requestTaskMap[request] = task + request.didCreateTask(task) + + updateStatesForTask(task, request: request) + } + + func updateStatesForTask(_ task: URLSessionTask, request: Request) { + request.withState { (state) in + switch (startRequestsImmediately, state) { + case (true, .initialized): + rootQueue.async { request.resume() } + case (false, .initialized): + // Do nothing. + break + case (_, .resumed): + task.resume() + rootQueue.async { request.didResumeTask(task) } + case (_, .suspended): + task.suspend() + rootQueue.async { request.didSuspendTask(task) } + case (_, .cancelled): + task.cancel() + rootQueue.async { request.didCancelTask(task) } + case (_, .finished): + // Do nothing + break + } + } + } + + // MARK: - Adapters and Retriers + + func adapter(for request: Request) -> RequestAdapter? { + if let requestInterceptor = request.interceptor, let sessionInterceptor = interceptor { + return Interceptor(adapters: [requestInterceptor, sessionInterceptor]) + } else { + return request.interceptor ?? interceptor + } + } + + func retrier(for request: Request) -> RequestRetrier? { + if let requestInterceptor = request.interceptor, let sessionInterceptor = interceptor { + return Interceptor(retriers: [requestInterceptor, sessionInterceptor]) + } else { + return request.interceptor ?? interceptor + } + } + + // MARK: - Invalidation + + func finishRequestsForDeinit() { + requestTaskMap.requests.forEach { $0.finish(error: AFError.sessionDeinitialized) } + } +} + +// MARK: - RequestDelegate + +extension Session: RequestDelegate { + public var sessionConfiguration: URLSessionConfiguration { + return session.configuration + } + + public func retryResult(for request: Request, dueTo error: Error, completion: @escaping (RetryResult) -> Void) { + guard let retrier = retrier(for: request) else { + rootQueue.async { completion(.doNotRetry) } + return + } + + retrier.retry(request, for: self, dueTo: error) { retryResult in + self.rootQueue.async { + guard let retryResultError = retryResult.error else { completion(retryResult); return } + + let retryError = AFError.requestRetryFailed(retryError: retryResultError, originalError: error) + completion(.doNotRetryWithError(retryError)) + } + } + } + + public func retryRequest(_ request: Request, withDelay timeDelay: TimeInterval?) { + self.rootQueue.async { + let retry: () -> Void = { + guard !request.isCancelled else { return } + + request.prepareForRetry() + self.perform(request) + } + + if let retryDelay = timeDelay { + self.rootQueue.after(retryDelay) { retry() } + } else { + retry() + } + } + } +} + +// MARK: - SessionStateProvider + +extension Session: SessionStateProvider { + public func request(for task: URLSessionTask) -> Request? { + return requestTaskMap[task] + } + + public func didGatherMetricsForTask(_ task: URLSessionTask) { + requestTaskMap.disassociateIfNecessaryAfterGatheringMetricsForTask(task) + } + + public func didCompleteTask(_ task: URLSessionTask) { + requestTaskMap.disassociateIfNecessaryAfterCompletingTask(task) + } + + public func credential(for task: URLSessionTask, in protectionSpace: URLProtectionSpace) -> URLCredential? { + return requestTaskMap[task]?.credential ?? + session.configuration.urlCredentialStorage?.defaultCredential(for: protectionSpace) + } + + public func cancelRequestsForSessionInvalidation(with error: Error?) { + requestTaskMap.requests.forEach { $0.finish(error: AFError.sessionInvalidated(error: error)) } + } +} diff --git a/Example/Pods/Alamofire/Source/SessionDelegate.swift b/Example/Pods/Alamofire/Source/SessionDelegate.swift index 4964f1e..dd2a125 100644 --- a/Example/Pods/Alamofire/Source/SessionDelegate.swift +++ b/Example/Pods/Alamofire/Source/SessionDelegate.swift @@ -1,7 +1,7 @@ // // SessionDelegate.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -24,702 +24,255 @@ import Foundation -/// Responsible for handling all delegate callbacks for the underlying session. -open class SessionDelegate: NSObject { - - // MARK: URLSessionDelegate Overrides - - /// Overrides default behavior for URLSessionDelegate method `urlSession(_:didBecomeInvalidWithError:)`. - open var sessionDidBecomeInvalidWithError: ((URLSession, Error?) -> Void)? - - /// Overrides default behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)`. - open var sessionDidReceiveChallenge: ((URLSession, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? - - /// Overrides all behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)` and requires the caller to call the `completionHandler`. - open var sessionDidReceiveChallengeWithCompletion: ((URLSession, URLAuthenticationChallenge, @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)? - - /// Overrides default behavior for URLSessionDelegate method `urlSessionDidFinishEvents(forBackgroundURLSession:)`. - open var sessionDidFinishEventsForBackgroundURLSession: ((URLSession) -> Void)? - - // MARK: URLSessionTaskDelegate Overrides - - /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)`. - open var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> URLRequest?)? - - /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` and - /// requires the caller to call the `completionHandler`. - open var taskWillPerformHTTPRedirectionWithCompletion: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest, @escaping (URLRequest?) -> Void) -> Void)? - - /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didReceive:completionHandler:)`. - open var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? - - /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:didReceive:completionHandler:)` and - /// requires the caller to call the `completionHandler`. - open var taskDidReceiveChallengeWithCompletion: ((URLSession, URLSessionTask, URLAuthenticationChallenge, @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)? - - /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:needNewBodyStream:)`. - open var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> InputStream?)? - - /// Overrides all behavior for URLSessionTaskDelegate method `urlSession(_:task:needNewBodyStream:)` and - /// requires the caller to call the `completionHandler`. - open var taskNeedNewBodyStreamWithCompletion: ((URLSession, URLSessionTask, @escaping (InputStream?) -> Void) -> Void)? - - /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)`. - open var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)? - - /// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:didCompleteWithError:)`. - open var taskDidComplete: ((URLSession, URLSessionTask, Error?) -> Void)? - - // MARK: URLSessionDataDelegate Overrides +protocol SessionStateProvider: AnyObject { + var serverTrustManager: ServerTrustManager? { get } + var redirectHandler: RedirectHandler? { get } + var cachedResponseHandler: CachedResponseHandler? { get } - /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:completionHandler:)`. - open var dataTaskDidReceiveResponse: ((URLSession, URLSessionDataTask, URLResponse) -> URLSession.ResponseDisposition)? - - /// Overrides all behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:completionHandler:)` and - /// requires caller to call the `completionHandler`. - open var dataTaskDidReceiveResponseWithCompletion: ((URLSession, URLSessionDataTask, URLResponse, @escaping (URLSession.ResponseDisposition) -> Void) -> Void)? - - /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didBecome:)`. - open var dataTaskDidBecomeDownloadTask: ((URLSession, URLSessionDataTask, URLSessionDownloadTask) -> Void)? - - /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:didReceive:)`. - open var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)? - - /// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)`. - open var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)? - - /// Overrides all behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)` and - /// requires caller to call the `completionHandler`. - open var dataTaskWillCacheResponseWithCompletion: ((URLSession, URLSessionDataTask, CachedURLResponse, @escaping (CachedURLResponse?) -> Void) -> Void)? - - // MARK: URLSessionDownloadDelegate Overrides - - /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didFinishDownloadingTo:)`. - open var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> Void)? + func request(for task: URLSessionTask) -> Request? + func didGatherMetricsForTask(_ task: URLSessionTask) + func didCompleteTask(_ task: URLSessionTask) + func credential(for task: URLSessionTask, in protectionSpace: URLProtectionSpace) -> URLCredential? + func cancelRequestsForSessionInvalidation(with error: Error?) +} - /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)`. - open var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)? +open class SessionDelegate: NSObject { + private let fileManager: FileManager - /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)`. - open var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)? + weak var stateProvider: SessionStateProvider? + var eventMonitor: EventMonitor? - // MARK: URLSessionStreamDelegate Overrides + public init(fileManager: FileManager = .default) { + self.fileManager = fileManager + } +} -#if !os(watchOS) +extension SessionDelegate: URLSessionDelegate { + open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { + eventMonitor?.urlSession(session, didBecomeInvalidWithError: error) - /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:readClosedFor:)`. - @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) - open var streamTaskReadClosed: ((URLSession, URLSessionStreamTask) -> Void)? { - get { - return _streamTaskReadClosed as? (URLSession, URLSessionStreamTask) -> Void - } - set { - _streamTaskReadClosed = newValue - } + stateProvider?.cancelRequestsForSessionInvalidation(with: error) } +} - /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:writeClosedFor:)`. - @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) - open var streamTaskWriteClosed: ((URLSession, URLSessionStreamTask) -> Void)? { - get { - return _streamTaskWriteClosed as? (URLSession, URLSessionStreamTask) -> Void - } - set { - _streamTaskWriteClosed = newValue +extension SessionDelegate: URLSessionTaskDelegate { + /// Result of a `URLAuthenticationChallenge` evaluation. + typealias ChallengeEvaluation = (disposition: URLSession.AuthChallengeDisposition, credential: URLCredential?, error: Error?) + + open func urlSession(_ session: URLSession, + task: URLSessionTask, + didReceive challenge: URLAuthenticationChallenge, + completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { + eventMonitor?.urlSession(session, task: task, didReceive: challenge) + + let evaluation: ChallengeEvaluation + switch challenge.protectionSpace.authenticationMethod { + case NSURLAuthenticationMethodServerTrust: + evaluation = attemptServerTrustAuthentication(with: challenge) + case NSURLAuthenticationMethodHTTPBasic, NSURLAuthenticationMethodHTTPDigest: + evaluation = attemptHTTPAuthentication(for: challenge, belongingTo: task) + // case NSURLAuthenticationMethodClientCertificate: + default: + evaluation = (.performDefaultHandling, nil, nil) } - } - /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:betterRouteDiscoveredFor:)`. - @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) - open var streamTaskBetterRouteDiscovered: ((URLSession, URLSessionStreamTask) -> Void)? { - get { - return _streamTaskBetterRouteDiscovered as? (URLSession, URLSessionStreamTask) -> Void - } - set { - _streamTaskBetterRouteDiscovered = newValue + if let error = evaluation.error { + stateProvider?.request(for: task)?.didFailTask(task, earlyWithError: error) } - } - /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:streamTask:didBecome:outputStream:)`. - @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) - open var streamTaskDidBecomeInputAndOutputStreams: ((URLSession, URLSessionStreamTask, InputStream, OutputStream) -> Void)? { - get { - return _streamTaskDidBecomeInputStream as? (URLSession, URLSessionStreamTask, InputStream, OutputStream) -> Void - } - set { - _streamTaskDidBecomeInputStream = newValue - } + completionHandler(evaluation.disposition, evaluation.credential) } - var _streamTaskReadClosed: Any? - var _streamTaskWriteClosed: Any? - var _streamTaskBetterRouteDiscovered: Any? - var _streamTaskDidBecomeInputStream: Any? - -#endif - - // MARK: Properties - - var retrier: RequestRetrier? - weak var sessionManager: SessionManager? + func attemptServerTrustAuthentication(with challenge: URLAuthenticationChallenge) -> ChallengeEvaluation { + let host = challenge.protectionSpace.host - var requests: [Int: Request] = [:] - private let lock = NSLock() - - /// Access the task delegate for the specified task in a thread-safe manner. - open subscript(task: URLSessionTask) -> Request? { - get { - lock.lock() ; defer { lock.unlock() } - return requests[task.taskIdentifier] - } - set { - lock.lock() ; defer { lock.unlock() } - requests[task.taskIdentifier] = newValue + guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust, + let trust = challenge.protectionSpace.serverTrust + else { + return (.performDefaultHandling, nil, nil) } - } - - // MARK: Lifecycle - /// Initializes the `SessionDelegate` instance. - /// - /// - returns: The new `SessionDelegate` instance. - public override init() { - super.init() - } - - // MARK: NSObject Overrides - - /// Returns a `Bool` indicating whether the `SessionDelegate` implements or inherits a method that can respond - /// to a specified message. - /// - /// - parameter selector: A selector that identifies a message. - /// - /// - returns: `true` if the receiver implements or inherits a method that can respond to selector, otherwise `false`. - open override func responds(to selector: Selector) -> Bool { - #if !os(macOS) - if selector == #selector(URLSessionDelegate.urlSessionDidFinishEvents(forBackgroundURLSession:)) { - return sessionDidFinishEventsForBackgroundURLSession != nil + do { + guard let evaluator = try stateProvider?.serverTrustManager?.serverTrustEvaluator(forHost: host) else { + return (.performDefaultHandling, nil, nil) } - #endif - - #if !os(watchOS) - if #available(iOS 9.0, macOS 10.11, tvOS 9.0, *) { - switch selector { - case #selector(URLSessionStreamDelegate.urlSession(_:readClosedFor:)): - return streamTaskReadClosed != nil - case #selector(URLSessionStreamDelegate.urlSession(_:writeClosedFor:)): - return streamTaskWriteClosed != nil - case #selector(URLSessionStreamDelegate.urlSession(_:betterRouteDiscoveredFor:)): - return streamTaskBetterRouteDiscovered != nil - case #selector(URLSessionStreamDelegate.urlSession(_:streamTask:didBecome:outputStream:)): - return streamTaskDidBecomeInputAndOutputStreams != nil - default: - break - } - } - #endif - - switch selector { - case #selector(URLSessionDelegate.urlSession(_:didBecomeInvalidWithError:)): - return sessionDidBecomeInvalidWithError != nil - case #selector(URLSessionDelegate.urlSession(_:didReceive:completionHandler:)): - return (sessionDidReceiveChallenge != nil || sessionDidReceiveChallengeWithCompletion != nil) - case #selector(URLSessionTaskDelegate.urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)): - return (taskWillPerformHTTPRedirection != nil || taskWillPerformHTTPRedirectionWithCompletion != nil) - case #selector(URLSessionDataDelegate.urlSession(_:dataTask:didReceive:completionHandler:)): - return (dataTaskDidReceiveResponse != nil || dataTaskDidReceiveResponseWithCompletion != nil) - default: - return type(of: self).instancesRespond(to: selector) - } - } -} -// MARK: - URLSessionDelegate + try evaluator.evaluate(trust, forHost: host) -extension SessionDelegate: URLSessionDelegate { - /// Tells the delegate that the session has been invalidated. - /// - /// - parameter session: The session object that was invalidated. - /// - parameter error: The error that caused invalidation, or nil if the invalidation was explicit. - open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) { - sessionDidBecomeInvalidWithError?(session, error) + return (.useCredential, URLCredential(trust: trust), nil) + } catch { + return (.cancelAuthenticationChallenge, nil, error) + } } - /// Requests credentials from the delegate in response to a session-level authentication request from the - /// remote server. - /// - /// - parameter session: The session containing the task that requested authentication. - /// - parameter challenge: An object that contains the request for authentication. - /// - parameter completionHandler: A handler that your delegate method must call providing the disposition - /// and credential. - open func urlSession( - _ session: URLSession, - didReceive challenge: URLAuthenticationChallenge, - completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) - { - guard sessionDidReceiveChallengeWithCompletion == nil else { - sessionDidReceiveChallengeWithCompletion?(session, challenge, completionHandler) - return + func attemptHTTPAuthentication(for challenge: URLAuthenticationChallenge, + belongingTo task: URLSessionTask) -> ChallengeEvaluation { + guard challenge.previousFailureCount == 0 else { + return (.rejectProtectionSpace, nil, nil) } - var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling - var credential: URLCredential? - - if let sessionDidReceiveChallenge = sessionDidReceiveChallenge { - (disposition, credential) = sessionDidReceiveChallenge(session, challenge) - } else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust { - let host = challenge.protectionSpace.host - - if - let serverTrustPolicy = session.serverTrustPolicyManager?.serverTrustPolicy(forHost: host), - let serverTrust = challenge.protectionSpace.serverTrust - { - if serverTrustPolicy.evaluate(serverTrust, forHost: host) { - disposition = .useCredential - credential = URLCredential(trust: serverTrust) - } else { - disposition = .cancelAuthenticationChallenge - } - } + guard let credential = stateProvider?.credential(for: task, in: challenge.protectionSpace) else { + return (.performDefaultHandling, nil, nil) } - completionHandler(disposition, credential) + return (.useCredential, credential, nil) } -#if !os(macOS) - - /// Tells the delegate that all messages enqueued for a session have been delivered. - /// - /// - parameter session: The session that no longer has any outstanding requests. - open func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) { - sessionDidFinishEventsForBackgroundURLSession?(session) + open func urlSession(_ session: URLSession, + task: URLSessionTask, + didSendBodyData bytesSent: Int64, + totalBytesSent: Int64, + totalBytesExpectedToSend: Int64) { + eventMonitor?.urlSession(session, + task: task, + didSendBodyData: bytesSent, + totalBytesSent: totalBytesSent, + totalBytesExpectedToSend: totalBytesExpectedToSend) + + stateProvider?.request(for: task)?.updateUploadProgress(totalBytesSent: totalBytesSent, + totalBytesExpectedToSend: totalBytesExpectedToSend) } -#endif -} - -// MARK: - URLSessionTaskDelegate + open func urlSession(_ session: URLSession, + task: URLSessionTask, + needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) { + eventMonitor?.urlSession(session, taskNeedsNewBodyStream: task) -extension SessionDelegate: URLSessionTaskDelegate { - /// Tells the delegate that the remote server requested an HTTP redirect. - /// - /// - parameter session: The session containing the task whose request resulted in a redirect. - /// - parameter task: The task whose request resulted in a redirect. - /// - parameter response: An object containing the server’s response to the original request. - /// - parameter request: A URL request object filled out with the new location. - /// - parameter completionHandler: A closure that your handler should call with either the value of the request - /// parameter, a modified URL request object, or NULL to refuse the redirect and - /// return the body of the redirect response. - open func urlSession( - _ session: URLSession, - task: URLSessionTask, - willPerformHTTPRedirection response: HTTPURLResponse, - newRequest request: URLRequest, - completionHandler: @escaping (URLRequest?) -> Void) - { - guard taskWillPerformHTTPRedirectionWithCompletion == nil else { - taskWillPerformHTTPRedirectionWithCompletion?(session, task, response, request, completionHandler) - return + guard let request = stateProvider?.request(for: task) as? UploadRequest else { + fatalError("needNewBodyStream for request that isn't UploadRequest.") } - var redirectRequest: URLRequest? = request - - if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection { - redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request) - } - - completionHandler(redirectRequest) + completionHandler(request.inputStream()) } - /// Requests credentials from the delegate in response to an authentication request from the remote server. - /// - /// - parameter session: The session containing the task whose request requires authentication. - /// - parameter task: The task whose request requires authentication. - /// - parameter challenge: An object that contains the request for authentication. - /// - parameter completionHandler: A handler that your delegate method must call providing the disposition - /// and credential. - open func urlSession( - _ session: URLSession, - task: URLSessionTask, - didReceive challenge: URLAuthenticationChallenge, - completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) - { - guard taskDidReceiveChallengeWithCompletion == nil else { - taskDidReceiveChallengeWithCompletion?(session, task, challenge, completionHandler) - return - } + open func urlSession(_ session: URLSession, + task: URLSessionTask, + willPerformHTTPRedirection response: HTTPURLResponse, + newRequest request: URLRequest, + completionHandler: @escaping (URLRequest?) -> Void) { + eventMonitor?.urlSession(session, task: task, willPerformHTTPRedirection: response, newRequest: request) - if let taskDidReceiveChallenge = taskDidReceiveChallenge { - let result = taskDidReceiveChallenge(session, task, challenge) - completionHandler(result.0, result.1) - } else if let delegate = self[task]?.delegate { - delegate.urlSession( - session, - task: task, - didReceive: challenge, - completionHandler: completionHandler - ) + if let redirectHandler = stateProvider?.request(for: task)?.redirectHandler ?? stateProvider?.redirectHandler { + redirectHandler.task(task, willBeRedirectedTo: request, for: response, completion: completionHandler) } else { - urlSession(session, didReceive: challenge, completionHandler: completionHandler) - } - } - - /// Tells the delegate when a task requires a new request body stream to send to the remote server. - /// - /// - parameter session: The session containing the task that needs a new body stream. - /// - parameter task: The task that needs a new body stream. - /// - parameter completionHandler: A completion handler that your delegate method should call with the new body stream. - open func urlSession( - _ session: URLSession, - task: URLSessionTask, - needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) - { - guard taskNeedNewBodyStreamWithCompletion == nil else { - taskNeedNewBodyStreamWithCompletion?(session, task, completionHandler) - return - } - - if let taskNeedNewBodyStream = taskNeedNewBodyStream { - completionHandler(taskNeedNewBodyStream(session, task)) - } else if let delegate = self[task]?.delegate { - delegate.urlSession(session, task: task, needNewBodyStream: completionHandler) + completionHandler(request) } } - /// Periodically informs the delegate of the progress of sending body content to the server. - /// - /// - parameter session: The session containing the data task. - /// - parameter task: The data task. - /// - parameter bytesSent: The number of bytes sent since the last time this delegate method was called. - /// - parameter totalBytesSent: The total number of bytes sent so far. - /// - parameter totalBytesExpectedToSend: The expected length of the body data. - open func urlSession( - _ session: URLSession, - task: URLSessionTask, - didSendBodyData bytesSent: Int64, - totalBytesSent: Int64, - totalBytesExpectedToSend: Int64) - { - if let taskDidSendBodyData = taskDidSendBodyData { - taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend) - } else if let delegate = self[task]?.delegate as? UploadTaskDelegate { - delegate.URLSession( - session, - task: task, - didSendBodyData: bytesSent, - totalBytesSent: totalBytesSent, - totalBytesExpectedToSend: totalBytesExpectedToSend - ) - } - } + open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) { + eventMonitor?.urlSession(session, task: task, didFinishCollecting: metrics) -#if !os(watchOS) + stateProvider?.request(for: task)?.didGatherMetrics(metrics) - /// Tells the delegate that the session finished collecting metrics for the task. - /// - /// - parameter session: The session collecting the metrics. - /// - parameter task: The task whose metrics have been collected. - /// - parameter metrics: The collected metrics. - @available(iOS 10.0, macOS 10.12, tvOS 10.0, *) - @objc(URLSession:task:didFinishCollectingMetrics:) - open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) { - self[task]?.delegate.metrics = metrics + stateProvider?.didGatherMetricsForTask(task) } -#endif - - /// Tells the delegate that the task finished transferring data. - /// - /// - parameter session: The session containing the task whose request finished transferring data. - /// - parameter task: The task whose request finished transferring data. - /// - parameter error: If an error occurred, an error object indicating how the transfer failed, otherwise nil. open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { - /// Executed after it is determined that the request is not going to be retried - let completeTask: (URLSession, URLSessionTask, Error?) -> Void = { [weak self] session, task, error in - guard let strongSelf = self else { return } - - strongSelf.taskDidComplete?(session, task, error) - - strongSelf[task]?.delegate.urlSession(session, task: task, didCompleteWithError: error) + eventMonitor?.urlSession(session, task: task, didCompleteWithError: error) - var userInfo: [String: Any] = [Notification.Key.Task: task] + stateProvider?.request(for: task)?.didCompleteTask(task, with: error) - if let data = (strongSelf[task]?.delegate as? DataTaskDelegate)?.data { - userInfo[Notification.Key.ResponseData] = data - } - - NotificationCenter.default.post( - name: Notification.Name.Task.DidComplete, - object: strongSelf, - userInfo: userInfo - ) - - strongSelf[task] = nil - } - - guard let request = self[task], let sessionManager = sessionManager else { - completeTask(session, task, error) - return - } - - // Run all validations on the request before checking if an error occurred - request.validations.forEach { $0() } - - // Determine whether an error has occurred - var error: Error? = error - - if request.delegate.error != nil { - error = request.delegate.error - } - - /// If an error occurred and the retrier is set, asynchronously ask the retrier if the request - /// should be retried. Otherwise, complete the task by notifying the task delegate. - if let retrier = retrier, let error = error { - retrier.should(sessionManager, retry: request, with: error) { [weak self] shouldRetry, timeDelay in - guard shouldRetry else { completeTask(session, task, error) ; return } - - DispatchQueue.utility.after(timeDelay) { [weak self] in - guard let strongSelf = self else { return } - - let retrySucceeded = strongSelf.sessionManager?.retry(request) ?? false + stateProvider?.didCompleteTask(task) + } - if retrySucceeded, let task = request.task { - strongSelf[task] = request - return - } else { - completeTask(session, task, error) - } - } - } - } else { - completeTask(session, task, error) - } + @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) + open func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) { + eventMonitor?.urlSession(session, taskIsWaitingForConnectivity: task) } } -// MARK: - URLSessionDataDelegate - extension SessionDelegate: URLSessionDataDelegate { - /// Tells the delegate that the data task received the initial reply (headers) from the server. - /// - /// - parameter session: The session containing the data task that received an initial reply. - /// - parameter dataTask: The data task that received an initial reply. - /// - parameter response: A URL response object populated with headers. - /// - parameter completionHandler: A completion handler that your code calls to continue the transfer, passing a - /// constant to indicate whether the transfer should continue as a data task or - /// should become a download task. - open func urlSession( - _ session: URLSession, - dataTask: URLSessionDataTask, - didReceive response: URLResponse, - completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) - { - guard dataTaskDidReceiveResponseWithCompletion == nil else { - dataTaskDidReceiveResponseWithCompletion?(session, dataTask, response, completionHandler) - return - } - - var disposition: URLSession.ResponseDisposition = .allow + open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { + eventMonitor?.urlSession(session, dataTask: dataTask, didReceive: data) - if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse { - disposition = dataTaskDidReceiveResponse(session, dataTask, response) + guard let request = stateProvider?.request(for: dataTask) as? DataRequest else { + fatalError("dataTask received data for incorrect Request subclass: \(String(describing: stateProvider?.request(for: dataTask)))") } - completionHandler(disposition) + request.didReceive(data: data) } - /// Tells the delegate that the data task was changed to a download task. - /// - /// - parameter session: The session containing the task that was replaced by a download task. - /// - parameter dataTask: The data task that was replaced by a download task. - /// - parameter downloadTask: The new download task that replaced the data task. - open func urlSession( - _ session: URLSession, - dataTask: URLSessionDataTask, - didBecome downloadTask: URLSessionDownloadTask) - { - if let dataTaskDidBecomeDownloadTask = dataTaskDidBecomeDownloadTask { - dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask) + open func urlSession(_ session: URLSession, + dataTask: URLSessionDataTask, + willCacheResponse proposedResponse: CachedURLResponse, + completionHandler: @escaping (CachedURLResponse?) -> Void) { + eventMonitor?.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse) + + if let handler = stateProvider?.request(for: dataTask)?.cachedResponseHandler ?? stateProvider?.cachedResponseHandler { + handler.dataTask(dataTask, willCacheResponse: proposedResponse, completion: completionHandler) } else { - self[downloadTask]?.delegate = DownloadTaskDelegate(task: downloadTask) + completionHandler(proposedResponse) } } +} - /// Tells the delegate that the data task has received some of the expected data. - /// - /// - parameter session: The session containing the data task that provided data. - /// - parameter dataTask: The data task that provided data. - /// - parameter data: A data object containing the transferred data. - open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { - if let dataTaskDidReceiveData = dataTaskDidReceiveData { - dataTaskDidReceiveData(session, dataTask, data) - } else if let delegate = self[dataTask]?.delegate as? DataTaskDelegate { - delegate.urlSession(session, dataTask: dataTask, didReceive: data) - } - } +extension SessionDelegate: URLSessionDownloadDelegate { + open func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didResumeAtOffset fileOffset: Int64, + expectedTotalBytes: Int64) { + eventMonitor?.urlSession(session, + downloadTask: downloadTask, + didResumeAtOffset: fileOffset, + expectedTotalBytes: expectedTotalBytes) - /// Asks the delegate whether the data (or upload) task should store the response in the cache. - /// - /// - parameter session: The session containing the data (or upload) task. - /// - parameter dataTask: The data (or upload) task. - /// - parameter proposedResponse: The default caching behavior. This behavior is determined based on the current - /// caching policy and the values of certain received headers, such as the Pragma - /// and Cache-Control headers. - /// - parameter completionHandler: A block that your handler must call, providing either the original proposed - /// response, a modified version of that response, or NULL to prevent caching the - /// response. If your delegate implements this method, it must call this completion - /// handler; otherwise, your app leaks memory. - open func urlSession( - _ session: URLSession, - dataTask: URLSessionDataTask, - willCacheResponse proposedResponse: CachedURLResponse, - completionHandler: @escaping (CachedURLResponse?) -> Void) - { - guard dataTaskWillCacheResponseWithCompletion == nil else { - dataTaskWillCacheResponseWithCompletion?(session, dataTask, proposedResponse, completionHandler) - return + guard let downloadRequest = stateProvider?.request(for: downloadTask) as? DownloadRequest else { + fatalError("No DownloadRequest found for downloadTask: \(downloadTask)") } - if let dataTaskWillCacheResponse = dataTaskWillCacheResponse { - completionHandler(dataTaskWillCacheResponse(session, dataTask, proposedResponse)) - } else if let delegate = self[dataTask]?.delegate as? DataTaskDelegate { - delegate.urlSession( - session, - dataTask: dataTask, - willCacheResponse: proposedResponse, - completionHandler: completionHandler - ) - } else { - completionHandler(proposedResponse) - } + downloadRequest.updateDownloadProgress(bytesWritten: fileOffset, + totalBytesExpectedToWrite: expectedTotalBytes) } -} -// MARK: - URLSessionDownloadDelegate + open func urlSession(_ session: URLSession, + downloadTask: URLSessionDownloadTask, + didWriteData bytesWritten: Int64, + totalBytesWritten: Int64, + totalBytesExpectedToWrite: Int64) { + eventMonitor?.urlSession(session, + downloadTask: downloadTask, + didWriteData: bytesWritten, + totalBytesWritten: totalBytesWritten, + totalBytesExpectedToWrite: totalBytesExpectedToWrite) -extension SessionDelegate: URLSessionDownloadDelegate { - /// Tells the delegate that a download task has finished downloading. - /// - /// - parameter session: The session containing the download task that finished. - /// - parameter downloadTask: The download task that finished. - /// - parameter location: A file URL for the temporary file. Because the file is temporary, you must either - /// open the file for reading or move it to a permanent location in your app’s sandbox - /// container directory before returning from this delegate method. - open func urlSession( - _ session: URLSession, - downloadTask: URLSessionDownloadTask, - didFinishDownloadingTo location: URL) - { - if let downloadTaskDidFinishDownloadingToURL = downloadTaskDidFinishDownloadingToURL { - downloadTaskDidFinishDownloadingToURL(session, downloadTask, location) - } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate { - delegate.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location) + guard let downloadRequest = stateProvider?.request(for: downloadTask) as? DownloadRequest else { + fatalError("No DownloadRequest found for downloadTask: \(downloadTask)") } + + downloadRequest.updateDownloadProgress(bytesWritten: bytesWritten, + totalBytesExpectedToWrite: totalBytesExpectedToWrite) } - /// Periodically informs the delegate about the download’s progress. - /// - /// - parameter session: The session containing the download task. - /// - parameter downloadTask: The download task. - /// - parameter bytesWritten: The number of bytes transferred since the last time this delegate - /// method was called. - /// - parameter totalBytesWritten: The total number of bytes transferred so far. - /// - parameter totalBytesExpectedToWrite: The expected length of the file, as provided by the Content-Length - /// header. If this header was not provided, the value is - /// `NSURLSessionTransferSizeUnknown`. - open func urlSession( - _ session: URLSession, - downloadTask: URLSessionDownloadTask, - didWriteData bytesWritten: Int64, - totalBytesWritten: Int64, - totalBytesExpectedToWrite: Int64) - { - if let downloadTaskDidWriteData = downloadTaskDidWriteData { - downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite) - } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate { - delegate.urlSession( - session, - downloadTask: downloadTask, - didWriteData: bytesWritten, - totalBytesWritten: totalBytesWritten, - totalBytesExpectedToWrite: totalBytesExpectedToWrite - ) + open func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) { + eventMonitor?.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location) + + guard let request = stateProvider?.request(for: downloadTask) as? DownloadRequest else { + fatalError("Download finished but either no request found or request wasn't DownloadRequest") } - } - /// Tells the delegate that the download task has resumed downloading. - /// - /// - parameter session: The session containing the download task that finished. - /// - parameter downloadTask: The download task that resumed. See explanation in the discussion. - /// - parameter fileOffset: If the file's cache policy or last modified date prevents reuse of the - /// existing content, then this value is zero. Otherwise, this value is an - /// integer representing the number of bytes on disk that do not need to be - /// retrieved again. - /// - parameter expectedTotalBytes: The expected length of the file, as provided by the Content-Length header. - /// If this header was not provided, the value is NSURLSessionTransferSizeUnknown. - open func urlSession( - _ session: URLSession, - downloadTask: URLSessionDownloadTask, - didResumeAtOffset fileOffset: Int64, - expectedTotalBytes: Int64) - { - if let downloadTaskDidResumeAtOffset = downloadTaskDidResumeAtOffset { - downloadTaskDidResumeAtOffset(session, downloadTask, fileOffset, expectedTotalBytes) - } else if let delegate = self[downloadTask]?.delegate as? DownloadTaskDelegate { - delegate.urlSession( - session, - downloadTask: downloadTask, - didResumeAtOffset: fileOffset, - expectedTotalBytes: expectedTotalBytes - ) + guard let response = request.response else { + fatalError("URLSessionDownloadTask finished downloading with no response.") } - } -} -// MARK: - URLSessionStreamDelegate + let (destination, options) = (request.destination ?? DownloadRequest.defaultDestination)(location, response) -#if !os(watchOS) + eventMonitor?.request(request, didCreateDestinationURL: destination) -@available(iOS 9.0, macOS 10.11, tvOS 9.0, *) -extension SessionDelegate: URLSessionStreamDelegate { - /// Tells the delegate that the read side of the connection has been closed. - /// - /// - parameter session: The session. - /// - parameter streamTask: The stream task. - open func urlSession(_ session: URLSession, readClosedFor streamTask: URLSessionStreamTask) { - streamTaskReadClosed?(session, streamTask) - } + do { + if options.contains(.removePreviousFile), fileManager.fileExists(atPath: destination.path) { + try fileManager.removeItem(at: destination) + } - /// Tells the delegate that the write side of the connection has been closed. - /// - /// - parameter session: The session. - /// - parameter streamTask: The stream task. - open func urlSession(_ session: URLSession, writeClosedFor streamTask: URLSessionStreamTask) { - streamTaskWriteClosed?(session, streamTask) - } + if options.contains(.createIntermediateDirectories) { + let directory = destination.deletingLastPathComponent() + try fileManager.createDirectory(at: directory, withIntermediateDirectories: true) + } - /// Tells the delegate that the system has determined that a better route to the host is available. - /// - /// - parameter session: The session. - /// - parameter streamTask: The stream task. - open func urlSession(_ session: URLSession, betterRouteDiscoveredFor streamTask: URLSessionStreamTask) { - streamTaskBetterRouteDiscovered?(session, streamTask) - } + try fileManager.moveItem(at: location, to: destination) - /// Tells the delegate that the stream task has been completed and provides the unopened stream objects. - /// - /// - parameter session: The session. - /// - parameter streamTask: The stream task. - /// - parameter inputStream: The new input stream. - /// - parameter outputStream: The new output stream. - open func urlSession( - _ session: URLSession, - streamTask: URLSessionStreamTask, - didBecome inputStream: InputStream, - outputStream: OutputStream) - { - streamTaskDidBecomeInputAndOutputStreams?(session, streamTask, inputStream, outputStream) + request.didFinishDownloading(using: downloadTask, with: .success(destination)) + } catch { + request.didFinishDownloading(using: downloadTask, with: .failure(error)) + } } } - -#endif diff --git a/Example/Pods/Alamofire/Source/SessionManager.swift b/Example/Pods/Alamofire/Source/SessionManager.swift deleted file mode 100644 index 02c36a7..0000000 --- a/Example/Pods/Alamofire/Source/SessionManager.swift +++ /dev/null @@ -1,899 +0,0 @@ -// -// SessionManager.swift -// -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import Foundation - -/// Responsible for creating and managing `Request` objects, as well as their underlying `NSURLSession`. -open class SessionManager { - - // MARK: - Helper Types - - /// Defines whether the `MultipartFormData` encoding was successful and contains result of the encoding as - /// associated values. - /// - /// - Success: Represents a successful `MultipartFormData` encoding and contains the new `UploadRequest` along with - /// streaming information. - /// - Failure: Used to represent a failure in the `MultipartFormData` encoding and also contains the encoding - /// error. - public enum MultipartFormDataEncodingResult { - case success(request: UploadRequest, streamingFromDisk: Bool, streamFileURL: URL?) - case failure(Error) - } - - // MARK: - Properties - - /// A default instance of `SessionManager`, used by top-level Alamofire request methods, and suitable for use - /// directly for any ad hoc requests. - public static let `default`: SessionManager = { - let configuration = URLSessionConfiguration.default - configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders - - return SessionManager(configuration: configuration) - }() - - /// Creates default values for the "Accept-Encoding", "Accept-Language" and "User-Agent" headers. - public static let defaultHTTPHeaders: HTTPHeaders = { - // Accept-Encoding HTTP Header; see https://tools.ietf.org/html/rfc7230#section-4.2.3 - let acceptEncoding: String = "gzip;q=1.0, compress;q=0.5" - - // Accept-Language HTTP Header; see https://tools.ietf.org/html/rfc7231#section-5.3.5 - let acceptLanguage = Locale.preferredLanguages.prefix(6).enumerated().map { index, languageCode in - let quality = 1.0 - (Double(index) * 0.1) - return "\(languageCode);q=\(quality)" - }.joined(separator: ", ") - - // User-Agent Header; see https://tools.ietf.org/html/rfc7231#section-5.5.3 - // Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 10.0.0) Alamofire/4.0.0` - let userAgent: String = { - if let info = Bundle.main.infoDictionary { - let executable = info[kCFBundleExecutableKey as String] as? String ?? "Unknown" - let bundle = info[kCFBundleIdentifierKey as String] as? String ?? "Unknown" - let appVersion = info["CFBundleShortVersionString"] as? String ?? "Unknown" - let appBuild = info[kCFBundleVersionKey as String] as? String ?? "Unknown" - - let osNameVersion: String = { - let version = ProcessInfo.processInfo.operatingSystemVersion - let versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)" - - let osName: String = { - #if os(iOS) - return "iOS" - #elseif os(watchOS) - return "watchOS" - #elseif os(tvOS) - return "tvOS" - #elseif os(macOS) - return "OS X" - #elseif os(Linux) - return "Linux" - #else - return "Unknown" - #endif - }() - - return "\(osName) \(versionString)" - }() - - let alamofireVersion: String = { - guard - let afInfo = Bundle(for: SessionManager.self).infoDictionary, - let build = afInfo["CFBundleShortVersionString"] - else { return "Unknown" } - - return "Alamofire/\(build)" - }() - - return "\(executable)/\(appVersion) (\(bundle); build:\(appBuild); \(osNameVersion)) \(alamofireVersion)" - } - - return "Alamofire" - }() - - return [ - "Accept-Encoding": acceptEncoding, - "Accept-Language": acceptLanguage, - "User-Agent": userAgent - ] - }() - - /// Default memory threshold used when encoding `MultipartFormData` in bytes. - public static let multipartFormDataEncodingMemoryThreshold: UInt64 = 10_000_000 - - /// The underlying session. - public let session: URLSession - - /// The session delegate handling all the task and session delegate callbacks. - public let delegate: SessionDelegate - - /// Whether to start requests immediately after being constructed. `true` by default. - open var startRequestsImmediately: Bool = true - - /// The request adapter called each time a new request is created. - open var adapter: RequestAdapter? - - /// The request retrier called each time a request encounters an error to determine whether to retry the request. - open var retrier: RequestRetrier? { - get { return delegate.retrier } - set { delegate.retrier = newValue } - } - - /// The background completion handler closure provided by the UIApplicationDelegate - /// `application:handleEventsForBackgroundURLSession:completionHandler:` method. By setting the background - /// completion handler, the SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` closure implementation - /// will automatically call the handler. - /// - /// If you need to handle your own events before the handler is called, then you need to override the - /// SessionDelegate `sessionDidFinishEventsForBackgroundURLSession` and manually call the handler when finished. - /// - /// `nil` by default. - open var backgroundCompletionHandler: (() -> Void)? - - let queue = DispatchQueue(label: "org.alamofire.session-manager." + UUID().uuidString) - - // MARK: - Lifecycle - - /// Creates an instance with the specified `configuration`, `delegate` and `serverTrustPolicyManager`. - /// - /// - parameter configuration: The configuration used to construct the managed session. - /// `URLSessionConfiguration.default` by default. - /// - parameter delegate: The delegate used when initializing the session. `SessionDelegate()` by - /// default. - /// - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust - /// challenges. `nil` by default. - /// - /// - returns: The new `SessionManager` instance. - public init( - configuration: URLSessionConfiguration = URLSessionConfiguration.default, - delegate: SessionDelegate = SessionDelegate(), - serverTrustPolicyManager: ServerTrustPolicyManager? = nil) - { - self.delegate = delegate - self.session = URLSession(configuration: configuration, delegate: delegate, delegateQueue: nil) - - commonInit(serverTrustPolicyManager: serverTrustPolicyManager) - } - - /// Creates an instance with the specified `session`, `delegate` and `serverTrustPolicyManager`. - /// - /// - parameter session: The URL session. - /// - parameter delegate: The delegate of the URL session. Must equal the URL session's delegate. - /// - parameter serverTrustPolicyManager: The server trust policy manager to use for evaluating all server trust - /// challenges. `nil` by default. - /// - /// - returns: The new `SessionManager` instance if the URL session's delegate matches; `nil` otherwise. - public init?( - session: URLSession, - delegate: SessionDelegate, - serverTrustPolicyManager: ServerTrustPolicyManager? = nil) - { - guard delegate === session.delegate else { return nil } - - self.delegate = delegate - self.session = session - - commonInit(serverTrustPolicyManager: serverTrustPolicyManager) - } - - private func commonInit(serverTrustPolicyManager: ServerTrustPolicyManager?) { - session.serverTrustPolicyManager = serverTrustPolicyManager - - delegate.sessionManager = self - - delegate.sessionDidFinishEventsForBackgroundURLSession = { [weak self] session in - guard let strongSelf = self else { return } - DispatchQueue.main.async { strongSelf.backgroundCompletionHandler?() } - } - } - - deinit { - session.invalidateAndCancel() - } - - // MARK: - Data Request - - /// Creates a `DataRequest` to retrieve the contents of the specified `url`, `method`, `parameters`, `encoding` - /// and `headers`. - /// - /// - parameter url: The URL. - /// - parameter method: The HTTP method. `.get` by default. - /// - parameter parameters: The parameters. `nil` by default. - /// - parameter encoding: The parameter encoding. `URLEncoding.default` by default. - /// - parameter headers: The HTTP headers. `nil` by default. - /// - /// - returns: The created `DataRequest`. - @discardableResult - open func request( - _ url: URLConvertible, - method: HTTPMethod = .get, - parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil) - -> DataRequest - { - var originalRequest: URLRequest? - - do { - originalRequest = try URLRequest(url: url, method: method, headers: headers) - let encodedURLRequest = try encoding.encode(originalRequest!, with: parameters) - return request(encodedURLRequest) - } catch { - return request(originalRequest, failedWith: error) - } - } - - /// Creates a `DataRequest` to retrieve the contents of a URL based on the specified `urlRequest`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter urlRequest: The URL request. - /// - /// - returns: The created `DataRequest`. - @discardableResult - open func request(_ urlRequest: URLRequestConvertible) -> DataRequest { - var originalRequest: URLRequest? - - do { - originalRequest = try urlRequest.asURLRequest() - let originalTask = DataRequest.Requestable(urlRequest: originalRequest!) - - let task = try originalTask.task(session: session, adapter: adapter, queue: queue) - let request = DataRequest(session: session, requestTask: .data(originalTask, task)) - - delegate[task] = request - - if startRequestsImmediately { request.resume() } - - return request - } catch { - return request(originalRequest, failedWith: error) - } - } - - // MARK: Private - Request Implementation - - private func request(_ urlRequest: URLRequest?, failedWith error: Error) -> DataRequest { - var requestTask: Request.RequestTask = .data(nil, nil) - - if let urlRequest = urlRequest { - let originalTask = DataRequest.Requestable(urlRequest: urlRequest) - requestTask = .data(originalTask, nil) - } - - let underlyingError = error.underlyingAdaptError ?? error - let request = DataRequest(session: session, requestTask: requestTask, error: underlyingError) - - if let retrier = retrier, error is AdaptError { - allowRetrier(retrier, toRetry: request, with: underlyingError) - } else { - if startRequestsImmediately { request.resume() } - } - - return request - } - - // MARK: - Download Request - - // MARK: URL Request - - /// Creates a `DownloadRequest` to retrieve the contents the specified `url`, `method`, `parameters`, `encoding`, - /// `headers` and save them to the `destination`. - /// - /// If `destination` is not specified, the contents will remain in the temporary location determined by the - /// underlying URL session. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter url: The URL. - /// - parameter method: The HTTP method. `.get` by default. - /// - parameter parameters: The parameters. `nil` by default. - /// - parameter encoding: The parameter encoding. `URLEncoding.default` by default. - /// - parameter headers: The HTTP headers. `nil` by default. - /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. - /// - /// - returns: The created `DownloadRequest`. - @discardableResult - open func download( - _ url: URLConvertible, - method: HTTPMethod = .get, - parameters: Parameters? = nil, - encoding: ParameterEncoding = URLEncoding.default, - headers: HTTPHeaders? = nil, - to destination: DownloadRequest.DownloadFileDestination? = nil) - -> DownloadRequest - { - do { - let urlRequest = try URLRequest(url: url, method: method, headers: headers) - let encodedURLRequest = try encoding.encode(urlRequest, with: parameters) - return download(encodedURLRequest, to: destination) - } catch { - return download(nil, to: destination, failedWith: error) - } - } - - /// Creates a `DownloadRequest` to retrieve the contents of a URL based on the specified `urlRequest` and save - /// them to the `destination`. - /// - /// If `destination` is not specified, the contents will remain in the temporary location determined by the - /// underlying URL session. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter urlRequest: The URL request - /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. - /// - /// - returns: The created `DownloadRequest`. - @discardableResult - open func download( - _ urlRequest: URLRequestConvertible, - to destination: DownloadRequest.DownloadFileDestination? = nil) - -> DownloadRequest - { - do { - let urlRequest = try urlRequest.asURLRequest() - return download(.request(urlRequest), to: destination) - } catch { - return download(nil, to: destination, failedWith: error) - } - } - - // MARK: Resume Data - - /// Creates a `DownloadRequest` from the `resumeData` produced from a previous request cancellation to retrieve - /// the contents of the original request and save them to the `destination`. - /// - /// If `destination` is not specified, the contents will remain in the temporary location determined by the - /// underlying URL session. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), `resumeData` is broken - /// on background URL session configurations. There's an underlying bug in the `resumeData` generation logic where the - /// data is written incorrectly and will always fail to resume the download. For more information about the bug and - /// possible workarounds, please refer to the following Stack Overflow post: - /// - /// - http://stackoverflow.com/a/39347461/1342462 - /// - /// - parameter resumeData: The resume data. This is an opaque data blob produced by `URLSessionDownloadTask` - /// when a task is cancelled. See `URLSession -downloadTask(withResumeData:)` for - /// additional information. - /// - parameter destination: The closure used to determine the destination of the downloaded file. `nil` by default. - /// - /// - returns: The created `DownloadRequest`. - @discardableResult - open func download( - resumingWith resumeData: Data, - to destination: DownloadRequest.DownloadFileDestination? = nil) - -> DownloadRequest - { - return download(.resumeData(resumeData), to: destination) - } - - // MARK: Private - Download Implementation - - private func download( - _ downloadable: DownloadRequest.Downloadable, - to destination: DownloadRequest.DownloadFileDestination?) - -> DownloadRequest - { - do { - let task = try downloadable.task(session: session, adapter: adapter, queue: queue) - let download = DownloadRequest(session: session, requestTask: .download(downloadable, task)) - - download.downloadDelegate.destination = destination - - delegate[task] = download - - if startRequestsImmediately { download.resume() } - - return download - } catch { - return download(downloadable, to: destination, failedWith: error) - } - } - - private func download( - _ downloadable: DownloadRequest.Downloadable?, - to destination: DownloadRequest.DownloadFileDestination?, - failedWith error: Error) - -> DownloadRequest - { - var downloadTask: Request.RequestTask = .download(nil, nil) - - if let downloadable = downloadable { - downloadTask = .download(downloadable, nil) - } - - let underlyingError = error.underlyingAdaptError ?? error - - let download = DownloadRequest(session: session, requestTask: downloadTask, error: underlyingError) - download.downloadDelegate.destination = destination - - if let retrier = retrier, error is AdaptError { - allowRetrier(retrier, toRetry: download, with: underlyingError) - } else { - if startRequestsImmediately { download.resume() } - } - - return download - } - - // MARK: - Upload Request - - // MARK: File - - /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `file`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter file: The file to upload. - /// - parameter url: The URL. - /// - parameter method: The HTTP method. `.post` by default. - /// - parameter headers: The HTTP headers. `nil` by default. - /// - /// - returns: The created `UploadRequest`. - @discardableResult - open func upload( - _ fileURL: URL, - to url: URLConvertible, - method: HTTPMethod = .post, - headers: HTTPHeaders? = nil) - -> UploadRequest - { - do { - let urlRequest = try URLRequest(url: url, method: method, headers: headers) - return upload(fileURL, with: urlRequest) - } catch { - return upload(nil, failedWith: error) - } - } - - /// Creates a `UploadRequest` from the specified `urlRequest` for uploading the `file`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter file: The file to upload. - /// - parameter urlRequest: The URL request. - /// - /// - returns: The created `UploadRequest`. - @discardableResult - open func upload(_ fileURL: URL, with urlRequest: URLRequestConvertible) -> UploadRequest { - do { - let urlRequest = try urlRequest.asURLRequest() - return upload(.file(fileURL, urlRequest)) - } catch { - return upload(nil, failedWith: error) - } - } - - // MARK: Data - - /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `data`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter data: The data to upload. - /// - parameter url: The URL. - /// - parameter method: The HTTP method. `.post` by default. - /// - parameter headers: The HTTP headers. `nil` by default. - /// - /// - returns: The created `UploadRequest`. - @discardableResult - open func upload( - _ data: Data, - to url: URLConvertible, - method: HTTPMethod = .post, - headers: HTTPHeaders? = nil) - -> UploadRequest - { - do { - let urlRequest = try URLRequest(url: url, method: method, headers: headers) - return upload(data, with: urlRequest) - } catch { - return upload(nil, failedWith: error) - } - } - - /// Creates an `UploadRequest` from the specified `urlRequest` for uploading the `data`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter data: The data to upload. - /// - parameter urlRequest: The URL request. - /// - /// - returns: The created `UploadRequest`. - @discardableResult - open func upload(_ data: Data, with urlRequest: URLRequestConvertible) -> UploadRequest { - do { - let urlRequest = try urlRequest.asURLRequest() - return upload(.data(data, urlRequest)) - } catch { - return upload(nil, failedWith: error) - } - } - - // MARK: InputStream - - /// Creates an `UploadRequest` from the specified `url`, `method` and `headers` for uploading the `stream`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter stream: The stream to upload. - /// - parameter url: The URL. - /// - parameter method: The HTTP method. `.post` by default. - /// - parameter headers: The HTTP headers. `nil` by default. - /// - /// - returns: The created `UploadRequest`. - @discardableResult - open func upload( - _ stream: InputStream, - to url: URLConvertible, - method: HTTPMethod = .post, - headers: HTTPHeaders? = nil) - -> UploadRequest - { - do { - let urlRequest = try URLRequest(url: url, method: method, headers: headers) - return upload(stream, with: urlRequest) - } catch { - return upload(nil, failedWith: error) - } - } - - /// Creates an `UploadRequest` from the specified `urlRequest` for uploading the `stream`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter stream: The stream to upload. - /// - parameter urlRequest: The URL request. - /// - /// - returns: The created `UploadRequest`. - @discardableResult - open func upload(_ stream: InputStream, with urlRequest: URLRequestConvertible) -> UploadRequest { - do { - let urlRequest = try urlRequest.asURLRequest() - return upload(.stream(stream, urlRequest)) - } catch { - return upload(nil, failedWith: error) - } - } - - // MARK: MultipartFormData - - /// Encodes `multipartFormData` using `encodingMemoryThreshold` and calls `encodingCompletion` with new - /// `UploadRequest` using the `url`, `method` and `headers`. - /// - /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative - /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most - /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to - /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory - /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be - /// used for larger payloads such as video content. - /// - /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory - /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, - /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk - /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding - /// technique was used. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. - /// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. - /// `multipartFormDataEncodingMemoryThreshold` by default. - /// - parameter url: The URL. - /// - parameter method: The HTTP method. `.post` by default. - /// - parameter headers: The HTTP headers. `nil` by default. - /// - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. - open func upload( - multipartFormData: @escaping (MultipartFormData) -> Void, - usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, - to url: URLConvertible, - method: HTTPMethod = .post, - headers: HTTPHeaders? = nil, - queue: DispatchQueue? = nil, - encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?) - { - do { - let urlRequest = try URLRequest(url: url, method: method, headers: headers) - - return upload( - multipartFormData: multipartFormData, - usingThreshold: encodingMemoryThreshold, - with: urlRequest, - queue: queue, - encodingCompletion: encodingCompletion - ) - } catch { - (queue ?? DispatchQueue.main).async { encodingCompletion?(.failure(error)) } - } - } - - /// Encodes `multipartFormData` using `encodingMemoryThreshold` and calls `encodingCompletion` with new - /// `UploadRequest` using the `urlRequest`. - /// - /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cummulative - /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most - /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to - /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory - /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be - /// used for larger payloads such as video content. - /// - /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory - /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`, - /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk - /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding - /// technique was used. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter multipartFormData: The closure used to append body parts to the `MultipartFormData`. - /// - parameter encodingMemoryThreshold: The encoding memory threshold in bytes. - /// `multipartFormDataEncodingMemoryThreshold` by default. - /// - parameter urlRequest: The URL request. - /// - parameter encodingCompletion: The closure called when the `MultipartFormData` encoding is complete. - open func upload( - multipartFormData: @escaping (MultipartFormData) -> Void, - usingThreshold encodingMemoryThreshold: UInt64 = SessionManager.multipartFormDataEncodingMemoryThreshold, - with urlRequest: URLRequestConvertible, - queue: DispatchQueue? = nil, - encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?) - { - DispatchQueue.global(qos: .utility).async { - let formData = MultipartFormData() - multipartFormData(formData) - - var tempFileURL: URL? - - do { - var urlRequestWithContentType = try urlRequest.asURLRequest() - urlRequestWithContentType.setValue(formData.contentType, forHTTPHeaderField: "Content-Type") - - let isBackgroundSession = self.session.configuration.identifier != nil - - if formData.contentLength < encodingMemoryThreshold && !isBackgroundSession { - let data = try formData.encode() - - let encodingResult = MultipartFormDataEncodingResult.success( - request: self.upload(data, with: urlRequestWithContentType), - streamingFromDisk: false, - streamFileURL: nil - ) - - (queue ?? DispatchQueue.main).async { encodingCompletion?(encodingResult) } - } else { - let fileManager = FileManager.default - let tempDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory()) - let directoryURL = tempDirectoryURL.appendingPathComponent("org.alamofire.manager/multipart.form.data") - let fileName = UUID().uuidString - let fileURL = directoryURL.appendingPathComponent(fileName) - - tempFileURL = fileURL - - var directoryError: Error? - - // Create directory inside serial queue to ensure two threads don't do this in parallel - self.queue.sync { - do { - try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil) - } catch { - directoryError = error - } - } - - if let directoryError = directoryError { throw directoryError } - - try formData.writeEncodedData(to: fileURL) - - let upload = self.upload(fileURL, with: urlRequestWithContentType) - - // Cleanup the temp file once the upload is complete - upload.delegate.queue.addOperation { - do { - try FileManager.default.removeItem(at: fileURL) - } catch { - // No-op - } - } - - (queue ?? DispatchQueue.main).async { - let encodingResult = MultipartFormDataEncodingResult.success( - request: upload, - streamingFromDisk: true, - streamFileURL: fileURL - ) - - encodingCompletion?(encodingResult) - } - } - } catch { - // Cleanup the temp file in the event that the multipart form data encoding failed - if let tempFileURL = tempFileURL { - do { - try FileManager.default.removeItem(at: tempFileURL) - } catch { - // No-op - } - } - - (queue ?? DispatchQueue.main).async { encodingCompletion?(.failure(error)) } - } - } - } - - // MARK: Private - Upload Implementation - - private func upload(_ uploadable: UploadRequest.Uploadable) -> UploadRequest { - do { - let task = try uploadable.task(session: session, adapter: adapter, queue: queue) - let upload = UploadRequest(session: session, requestTask: .upload(uploadable, task)) - - if case let .stream(inputStream, _) = uploadable { - upload.delegate.taskNeedNewBodyStream = { _, _ in inputStream } - } - - delegate[task] = upload - - if startRequestsImmediately { upload.resume() } - - return upload - } catch { - return upload(uploadable, failedWith: error) - } - } - - private func upload(_ uploadable: UploadRequest.Uploadable?, failedWith error: Error) -> UploadRequest { - var uploadTask: Request.RequestTask = .upload(nil, nil) - - if let uploadable = uploadable { - uploadTask = .upload(uploadable, nil) - } - - let underlyingError = error.underlyingAdaptError ?? error - let upload = UploadRequest(session: session, requestTask: uploadTask, error: underlyingError) - - if let retrier = retrier, error is AdaptError { - allowRetrier(retrier, toRetry: upload, with: underlyingError) - } else { - if startRequestsImmediately { upload.resume() } - } - - return upload - } - -#if !os(watchOS) - - // MARK: - Stream Request - - // MARK: Hostname and Port - - /// Creates a `StreamRequest` for bidirectional streaming using the `hostname` and `port`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter hostName: The hostname of the server to connect to. - /// - parameter port: The port of the server to connect to. - /// - /// - returns: The created `StreamRequest`. - @discardableResult - @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) - open func stream(withHostName hostName: String, port: Int) -> StreamRequest { - return stream(.stream(hostName: hostName, port: port)) - } - - // MARK: NetService - - /// Creates a `StreamRequest` for bidirectional streaming using the `netService`. - /// - /// If `startRequestsImmediately` is `true`, the request will have `resume()` called before being returned. - /// - /// - parameter netService: The net service used to identify the endpoint. - /// - /// - returns: The created `StreamRequest`. - @discardableResult - @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) - open func stream(with netService: NetService) -> StreamRequest { - return stream(.netService(netService)) - } - - // MARK: Private - Stream Implementation - - @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) - private func stream(_ streamable: StreamRequest.Streamable) -> StreamRequest { - do { - let task = try streamable.task(session: session, adapter: adapter, queue: queue) - let request = StreamRequest(session: session, requestTask: .stream(streamable, task)) - - delegate[task] = request - - if startRequestsImmediately { request.resume() } - - return request - } catch { - return stream(failedWith: error) - } - } - - @available(iOS 9.0, macOS 10.11, tvOS 9.0, *) - private func stream(failedWith error: Error) -> StreamRequest { - let stream = StreamRequest(session: session, requestTask: .stream(nil, nil), error: error) - if startRequestsImmediately { stream.resume() } - return stream - } - -#endif - - // MARK: - Internal - Retry Request - - func retry(_ request: Request) -> Bool { - guard let originalTask = request.originalTask else { return false } - - do { - let task = try originalTask.task(session: session, adapter: adapter, queue: queue) - - if let originalTask = request.task { - delegate[originalTask] = nil // removes the old request to avoid endless growth - } - - request.delegate.task = task // resets all task delegate data - - request.retryCount += 1 - request.startTime = CFAbsoluteTimeGetCurrent() - request.endTime = nil - - task.resume() - - return true - } catch { - request.delegate.error = error.underlyingAdaptError ?? error - return false - } - } - - private func allowRetrier(_ retrier: RequestRetrier, toRetry request: Request, with error: Error) { - DispatchQueue.utility.async { [weak self] in - guard let strongSelf = self else { return } - - retrier.should(strongSelf, retry: request, with: error) { shouldRetry, timeDelay in - guard let strongSelf = self else { return } - - guard shouldRetry else { - if strongSelf.startRequestsImmediately { request.resume() } - return - } - - DispatchQueue.utility.after(timeDelay) { - guard let strongSelf = self else { return } - - let retrySucceeded = strongSelf.retry(request) - - if retrySucceeded, let task = request.task { - strongSelf.delegate[task] = request - } else { - if strongSelf.startRequestsImmediately { request.resume() } - } - } - } - } - } -} diff --git a/Example/Pods/Alamofire/Source/TaskDelegate.swift b/Example/Pods/Alamofire/Source/TaskDelegate.swift deleted file mode 100644 index 5705737..0000000 --- a/Example/Pods/Alamofire/Source/TaskDelegate.swift +++ /dev/null @@ -1,466 +0,0 @@ -// -// TaskDelegate.swift -// -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import Foundation - -/// The task delegate is responsible for handling all delegate callbacks for the underlying task as well as -/// executing all operations attached to the serial operation queue upon task completion. -open class TaskDelegate: NSObject { - - // MARK: Properties - - /// The serial operation queue used to execute all operations after the task completes. - public let queue: OperationQueue - - /// The data returned by the server. - public var data: Data? { return nil } - - /// The error generated throughout the lifecyle of the task. - public var error: Error? - - var task: URLSessionTask? { - set { - taskLock.lock(); defer { taskLock.unlock() } - _task = newValue - } - get { - taskLock.lock(); defer { taskLock.unlock() } - return _task - } - } - - var initialResponseTime: CFAbsoluteTime? - var credential: URLCredential? - var metrics: AnyObject? // URLSessionTaskMetrics - - private var _task: URLSessionTask? { - didSet { reset() } - } - - private let taskLock = NSLock() - - // MARK: Lifecycle - - init(task: URLSessionTask?) { - _task = task - - self.queue = { - let operationQueue = OperationQueue() - - operationQueue.maxConcurrentOperationCount = 1 - operationQueue.isSuspended = true - operationQueue.qualityOfService = .utility - - return operationQueue - }() - } - - func reset() { - error = nil - initialResponseTime = nil - } - - // MARK: URLSessionTaskDelegate - - var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> URLRequest?)? - var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? - var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> InputStream?)? - var taskDidCompleteWithError: ((URLSession, URLSessionTask, Error?) -> Void)? - - @objc(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:) - func urlSession( - _ session: URLSession, - task: URLSessionTask, - willPerformHTTPRedirection response: HTTPURLResponse, - newRequest request: URLRequest, - completionHandler: @escaping (URLRequest?) -> Void) - { - var redirectRequest: URLRequest? = request - - if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection { - redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request) - } - - completionHandler(redirectRequest) - } - - @objc(URLSession:task:didReceiveChallenge:completionHandler:) - func urlSession( - _ session: URLSession, - task: URLSessionTask, - didReceive challenge: URLAuthenticationChallenge, - completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) - { - var disposition: URLSession.AuthChallengeDisposition = .performDefaultHandling - var credential: URLCredential? - - if let taskDidReceiveChallenge = taskDidReceiveChallenge { - (disposition, credential) = taskDidReceiveChallenge(session, task, challenge) - } else if challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust { - let host = challenge.protectionSpace.host - - if - let serverTrustPolicy = session.serverTrustPolicyManager?.serverTrustPolicy(forHost: host), - let serverTrust = challenge.protectionSpace.serverTrust - { - if serverTrustPolicy.evaluate(serverTrust, forHost: host) { - disposition = .useCredential - credential = URLCredential(trust: serverTrust) - } else { - disposition = .cancelAuthenticationChallenge - } - } - } else { - if challenge.previousFailureCount > 0 { - disposition = .rejectProtectionSpace - } else { - credential = self.credential ?? session.configuration.urlCredentialStorage?.defaultCredential(for: challenge.protectionSpace) - - if credential != nil { - disposition = .useCredential - } - } - } - - completionHandler(disposition, credential) - } - - @objc(URLSession:task:needNewBodyStream:) - func urlSession( - _ session: URLSession, - task: URLSessionTask, - needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) - { - var bodyStream: InputStream? - - if let taskNeedNewBodyStream = taskNeedNewBodyStream { - bodyStream = taskNeedNewBodyStream(session, task) - } - - completionHandler(bodyStream) - } - - @objc(URLSession:task:didCompleteWithError:) - func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { - if let taskDidCompleteWithError = taskDidCompleteWithError { - taskDidCompleteWithError(session, task, error) - } else { - if let error = error { - if self.error == nil { self.error = error } - - if - let downloadDelegate = self as? DownloadTaskDelegate, - let resumeData = (error as NSError).userInfo[NSURLSessionDownloadTaskResumeData] as? Data - { - downloadDelegate.resumeData = resumeData - } - } - - queue.isSuspended = false - } - } -} - -// MARK: - - -class DataTaskDelegate: TaskDelegate, URLSessionDataDelegate { - - // MARK: Properties - - var dataTask: URLSessionDataTask { return task as! URLSessionDataTask } - - override var data: Data? { - if dataStream != nil { - return nil - } else { - return mutableData - } - } - - var progress: Progress - var progressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)? - - var dataStream: ((_ data: Data) -> Void)? - - private var totalBytesReceived: Int64 = 0 - private var mutableData: Data - - private var expectedContentLength: Int64? - - // MARK: Lifecycle - - override init(task: URLSessionTask?) { - mutableData = Data() - progress = Progress(totalUnitCount: 0) - - super.init(task: task) - } - - override func reset() { - super.reset() - - progress = Progress(totalUnitCount: 0) - totalBytesReceived = 0 - mutableData = Data() - expectedContentLength = nil - } - - // MARK: URLSessionDataDelegate - - var dataTaskDidReceiveResponse: ((URLSession, URLSessionDataTask, URLResponse) -> URLSession.ResponseDisposition)? - var dataTaskDidBecomeDownloadTask: ((URLSession, URLSessionDataTask, URLSessionDownloadTask) -> Void)? - var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)? - var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)? - - func urlSession( - _ session: URLSession, - dataTask: URLSessionDataTask, - didReceive response: URLResponse, - completionHandler: @escaping (URLSession.ResponseDisposition) -> Void) - { - var disposition: URLSession.ResponseDisposition = .allow - - expectedContentLength = response.expectedContentLength - - if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse { - disposition = dataTaskDidReceiveResponse(session, dataTask, response) - } - - completionHandler(disposition) - } - - func urlSession( - _ session: URLSession, - dataTask: URLSessionDataTask, - didBecome downloadTask: URLSessionDownloadTask) - { - dataTaskDidBecomeDownloadTask?(session, dataTask, downloadTask) - } - - func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { - if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } - - if let dataTaskDidReceiveData = dataTaskDidReceiveData { - dataTaskDidReceiveData(session, dataTask, data) - } else { - if let dataStream = dataStream { - dataStream(data) - } else { - mutableData.append(data) - } - - let bytesReceived = Int64(data.count) - totalBytesReceived += bytesReceived - let totalBytesExpected = dataTask.response?.expectedContentLength ?? NSURLSessionTransferSizeUnknown - - progress.totalUnitCount = totalBytesExpected - progress.completedUnitCount = totalBytesReceived - - if let progressHandler = progressHandler { - progressHandler.queue.async { progressHandler.closure(self.progress) } - } - } - } - - func urlSession( - _ session: URLSession, - dataTask: URLSessionDataTask, - willCacheResponse proposedResponse: CachedURLResponse, - completionHandler: @escaping (CachedURLResponse?) -> Void) - { - var cachedResponse: CachedURLResponse? = proposedResponse - - if let dataTaskWillCacheResponse = dataTaskWillCacheResponse { - cachedResponse = dataTaskWillCacheResponse(session, dataTask, proposedResponse) - } - - completionHandler(cachedResponse) - } -} - -// MARK: - - -class DownloadTaskDelegate: TaskDelegate, URLSessionDownloadDelegate { - - // MARK: Properties - - var downloadTask: URLSessionDownloadTask { return task as! URLSessionDownloadTask } - - var progress: Progress - var progressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)? - - var resumeData: Data? - override var data: Data? { return resumeData } - - var destination: DownloadRequest.DownloadFileDestination? - - var temporaryURL: URL? - var destinationURL: URL? - - var fileURL: URL? { return destination != nil ? destinationURL : temporaryURL } - - // MARK: Lifecycle - - override init(task: URLSessionTask?) { - progress = Progress(totalUnitCount: 0) - super.init(task: task) - } - - override func reset() { - super.reset() - - progress = Progress(totalUnitCount: 0) - resumeData = nil - } - - // MARK: URLSessionDownloadDelegate - - var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> URL)? - var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)? - var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)? - - func urlSession( - _ session: URLSession, - downloadTask: URLSessionDownloadTask, - didFinishDownloadingTo location: URL) - { - temporaryURL = location - - guard - let destination = destination, - let response = downloadTask.response as? HTTPURLResponse - else { return } - - let result = destination(location, response) - let destinationURL = result.destinationURL - let options = result.options - - self.destinationURL = destinationURL - - do { - if options.contains(.removePreviousFile), FileManager.default.fileExists(atPath: destinationURL.path) { - try FileManager.default.removeItem(at: destinationURL) - } - - if options.contains(.createIntermediateDirectories) { - let directory = destinationURL.deletingLastPathComponent() - try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true) - } - - try FileManager.default.moveItem(at: location, to: destinationURL) - } catch { - self.error = error - } - } - - func urlSession( - _ session: URLSession, - downloadTask: URLSessionDownloadTask, - didWriteData bytesWritten: Int64, - totalBytesWritten: Int64, - totalBytesExpectedToWrite: Int64) - { - if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } - - if let downloadTaskDidWriteData = downloadTaskDidWriteData { - downloadTaskDidWriteData( - session, - downloadTask, - bytesWritten, - totalBytesWritten, - totalBytesExpectedToWrite - ) - } else { - progress.totalUnitCount = totalBytesExpectedToWrite - progress.completedUnitCount = totalBytesWritten - - if let progressHandler = progressHandler { - progressHandler.queue.async { progressHandler.closure(self.progress) } - } - } - } - - func urlSession( - _ session: URLSession, - downloadTask: URLSessionDownloadTask, - didResumeAtOffset fileOffset: Int64, - expectedTotalBytes: Int64) - { - if let downloadTaskDidResumeAtOffset = downloadTaskDidResumeAtOffset { - downloadTaskDidResumeAtOffset(session, downloadTask, fileOffset, expectedTotalBytes) - } else { - progress.totalUnitCount = expectedTotalBytes - progress.completedUnitCount = fileOffset - } - } -} - -// MARK: - - -class UploadTaskDelegate: DataTaskDelegate { - - // MARK: Properties - - var uploadTask: URLSessionUploadTask { return task as! URLSessionUploadTask } - - var uploadProgress: Progress - var uploadProgressHandler: (closure: Request.ProgressHandler, queue: DispatchQueue)? - - // MARK: Lifecycle - - override init(task: URLSessionTask?) { - uploadProgress = Progress(totalUnitCount: 0) - super.init(task: task) - } - - override func reset() { - super.reset() - uploadProgress = Progress(totalUnitCount: 0) - } - - // MARK: URLSessionTaskDelegate - - var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)? - - func URLSession( - _ session: URLSession, - task: URLSessionTask, - didSendBodyData bytesSent: Int64, - totalBytesSent: Int64, - totalBytesExpectedToSend: Int64) - { - if initialResponseTime == nil { initialResponseTime = CFAbsoluteTimeGetCurrent() } - - if let taskDidSendBodyData = taskDidSendBodyData { - taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend) - } else { - uploadProgress.totalUnitCount = totalBytesExpectedToSend - uploadProgress.completedUnitCount = totalBytesSent - - if let uploadProgressHandler = uploadProgressHandler { - uploadProgressHandler.queue.async { uploadProgressHandler.closure(self.uploadProgress) } - } - } - } -} diff --git a/Example/Pods/Alamofire/Source/Timeline.swift b/Example/Pods/Alamofire/Source/Timeline.swift deleted file mode 100644 index 596c1bd..0000000 --- a/Example/Pods/Alamofire/Source/Timeline.swift +++ /dev/null @@ -1,136 +0,0 @@ -// -// Timeline.swift -// -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// - -import Foundation - -/// Responsible for computing the timing metrics for the complete lifecycle of a `Request`. -public struct Timeline { - /// The time the request was initialized. - public let requestStartTime: CFAbsoluteTime - - /// The time the first bytes were received from or sent to the server. - public let initialResponseTime: CFAbsoluteTime - - /// The time when the request was completed. - public let requestCompletedTime: CFAbsoluteTime - - /// The time when the response serialization was completed. - public let serializationCompletedTime: CFAbsoluteTime - - /// The time interval in seconds from the time the request started to the initial response from the server. - public let latency: TimeInterval - - /// The time interval in seconds from the time the request started to the time the request completed. - public let requestDuration: TimeInterval - - /// The time interval in seconds from the time the request completed to the time response serialization completed. - public let serializationDuration: TimeInterval - - /// The time interval in seconds from the time the request started to the time response serialization completed. - public let totalDuration: TimeInterval - - /// Creates a new `Timeline` instance with the specified request times. - /// - /// - parameter requestStartTime: The time the request was initialized. Defaults to `0.0`. - /// - parameter initialResponseTime: The time the first bytes were received from or sent to the server. - /// Defaults to `0.0`. - /// - parameter requestCompletedTime: The time when the request was completed. Defaults to `0.0`. - /// - parameter serializationCompletedTime: The time when the response serialization was completed. Defaults - /// to `0.0`. - /// - /// - returns: The new `Timeline` instance. - public init( - requestStartTime: CFAbsoluteTime = 0.0, - initialResponseTime: CFAbsoluteTime = 0.0, - requestCompletedTime: CFAbsoluteTime = 0.0, - serializationCompletedTime: CFAbsoluteTime = 0.0) - { - self.requestStartTime = requestStartTime - self.initialResponseTime = initialResponseTime - self.requestCompletedTime = requestCompletedTime - self.serializationCompletedTime = serializationCompletedTime - - self.latency = initialResponseTime - requestStartTime - self.requestDuration = requestCompletedTime - requestStartTime - self.serializationDuration = serializationCompletedTime - requestCompletedTime - self.totalDuration = serializationCompletedTime - requestStartTime - } -} - -// MARK: - CustomStringConvertible - -extension Timeline: CustomStringConvertible { - /// The textual representation used when written to an output stream, which includes the latency, the request - /// duration and the total duration. - public var description: String { - let latency = String(format: "%.3f", self.latency) - let requestDuration = String(format: "%.3f", self.requestDuration) - let serializationDuration = String(format: "%.3f", self.serializationDuration) - let totalDuration = String(format: "%.3f", self.totalDuration) - - // NOTE: Had to move to string concatenation due to memory leak filed as rdar://26761490. Once memory leak is - // fixed, we should move back to string interpolation by reverting commit 7d4a43b1. - let timings = [ - "\"Latency\": " + latency + " secs", - "\"Request Duration\": " + requestDuration + " secs", - "\"Serialization Duration\": " + serializationDuration + " secs", - "\"Total Duration\": " + totalDuration + " secs" - ] - - return "Timeline: { " + timings.joined(separator: ", ") + " }" - } -} - -// MARK: - CustomDebugStringConvertible - -extension Timeline: CustomDebugStringConvertible { - /// The textual representation used when written to an output stream, which includes the request start time, the - /// initial response time, the request completed time, the serialization completed time, the latency, the request - /// duration and the total duration. - public var debugDescription: String { - let requestStartTime = String(format: "%.3f", self.requestStartTime) - let initialResponseTime = String(format: "%.3f", self.initialResponseTime) - let requestCompletedTime = String(format: "%.3f", self.requestCompletedTime) - let serializationCompletedTime = String(format: "%.3f", self.serializationCompletedTime) - let latency = String(format: "%.3f", self.latency) - let requestDuration = String(format: "%.3f", self.requestDuration) - let serializationDuration = String(format: "%.3f", self.serializationDuration) - let totalDuration = String(format: "%.3f", self.totalDuration) - - // NOTE: Had to move to string concatenation due to memory leak filed as rdar://26761490. Once memory leak is - // fixed, we should move back to string interpolation by reverting commit 7d4a43b1. - let timings = [ - "\"Request Start Time\": " + requestStartTime, - "\"Initial Response Time\": " + initialResponseTime, - "\"Request Completed Time\": " + requestCompletedTime, - "\"Serialization Completed Time\": " + serializationCompletedTime, - "\"Latency\": " + latency + " secs", - "\"Request Duration\": " + requestDuration + " secs", - "\"Serialization Duration\": " + serializationDuration + " secs", - "\"Total Duration\": " + totalDuration + " secs" - ] - - return "Timeline: { " + timings.joined(separator: ", ") + " }" - } -} diff --git a/Example/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift b/Example/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift new file mode 100644 index 0000000..369e8e4 --- /dev/null +++ b/Example/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift @@ -0,0 +1,105 @@ +// +// URLConvertible+URLRequestConvertible.swift +// +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// + +import Foundation + +/// Types adopting the `URLConvertible` protocol can be used to construct `URL`s, which can then be used to construct +/// `URLRequests`. +public protocol URLConvertible { + /// Returns a `URL` from the conforming instance or throws. + /// + /// - Returns: The `URL` created from the instance. + /// - Throws: Any error thrown while creating the `URL`. + func asURL() throws -> URL +} + +extension String: URLConvertible { + /// Returns a `URL` if `self` can be used to initialize a `URL` instance, otherwise throws. + /// + /// - Returns: The `URL` initialized with `self`. + /// - Throws: An `AFError.invalidURL` instance. + public func asURL() throws -> URL { + guard let url = URL(string: self) else { throw AFError.invalidURL(url: self) } + + return url + } +} + +extension URL: URLConvertible { + /// Returns `self`. + public func asURL() throws -> URL { return self } +} + +extension URLComponents: URLConvertible { + /// Returns a `URL` if the `self`'s `url` is not nil, otherwise throws. + /// + /// - Returns: The `URL` from the `url` property. + /// - Throws: An `AFError.invalidURL` instance. + public func asURL() throws -> URL { + guard let url = url else { throw AFError.invalidURL(url: self) } + + return url + } +} + +// MARK: - + +/// Types adopting the `URLRequestConvertible` protocol can be used to safely construct `URLRequest`s. +public protocol URLRequestConvertible { + /// Returns a `URLRequest` or throws if an `Error` was encoutered. + /// + /// - Returns: A `URLRequest`. + /// - Throws: Any error thrown while constructing the `URLRequest`. + func asURLRequest() throws -> URLRequest +} + +extension URLRequestConvertible { + /// The `URLRequest` returned by discarding any `Error` encountered. + public var urlRequest: URLRequest? { return try? asURLRequest() } +} + +extension URLRequest: URLRequestConvertible { + /// Returns `self`. + public func asURLRequest() throws -> URLRequest { return self } +} + +// MARK: - + +extension URLRequest { + /// Creates an instance with the specified `url`, `method`, and `headers`. + /// + /// - Parameters: + /// - url: The `URLConvertible` value. + /// - method: The `HTTPMethod`. + /// - headers: The `HTTPHeaders`, `nil` by default. + /// - Throws: Any error thrown while converting the `URLConvertible` to a `URL`. + public init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) throws { + let url = try url.asURL() + + self.init(url: url) + + httpMethod = method.rawValue + allHTTPHeaderFields = headers?.dictionary + } +} diff --git a/Example/Pods/ObjectMapper/Sources/TransformType.swift b/Example/Pods/Alamofire/Source/URLRequest+Alamofire.swift similarity index 75% rename from Example/Pods/ObjectMapper/Sources/TransformType.swift rename to Example/Pods/Alamofire/Source/URLRequest+Alamofire.swift index 5daf0d3..5041c65 100644 --- a/Example/Pods/ObjectMapper/Sources/TransformType.swift +++ b/Example/Pods/Alamofire/Source/URLRequest+Alamofire.swift @@ -1,12 +1,7 @@ // -// TransformType.swift -// ObjectMapper +// URLRequest+Alamofire.swift // -// Created by Syo Ikeda on 2/4/15. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman +// Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -25,11 +20,14 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// -public protocol TransformType { - associatedtype Object - associatedtype JSON +import Foundation - func transformFromJSON(_ value: Any?) -> Object? - func transformToJSON(_ value: Object?) -> JSON? +public extension URLRequest { + /// Returns the `httpMethod` as Alamofire's `HTTPMethod` type. + var method: HTTPMethod? { + get { return httpMethod.flatMap(HTTPMethod.init) } + set { httpMethod = newValue?.rawValue } + } } diff --git a/Example/Pods/ObjectMapper/Sources/CustomDateFormatTransform.swift b/Example/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift similarity index 71% rename from Example/Pods/ObjectMapper/Sources/CustomDateFormatTransform.swift rename to Example/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift index f7b8c54..dfde15d 100644 --- a/Example/Pods/ObjectMapper/Sources/CustomDateFormatTransform.swift +++ b/Example/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift @@ -1,12 +1,7 @@ // -// CustomDateFormatTransform.swift -// ObjectMapper +// URLSessionConfiguration+Alamofire.swift // -// Created by Dan McCracken on 3/8/15. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -25,16 +20,16 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +// import Foundation -open class CustomDateFormatTransform: DateFormatterTransform { - - public init(formatString: String) { - let formatter = DateFormatter() - formatter.locale = Locale(identifier: "en_US_POSIX") - formatter.dateFormat = formatString - - super.init(dateFormatter: formatter) +extension URLSessionConfiguration: AlamofireExtended { } +extension AlamofireExtension where ExtendedType: URLSessionConfiguration { + public static var `default`: URLSessionConfiguration { + let configuration = URLSessionConfiguration.default + configuration.headers = .default + + return configuration } } diff --git a/Example/Pods/Alamofire/Source/Validation.swift b/Example/Pods/Alamofire/Source/Validation.swift index 5640789..d7623b2 100644 --- a/Example/Pods/Alamofire/Source/Validation.swift +++ b/Example/Pods/Alamofire/Source/Validation.swift @@ -1,7 +1,7 @@ // // Validation.swift // -// Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +// Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -30,14 +30,8 @@ extension Request { fileprivate typealias ErrorReason = AFError.ResponseValidationFailureReason - /// Used to represent whether validation was successful or encountered an error resulting in a failure. - /// - /// - success: The validation was successful. - /// - failure: The validation failed encountering the provided error. - public enum ValidationResult { - case success - case failure(Error) - } + /// Used to represent whether a validation succeeded or failed. + public typealias ValidationResult = AFResult fileprivate struct MIMEType { let type: String @@ -48,12 +42,7 @@ extension Request { init?(_ string: String) { let components: [String] = { let stripped = string.trimmingCharacters(in: .whitespacesAndNewlines) - - #if swift(>=3.2) let split = stripped[..<(stripped.range(of: ";")?.lowerBound ?? stripped.endIndex)] - #else - let split = stripped.substring(to: stripped.range(of: ";")?.lowerBound ?? stripped.endIndex) - #endif return split.components(separatedBy: "/") }() @@ -78,7 +67,7 @@ extension Request { // MARK: Properties - fileprivate var acceptableStatusCodes: [Int] { return Array(200..<300) } + fileprivate var acceptableStatusCodes: Range { return 200..<300 } fileprivate var acceptableContentTypes: [String] { if let accept = request?.value(forHTTPHeaderField: "Accept") { @@ -97,7 +86,7 @@ extension Request { where S.Iterator.Element == Int { if acceptableStatusCodes.contains(response.statusCode) { - return .success + return .success(Void()) } else { let reason: ErrorReason = .unacceptableStatusCode(code: response.statusCode) return .failure(AFError.responseValidationFailed(reason: reason)) @@ -113,7 +102,7 @@ extension Request { -> ValidationResult where S.Iterator.Element == String { - guard let data = data, data.count > 0 else { return .success } + guard let data = data, data.count > 0 else { return .success(Void()) } guard let responseContentType = response.mimeType, @@ -121,7 +110,7 @@ extension Request { else { for contentType in acceptableContentTypes { if let mimeType = MIMEType(contentType), mimeType.isWildcard { - return .success + return .success(Void()) } } @@ -135,7 +124,7 @@ extension Request { for contentType in acceptableContentTypes { if let acceptableMIMEType = MIMEType(contentType), acceptableMIMEType.matches(responseMIMEType) { - return .success + return .success(Void()) } } @@ -159,30 +148,6 @@ extension DataRequest { /// request was valid. public typealias Validation = (URLRequest?, HTTPURLResponse, Data?) -> ValidationResult - /// Validates the request, using the specified closure. - /// - /// If validation fails, subsequent calls to response handlers will have an associated error. - /// - /// - parameter validation: A closure to validate the request. - /// - /// - returns: The request. - @discardableResult - public func validate(_ validation: @escaping Validation) -> Self { - let validationExecution: () -> Void = { [unowned self] in - if - let response = self.response, - self.delegate.error == nil, - case let .failure(error) = validation(self.request, response, self.delegate.data) - { - self.delegate.error = error - } - } - - validations.append(validationExecution) - - return self - } - /// Validates that the response has a status code in the specified sequence. /// /// If validation fails, subsequent calls to response handlers will have an associated error. @@ -205,9 +170,9 @@ extension DataRequest { /// /// - returns: The request. @discardableResult - public func validate(contentType acceptableContentTypes: S) -> Self where S.Iterator.Element == String { + public func validate(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String { return validate { [unowned self] _, response, data in - return self.validate(contentType: acceptableContentTypes, response: response, data: data) + return self.validate(contentType: acceptableContentTypes(), response: response, data: data) } } @@ -219,7 +184,10 @@ extension DataRequest { /// - returns: The request. @discardableResult public func validate() -> Self { - return validate(statusCode: self.acceptableStatusCodes).validate(contentType: self.acceptableContentTypes) + let contentTypes: () -> [String] = { [unowned self] in + return self.acceptableContentTypes + } + return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes()) } } @@ -231,38 +199,9 @@ extension DownloadRequest { public typealias Validation = ( _ request: URLRequest?, _ response: HTTPURLResponse, - _ temporaryURL: URL?, - _ destinationURL: URL?) + _ fileURL: URL?) -> ValidationResult - /// Validates the request, using the specified closure. - /// - /// If validation fails, subsequent calls to response handlers will have an associated error. - /// - /// - parameter validation: A closure to validate the request. - /// - /// - returns: The request. - @discardableResult - public func validate(_ validation: @escaping Validation) -> Self { - let validationExecution: () -> Void = { [unowned self] in - let request = self.request - let temporaryURL = self.downloadDelegate.temporaryURL - let destinationURL = self.downloadDelegate.destinationURL - - if - let response = self.response, - self.delegate.error == nil, - case let .failure(error) = validation(request, response, temporaryURL, destinationURL) - { - self.delegate.error = error - } - } - - validations.append(validationExecution) - - return self - } - /// Validates that the response has a status code in the specified sequence. /// /// If validation fails, subsequent calls to response handlers will have an associated error. @@ -272,7 +211,7 @@ extension DownloadRequest { /// - returns: The request. @discardableResult public func validate(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int { - return validate { [unowned self] _, response, _, _ in + return validate { [unowned self] (_, response, _) in return self.validate(statusCode: acceptableStatusCodes, response: response) } } @@ -285,17 +224,15 @@ extension DownloadRequest { /// /// - returns: The request. @discardableResult - public func validate(contentType acceptableContentTypes: S) -> Self where S.Iterator.Element == String { - return validate { [unowned self] _, response, _, _ in - let fileURL = self.downloadDelegate.fileURL - + public func validate(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String { + return validate { [unowned self] (_, response, fileURL) in guard let validFileURL = fileURL else { return .failure(AFError.responseValidationFailed(reason: .dataFileNil)) } do { let data = try Data(contentsOf: validFileURL) - return self.validate(contentType: acceptableContentTypes, response: response, data: data) + return self.validate(contentType: acceptableContentTypes(), response: response, data: data) } catch { return .failure(AFError.responseValidationFailed(reason: .dataFileReadFailed(at: validFileURL))) } @@ -310,6 +247,9 @@ extension DownloadRequest { /// - returns: The request. @discardableResult public func validate() -> Self { - return validate(statusCode: self.acceptableStatusCodes).validate(contentType: self.acceptableContentTypes) + let contentTypes = { [unowned self] in + return self.acceptableContentTypes + } + return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes()) } } diff --git a/Example/Pods/AlamofireObjectMapper/AlamofireObjectMapper/AlamofireObjectMapper.swift b/Example/Pods/AlamofireObjectMapper/AlamofireObjectMapper/AlamofireObjectMapper.swift deleted file mode 100644 index b181e84..0000000 --- a/Example/Pods/AlamofireObjectMapper/AlamofireObjectMapper/AlamofireObjectMapper.swift +++ /dev/null @@ -1,205 +0,0 @@ -// -// Request.swift -// AlamofireObjectMapper -// -// Created by Tristan Himmelman on 2015-04-30. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2015 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation -import Alamofire -import ObjectMapper - -extension DataRequest { - - enum ErrorCode: Int { - case noData = 1 - case dataSerializationFailed = 2 - } - - internal static func newError(_ code: ErrorCode, failureReason: String) -> NSError { - let errorDomain = "com.alamofireobjectmapper.error" - - let userInfo = [NSLocalizedFailureReasonErrorKey: failureReason] - let returnError = NSError(domain: errorDomain, code: code.rawValue, userInfo: userInfo) - - return returnError - } - - /// Utility function for checking for errors in response - internal static func checkResponseForError(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) -> Error? { - if let error = error { - return error - } - guard let _ = data else { - let failureReason = "Data could not be serialized. Input data was nil." - let error = newError(.noData, failureReason: failureReason) - return error - } - return nil - } - - /// Utility function for extracting JSON from response - internal static func processResponse(request: URLRequest?, response: HTTPURLResponse?, data: Data?, keyPath: String?) -> Any? { - let jsonResponseSerializer = DataRequest.jsonResponseSerializer(options: .allowFragments) - let result = jsonResponseSerializer.serializeResponse(request, response, data, nil) - - let JSON: Any? - if let keyPath = keyPath , keyPath.isEmpty == false { - JSON = (result.value as AnyObject?)?.value(forKeyPath: keyPath) - } else { - JSON = result.value - } - - return JSON - } - - /// BaseMappable Object Serializer - public static func ObjectMapperSerializer(_ keyPath: String?, mapToObject object: T? = nil, context: MapContext? = nil) -> DataResponseSerializer { - return DataResponseSerializer { request, response, data, error in - if let error = checkResponseForError(request: request, response: response, data: data, error: error){ - return .failure(error) - } - - let JSONObject = processResponse(request: request, response: response, data: data, keyPath: keyPath) - - if let object = object { - _ = Mapper(context: context, shouldIncludeNilValues: false).map(JSONObject: JSONObject, toObject: object) - return .success(object) - } else if let parsedObject = Mapper(context: context, shouldIncludeNilValues: false).map(JSONObject: JSONObject){ - return .success(parsedObject) - } - - let failureReason = "ObjectMapper failed to serialize response." - let error = newError(.dataSerializationFailed, failureReason: failureReason) - return .failure(error) - } - } - - /// ImmutableMappable Array Serializer - public static func ObjectMapperImmutableSerializer(_ keyPath: String?, context: MapContext? = nil) -> DataResponseSerializer { - return DataResponseSerializer { request, response, data, error in - if let error = checkResponseForError(request: request, response: response, data: data, error: error){ - return .failure(error) - } - - let JSONObject = processResponse(request: request, response: response, data: data, keyPath: keyPath) - - if let JSONObject = JSONObject, - let parsedObject = (try? Mapper(context: context, shouldIncludeNilValues: false).map(JSONObject: JSONObject)){ - return .success(parsedObject) - } - - let failureReason = "ObjectMapper failed to serialize response." - let error = newError(.dataSerializationFailed, failureReason: failureReason) - return .failure(error) - } - } - - /** - Adds a handler to be called once the request has finished. - - - parameter queue: The queue on which the completion handler is dispatched. - - parameter keyPath: The key path where object mapping should be performed - - parameter object: An object to perform the mapping on to - - parameter completionHandler: A closure to be executed once the request has finished and the data has been mapped by ObjectMapper. - - - returns: The request. - */ - @discardableResult - public func responseObject(queue: DispatchQueue? = nil, keyPath: String? = nil, mapToObject object: T? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse) -> Void) -> Self { - return response(queue: queue, responseSerializer: DataRequest.ObjectMapperSerializer(keyPath, mapToObject: object, context: context), completionHandler: completionHandler) - } - - @discardableResult - public func responseObject(queue: DispatchQueue? = nil, keyPath: String? = nil, mapToObject object: T? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse) -> Void) -> Self { - return response(queue: queue, responseSerializer: DataRequest.ObjectMapperImmutableSerializer(keyPath, context: context), completionHandler: completionHandler) - } - - /// BaseMappable Array Serializer - public static func ObjectMapperArraySerializer(_ keyPath: String?, context: MapContext? = nil) -> DataResponseSerializer<[T]> { - return DataResponseSerializer { request, response, data, error in - if let error = checkResponseForError(request: request, response: response, data: data, error: error){ - return .failure(error) - } - - let JSONObject = processResponse(request: request, response: response, data: data, keyPath: keyPath) - - if let parsedObject = Mapper(context: context, shouldIncludeNilValues: false).mapArray(JSONObject: JSONObject){ - return .success(parsedObject) - } - - let failureReason = "ObjectMapper failed to serialize response." - let error = newError(.dataSerializationFailed, failureReason: failureReason) - return .failure(error) - } - } - - /// ImmutableMappable Array Serializer - public static func ObjectMapperImmutableArraySerializer(_ keyPath: String?, context: MapContext? = nil) -> DataResponseSerializer<[T]> { - return DataResponseSerializer { request, response, data, error in - if let error = checkResponseForError(request: request, response: response, data: data, error: error){ - return .failure(error) - } - - if let JSONObject = processResponse(request: request, response: response, data: data, keyPath: keyPath){ - - if let parsedObject = try? Mapper(context: context, shouldIncludeNilValues: false).mapArray(JSONObject: JSONObject){ - return .success(parsedObject) - } - } - - let failureReason = "ObjectMapper failed to serialize response." - let error = newError(.dataSerializationFailed, failureReason: failureReason) - return .failure(error) - } - } - - /** - Adds a handler to be called once the request has finished. T: BaseMappable - - - parameter queue: The queue on which the completion handler is dispatched. - - parameter keyPath: The key path where object mapping should be performed - - parameter completionHandler: A closure to be executed once the request has finished and the data has been mapped by ObjectMapper. - - - returns: The request. - */ - @discardableResult - public func responseArray(queue: DispatchQueue? = nil, keyPath: String? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse<[T]>) -> Void) -> Self { - return response(queue: queue, responseSerializer: DataRequest.ObjectMapperArraySerializer(keyPath, context: context), completionHandler: completionHandler) - } - - /** - Adds a handler to be called once the request has finished. T: ImmutableMappable - - - parameter queue: The queue on which the completion handler is dispatched. - - parameter keyPath: The key path where object mapping should be performed - - parameter completionHandler: A closure to be executed once the request has finished and the data has been mapped by ObjectMapper. - - - returns: The request. - */ - @discardableResult - public func responseArray(queue: DispatchQueue? = nil, keyPath: String? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse<[T]>) -> Void) -> Self { - return response(queue: queue, responseSerializer: DataRequest.ObjectMapperImmutableArraySerializer(keyPath, context: context), completionHandler: completionHandler) - } -} diff --git a/Example/Pods/AlamofireObjectMapper/LICENSE b/Example/Pods/AlamofireObjectMapper/LICENSE deleted file mode 100644 index cee2d0c..0000000 --- a/Example/Pods/AlamofireObjectMapper/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Tristan Himmelman - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - diff --git a/Example/Pods/AlamofireObjectMapper/README.md b/Example/Pods/AlamofireObjectMapper/README.md deleted file mode 100644 index 55c3ff9..0000000 --- a/Example/Pods/AlamofireObjectMapper/README.md +++ /dev/null @@ -1,193 +0,0 @@ -AlamofireObjectMapper -============ -[![Build Status](https://travis-ci.org/tristanhimmelman/AlamofireObjectMapper.svg?branch=master)](https://travis-ci.org/tristanhimmelman/AlamofireObjectMapper) -[![CocoaPods](https://img.shields.io/cocoapods/v/AlamofireObjectMapper.svg)](https://github.com/tristanhimmelman/AlamofireObjectMapper) -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) - - -An extension to [Alamofire](https://github.com/Alamofire/Alamofire) which automatically converts JSON response data into swift objects using [ObjectMapper](https://github.com/Hearst-DD/ObjectMapper/). - -# Usage - -Given a URL which returns weather data in the following form: -``` -{ - "location": "Toronto, Canada", - "three_day_forecast": [ - { - "conditions": "Partly cloudy", - "day" : "Monday", - "temperature": 20 - }, - { - "conditions": "Showers", - "day" : "Tuesday", - "temperature": 22 - }, - { - "conditions": "Sunny", - "day" : "Wednesday", - "temperature": 28 - } - ] -} -``` - -You can use the extension as the follows: -```swift -import AlamofireObjectMapper - -let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/d8bb95982be8a11a2308e779bb9a9707ebe42ede/sample_json" -Alamofire.request(URL).responseObject { (response: DataResponse) in - - let weatherResponse = response.result.value - print(weatherResponse?.location) - - if let threeDayForecast = weatherResponse?.threeDayForecast { - for forecast in threeDayForecast { - print(forecast.day) - print(forecast.temperature) - } - } -} -``` - -The `WeatherResponse` object in the completion handler is a custom object which you define. The only requirement is that the object must conform to [ObjectMapper's](https://github.com/Hearst-DD/ObjectMapper/) `Mappable` protocol. In the above example, the `WeatherResponse` object looks like the following: - -```swift -import ObjectMapper - -class WeatherResponse: Mappable { - var location: String? - var threeDayForecast: [Forecast]? - - required init?(map: Map){ - - } - - func mapping(map: Map) { - location <- map["location"] - threeDayForecast <- map["three_day_forecast"] - } -} - -class Forecast: Mappable { - var day: String? - var temperature: Int? - var conditions: String? - - required init?(map: Map){ - - } - - func mapping(map: Map) { - day <- map["day"] - temperature <- map["temperature"] - conditions <- map["conditions"] - } -} -``` - -The extension uses Generics to allow you to create your own custom response objects. Below is the `responseObject` function definition. Just replace `T` in the completionHandler with your custom response object and the extension handles the rest: -```swift -public func responseObject(queue: DispatchQueue? = nil, keyPath: String? = nil, mapToObject object: T? = nil, context: MapContext? = nil, completionHandler: @escaping (DataResponse) -> Void) -> Self -``` -The `responseObject` function has 4 optional parameters and a required completionHandler: -- `queue`: The queue on which the completion handler is dispatched. -- `keyPath`: The key path of the JSON where object mapping should be performed. -- `mapToObject`: An object to perform the mapping on to. -- `context`: A [context object](https://github.com/Hearst-DD/ObjectMapper/#mapping-context) that is passed to the mapping function. -- `completionHandler`: A closure to be executed once the request has finished and the data has been mapped by ObjectMapper. - -### Easy Mapping of Nested Objects - -AlamofireObjectMapper supports dot notation within keys for easy mapping of nested objects. Given the following JSON String: -```json -"distance" : { - "text" : "102 ft", - "value" : 31 -} -``` -You can access the nested objects as follows: -```swift -func mapping(map: Map) { - distance <- map["distance.value"] -} -``` -[See complete documentation](https://github.com/Hearst-DD/ObjectMapper#easy-mapping-of-nested-objects) - -### KeyPath - -The `keyPath` variable is used to drill down into a JSON response and only map the data found at that `keyPath`. It supports nested values such as `data.weather` to drill down several levels in a JSON response. -```swift -let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/2ee8f34d21e8febfdefb2b3a403f18a43818d70a/sample_keypath_json" -let expectation = expectationWithDescription("\(URL)") - -Alamofire.request(URL).responseObject(keyPath: "data") { (response: DataResponse) in - expectation.fulfill() - - let weatherResponse = response.result.value - print(weatherResponse?.location) - - if let threeDayForecast = weatherResponse?.threeDayForecast { - for forecast in threeDayForecast { - print(forecast.day) - print(forecast.temperature) - } - } -} -``` - -# Array Responses -If you have an endpoint that returns data in `Array` form you can map it with the following function: -```swift -public func responseArray(queue queue: dispatch_queue_t? = nil, keyPath: String? = nil, completionHandler: DataResponse<[T]> -> Void) -> Self -``` - -For example, if your endpoint returns the following: -``` -[ - { - "conditions": "Partly cloudy", - "day" : "Monday", - "temperature": 20 - }, - { - "conditions": "Showers", - "day" : "Tuesday", - "temperature": 22 - }, - { - "conditions": "Sunny", - "day" : "Wednesday", - "temperature": 28 - } -] -``` -You can request and map it as follows: -```swift -let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/f583be1121dbc5e9b0381b3017718a70c31054f7/sample_array_json" -Alamofire.request(URL).responseArray { (response: DataResponse<[Forecast]>) in - - let forecastArray = response.result.value - - if let forecastArray = forecastArray { - for forecast in forecastArray { - print(forecast.day) - print(forecast.temperature) - } - } -} - -``` - -# Installation -AlamofireObjectMapper can be added to your project using [CocoaPods](https://cocoapods.org/) by adding the following line to your Podfile: -``` -pod 'AlamofireObjectMapper', '~> 5.0' -``` - -If you're using [Carthage](https://github.com/Carthage/Carthage) you can add a dependency on AlamofireObjectMapper by adding it to your Cartfile: -``` -github "tristanhimmelman/AlamofireObjectMapper" ~> 5.0 -``` diff --git a/Example/Pods/Local Podspecs/AlamoRecord.podspec.json b/Example/Pods/Local Podspecs/AlamoRecord.podspec.json index 1f6ab72..85dd488 100644 --- a/Example/Pods/Local Podspecs/AlamoRecord.podspec.json +++ b/Example/Pods/Local Podspecs/AlamoRecord.podspec.json @@ -1,6 +1,6 @@ { "name": "AlamoRecord", - "version": "1.4.0", + "version": "2.0.0", "summary": "An elegant Alamofire wrapper inspired by ActiveRecord.", "description": "AlamoRecord is a powerful yet simple framework that eliminates the often complex networking layer that exists between your networking framework and your application. AlamoRecord uses the power of AlamoFire, AlamofireObjectMapper and the concepts behind the ActiveRecord pattern to create a networking layer that makes interacting with your API easier than ever.", "homepage": "https://github.com/tunespeak/AlamoRecord", @@ -13,7 +13,7 @@ }, "source": { "git": "https://github.com/tunespeak/AlamoRecord.git", - "tag": "1.4.0" + "tag": "2.0.0" }, "swift_version": "5.0", "platforms": { @@ -24,8 +24,8 @@ }, "source_files": "AlamoRecord/Classes/**/*", "dependencies": { - "AlamofireObjectMapper": [ - "5.1.0" + "Alamofire": [ + "5.0.0-beta.6" ] } } diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock index ce0f09a..9b3fe89 100644 --- a/Example/Pods/Manifest.lock +++ b/Example/Pods/Manifest.lock @@ -1,16 +1,12 @@ PODS: - - Alamofire (4.8.2) - - AlamofireObjectMapper (5.1.0): - - Alamofire (~> 4.1) - - ObjectMapper (~> 3.3) - - AlamoRecord (1.4.0): - - AlamofireObjectMapper (= 5.1.0) + - Alamofire (5.0.0-beta.6) + - AlamoRecord (2.0.0): + - Alamofire (= 5.0.0-beta.6) - KeyboardSpy (1.1) - MarqueeLabel (4.0.0) - NotificationBannerSwift (2.2.0): - MarqueeLabel (~> 4.0.0) - SnapKit (~> 5.0.0) - - ObjectMapper (3.4.2) - SnapKit (5.0.0) DEPENDENCIES: @@ -22,11 +18,9 @@ DEPENDENCIES: SPEC REPOS: https://github.com/cocoapods/specs.git: - Alamofire - - AlamofireObjectMapper - KeyboardSpy - MarqueeLabel - NotificationBannerSwift - - ObjectMapper - SnapKit EXTERNAL SOURCES: @@ -34,13 +28,11 @@ EXTERNAL SOURCES: :path: "../" SPEC CHECKSUMS: - Alamofire: ae5c501addb7afdbb13687d7f2f722c78734c2d3 - AlamofireObjectMapper: 3395e698901d8b0e6f48b7d0c43bd47875325102 - AlamoRecord: f7ff85c04c4637a1d3ceb916bb079e1e2311f232 + Alamofire: cd08a4402bd12cacd0c66f23fb12fec8d6b965e4 + AlamoRecord: 92fb2db13838474750f90605d8a37c932d530db1 KeyboardSpy: 4552ddd413d3b856b3b396422fccb8e1b3008524 MarqueeLabel: b55b26e690b6ad41faedd95cbf5eae6f1d1735b4 NotificationBannerSwift: 0ebb4b35e18c0515fdfe01b5ebd90c3eb1255e3d - ObjectMapper: 0d4402610f4e468903ae64629eec4784531e5c51 SnapKit: fd22d10eb9aff484d79a8724eab922c1ddf89bcf PODFILE CHECKSUM: f5d73d86856e49073d0206d4e3f83582b8a8a64b diff --git a/Example/Pods/ObjectMapper/LICENSE b/Example/Pods/ObjectMapper/LICENSE deleted file mode 100644 index be48bc6..0000000 --- a/Example/Pods/ObjectMapper/LICENSE +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2014 Hearst - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Example/Pods/ObjectMapper/README-CN.md b/Example/Pods/ObjectMapper/README-CN.md deleted file mode 100644 index 1651759..0000000 --- a/Example/Pods/ObjectMapper/README-CN.md +++ /dev/null @@ -1,500 +0,0 @@ -# ObjectMapper-CN-Guide -> 文档由Swift老司机活动中心负责翻译,欢迎关注[@SwiftOldDriver](http://weibo.com/6062089411)。翻译有问题可以到 [ObjectMapper-CN-Guide](https://github.com/SwiftOldDriver/ObjectMapper-CN-Guide) 提 PR。 - -[ObjectMapper](https://github.com/Hearst-DD/ObjectMapper) 是一个使用 Swift 编写的用于 model 对象(类和结构体)和 JSON 之间转换的框架。 - -- [特性](#特性) -- [基础使用方法](#基础使用方法) -- [映射嵌套对象](#映射嵌套对象) -- [自定义转换规则](#自定义转换规则) -- [继承](#继承) -- [泛型对象](#泛型对象) -- [映射时的上下文对象](#映射时的上下文对象) -- [ObjectMapper + Alamofire](#objectmapper--alamofire) -- [ObjectMapper + Realm](#objectmapper--realm) -- [待完成](#待完成) -- [安装](#安装) - -# 特性: -- 把 JSON 映射成对象 -- 把对象映射 JSON -- 支持嵌套对象 (单独的成员变量、在数组或字典中都可以) -- 在转换过程支持自定义规则 -- 支持结构体( Struct ) -- [Immutable support](#immutablemappable-protocol-beta) (目前还在 beta ) - -# 基础使用方法 -为了支持映射,类或者结构体只需要实现```Mappable```协议。这个协议包含以下方法: -```swift -init?(map: Map) -mutating func mapping(map: Map) -``` -ObjectMapper使用自定义的```<-``` 运算符来声明成员变量和 JSON 的映射关系。 -```swift -class User: Mappable { - var username: String? - var age: Int? - var weight: Double! - var array: [AnyObject]? - var dictionary: [String : AnyObject] = [:] - var bestFriend: User? // 嵌套的 User 对象 - var friends: [User]? // Users 的数组 - var birthday: NSDate? - - required init?(map: Map) { - - } - - // Mappable - func mapping(map: Map) { - username <- map["username"] - age <- map["age"] - weight <- map["weight"] - array <- map["arr"] - dictionary <- map["dict"] - bestFriend <- map["best_friend"] - friends <- map["friends"] - birthday <- (map["birthday"], DateTransform()) - } -} - -struct Temperature: Mappable { - var celsius: Double? - var fahrenheit: Double? - - init?(map: Map) { - - } - - mutating func mapping(map: Map) { - celsius <- map["celsius"] - fahrenheit <- map["fahrenheit"] - } -} -``` - -一旦你的对象实现了 `Mappable`, ObjectMapper就可以让你轻松的实现和 JSON 之间的转换。 - -把 JSON 字符串转成 model 对象: - -```swift -let user = User(JSONString: JSONString) -``` - -把一个 model 转成 JSON 字符串: - -```swift -let JSONString = user.toJSONString(prettyPrint: true) -``` - -也可以使用`Mapper.swift`类来完成转换(这个类还额外提供了一些函数来处理一些特殊的情况: - -```swift -// 把 JSON 字符串转成 Model -let user = Mapper().map(JSONString: JSONString) -// 根据 Model 生成 JSON 字符串 -let JSONString = Mapper().toJSONString(user, prettyPrint: true) -``` - -ObjectMapper支持以下的类型映射到对象中: - -- `Int` -- `Bool` -- `Double` -- `Float` -- `String` -- `RawRepresentable` (枚举) -- `Array` -- `Dictionary` -- `Object` -- `Array` -- `Array>` -- `Set` -- `Dictionary` -- `Dictionary>` -- 以上所有的 Optional 类型 -- 以上所有的隐式强制解包类型(Implicitly Unwrapped Optional) - -## `Mappable` 协议 - -#### `mutating func mapping(map: Map)` -所有的映射最后都会调用到这个函数。当解析 JSON 时,这个函数会在对象创建成功后被执行。当生成 JSON 时就只有这个函数会被对象调用。 - -#### `init?(map: Map)` -这个可失败的初始化函数是 ObjectMapper 创建对象的时候使用的。开发者可以通过这个函数在映射前校验 JSON 。如果在这个方法里返回 nil 就不会执行 `mapping` 函数。可以通过传入的保存着 JSON 的 `Map` 对象进行校验: - -```swift -required init?(map: Map){ - // 检查 JSON 里是否有一定要有的 "name" 属性 - if map.JSONDictionary["name"] == nil { - return nil - } -} -``` - -## `StaticMappable` 协议 -`StaticMappable` 是 `Mappable` 之外的另一种选择。 这个协议可以让开发者通过一个静态函数初始化对象而不是通过 `init?(map: Map)`。 - -注意: `StaticMappable` 和 `Mappable` 都继承了 `BaseMappable` 协议。 `BaseMappable` 协议声明了 `mapping(map: Map)` 函数。 - -#### `static func objectForMapping(map: Map) -> BaseMappable?` -ObjectMapper 使用这个函数获取对象后进行映射。开发者需要在这个函数里返回一个实现 `BaseMappable` 对象的实例。这个函数也可以用于: - -- 在对象进行映射前校验 JSON -- 提供一个缓存过的对象用于映射 -- 返回另外一种类型的对象(当然是必须实现了 BaseMappable)用于映射。比如你可能通过检查 JSON 推断出用于映射的对象 ([看这个例子](https://github.com/Hearst-DD/ObjectMapper/blob/master/ObjectMapperTests/ClassClusterTests.swift#L62))。 - -如果你需要在 extension 里实现 ObjectMapper,你需要选择这个协议而不是 `Mappable` 。 - -## `ImmutableMappable` Protocol - -使用 `ImmutableMappable` 可以映射不可变的属性。下面的表格展示了 `ImmutableMappable` 和 `Mappable` 的不同: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ImmutableMappableMappable
Properties
-
-let id: Int
-let name: String?
-
-
-
-var id: Int!
-var name: String?
-
-
JSON -> Model
-
-init(map: Map) throws {
-  id   = try map.value("id")
-  name = try? map.value("name")
-}
-
-
-
-mutating func mapping(map: Map) {
-  id   <- map["id"]
-  name <- map["name"]
-}
-
-
Model -> JSON
-
-mutating func mapping(map: Map) {
-  id   >>> map["id"]
-  name >>> map["name"]
-}
-
-
-
-mutating func mapping(map: Map) {
-  id   <- map["id"]
-  name <- map["name"]
-}
-
-
Initializing
-
-try User(JSONString: JSONString)
-
-
-
-User(JSONString: JSONString)
-
-
- -#### `init(map: Map) throws` - -这个可能抛出异常的初始化函数用于在提供的 `Map` 里映射不可变属性。每个不可变的初始化属性都要在这个初始化函数里初始化。 - -当发生下列情况时初始化函数会抛出一个错误: - -- `Map` 根据提供的键名获取不到对应值 -- `Map` 使用 `Transform` 后没有得到值 - -`ImmutableMappable` 使用 `Map.value(_:using:)` 方法从 `Map` 中获取值。因为可能抛出异常,这个方法在使用时需要使用 `try` 关键字。 `Optional` 的属性可以简单的用 `try?` 处理。 - -```swift -init(map: Map) throws { - name = try map.value("name") // throws an error when it fails - createdAt = try map.value("createdAt", using: DateTransform()) // throws an error when it fails - updatedAt = try? map.value("updatedAt", using: DateTransform()) // optional - posts = (try? map.value("posts")) ?? [] // optional + default value -} -``` - -#### `mutating func mapping(map: Map)` - -这个方法是在 Model 转回 JSON 时调用的。因为不可变的属性不能被 `<-` 映射,所以映射回来时需要使用 `>>>` 。 - -```swift -mutating func mapping(map: Map) { - name >>> map["name"] - createdAt >>> (map["createdAt"], DateTransform()) - updatedAt >>> (map["updatedAt"], DateTransform()) - posts >>> map["posts"] -} -``` -# 轻松映射嵌套对象 - -ObjectMapper 支持使用点语法来轻松实现嵌套对象的映射。比如有如下的 JSON 字符串: - -```json -"distance" : { - "text" : "102 ft", - "value" : 31 -} -``` -你可以通过这种写法直接访问到嵌套对象: - -```swift -func mapping(map: Map) { - distance <- map["distance.value"] -} -``` -嵌套的键名也支持访问数组中的值。如果有一个返回的 JSON 是一个包含 distance 的数组,可以通过这种写法访问: - -``` -distance <- map["distances.0.value"] -``` -如果你的键名刚好含有 `.` 符号,你需要特别声明关闭上面提到的获取嵌套对象功能: - -```swift -func mapping(map: Map) { - identifier <- map["app.identifier", nested: false] -} -``` -如果刚好有嵌套的对象的键名还有 `.` ,可以在中间加入一个自定义的分割符([#629](https://github.com/Hearst-DD/ObjectMapper/pull/629)): -```swift -func mapping(map: Map) { - appName <- map["com.myapp.info->com.myapp.name", delimiter: "->"] -} -``` -这种情况的 JSON 是这样的: - -```json -"com.myapp.info" : { - "com.myapp.name" : "SwiftOldDriver" -} -``` - -# 自定义转换规则 -ObjectMapper 也支持在映射时自定义转换规则。如果要使用自定义转换,创建一个 tuple(元祖)包含 ```map["field_name"]``` 和你要使用的变换放在 ```<-``` 的右边: - -```swift -birthday <- (map["birthday"], DateTransform()) -``` -当解析 JSON 时上面的转换会把 JSON 里面的 Int 值转成一个 NSDate ,如果是对象转为 JSON 时,则会把 NSDate 对象转成 Int 值。 - -只要实现```TransformType``` 协议就可以轻松的创建自定义的转换规则: - -```swift -public protocol TransformType { - associatedtype Object - associatedtype JSON - - func transformFromJSON(_ value: Any?) -> Object? - func transformToJSON(_ value: Object?) -> JSON? -} -``` - -### TransformOf -大多数情况下你都可以使用框架提供的转换类 ```TransformOf``` 来快速的实现一个期望的转换。 ```TransformOf``` 的初始化需要两个类型和两个闭包。两个类型声明了转换的目标类型和源类型,闭包则实现具体转换逻辑。 - -举个例子,如果你想要把一个 JSON 字符串转成 Int ,你可以像这样使用 ```TransformOf``` : - -```swift -let transform = TransformOf(fromJSON: { (value: String?) -> Int? in - // 把值从 String? 转成 Int? - return Int(value!) -}, toJSON: { (value: Int?) -> String? in - // 把值从 Int? 转成 String? - if let value = value { - return String(value) - } - return nil -}) - -id <- (map["id"], transform) -``` -这是一种更省略的写法: - -```swift -id <- (map["id"], TransformOf(fromJSON: { Int($0!) }, toJSON: { $0.map { String($0) } })) -``` -# 继承 - -实现了 ```Mappable``` 协议的类可以容易的被继承。当继承一个 mappable 的类时,使用这样的结构: - -```swift -class Base: Mappable { - var base: String? - - required init?(map: Map) { - - } - - func mapping(map: Map) { - base <- map["base"] - } -} - -class Subclass: Base { - var sub: String? - - required init?(map: Map) { - super.init(map) - } - - override func mapping(map: Map) { - super.mapping(map) - - sub <- map["sub"] - } -} -``` - -注意确认子类中的实现调用了父类中正确的初始化器和映射函数。 - -# 泛型对象 - -ObjectMapper 可以处理泛型只要这个泛型也实现了`Mappable`协议。看这个例子: - -```swift -class Result: Mappable { - var result: T? - - required init?(map: Map){ - - } - - func mapping(map: Map) { - result <- map["result"] - } -} - -let result = Mapper>().map(JSON) -``` -# 映射时的上下文对象 - -`Map` 是在映射时传入的对象,带有一个 optional `MapContext` 对象,开发者可以通过使用这个对象在映射时传入一些信息。 - -为了使用这个特性,需要先创建一个对象实现了 `MapContext` 协议(这个协议是空的),然后在初始化时传入 `Mapper` 中。 - -```swift -struct Context: MapContext { - var importantMappingInfo = "映射时需要知道的额外信息" -} - -class User: Mappable { - var name: String? - - required init?(map: Map){ - - } - - func mapping(map: Map){ - if let context = map.context as? Context { - // 获取到额外的信息 - } - } -} - -let context = Context() -let user = Mapper(context: context).map(JSONString) -``` - -# ObjectMapper + Alamofire - -如果网络层你使用的是 [Alamofire](https://github.com/Alamofire/Alamofire) ,并且你希望把返回的结果转换成 Swift 对象,你可以使用 [AlamofireObjectMapper](https://github.com/tristanhimmelman/AlamofireObjectMapper) 。这是一个使用 ObjectMapper 实现的把返回的 JSON 自动转成 Swift 对象的 Alamofire 的扩展。 - - -# ObjectMapper + Realm - -ObjectMapper 可以和 Realm 一起配合使用。使用下面的声明结构就可以使用 ObjectMapper 生成 Realm 对象: - -```swift -class Model: Object, Mappable { - dynamic var name = "" - - required convenience init?(map: Map) { - self.init() - } - - func mapping(map: Map) { - name <- map["name"] - } -} -``` - -如果你想要序列化相关联的 RealmObject,你可以使用 [ObjectMapper+Realm](https://github.com/jakenberg/ObjectMapper-Realm)。这是一个简单的 Realm 扩展,用于把任意的 JSON 序列化成 Realm 的类(ealm's List class。) - -注意:使用 ObjectMappers 的 `toJSON` 函数来生成 JSON 字符串只在 Realm 的写事务中有效(write transaction)。这是因为 ObjectMapper 在解析和生成时在映射函数( `<-` )中使用 `inout` 作为标记( flag )。Realm 会检测到标记并且强制要求 `toJSON` 函数只能在一个写的事务中调用,即使这个对象并没有被修改。 - -# 待完成 -- 改善错误的处理。可能使用 `throws` 来处理。 -- 相关类的文档完善 - -# 安装 -### Cocoapods -如果你的项目使用 [CocoaPods 0.36 及以上](http://blog.cocoapods.org/Pod-Authors-Guide-to-CocoaPods-Frameworks/) 的版本,你可以把下面内容添加到在 `Podfile` 中,将 ObjectMapper 添加到你的项目中: - -```ruby -pod 'ObjectMapper', '~> 2.2' -``` - -### Carthage -如果你的项目使用 [Carthage](https://github.com/Carthage/Carthage) ,你可以把下面的内容添加到 `Cartfile` 中,将 ObjectMapper 的依赖到你的项目中: - -``` -github "Hearst-DD/ObjectMapper" ~> 2.2 -``` - -### Swift Package Manager -如果你的项目使用 [Swift Package Manager](https://swift.org/package-manager/) ,那么你可以把下面内容添加到 `Package.swift` 中的 `dependencies` 数组中,将 ObjectMapper 的依赖到你的项目中: - -```swift -.Package(url: "https://github.com/Hearst-DD/ObjectMapper.git", majorVersion: 2, minor: 2), -``` - - -### Submodule -此外,ObjectMapper 也可以作为一个 submodule 添加到项目中: - -1. 打开终端,使用 `cd` 命令进入项目文件的根目录下,然后在终端中输入 `git submodule add https://github.com/Hearst-DD/ObjectMapper.git` ,把 ObjectMapper 作为项目的一个 [submodule](http://git-scm.com/docs/git-submodule) 添加进来。 -2. 打开 `ObjectMapper` 文件,并将 `ObjectMapper.xcodeproj` 拖进你 app 项目的文件导航中。 -3. 在 Xcode 中,文件导航中点击蓝色项目图标进入到 target 配置界面,在侧边栏的 "TARGETS" 下选择主工程对应的target。 -4. 确保 `ObjectMapper.framework` 的部署版本( deployment target )和主工程的部署版本保持一致。 -5. 在配置界面的顶部选项栏中,打开 "Build Phases" 面板。 -6. 展开 "Target Dependencies" 组,并添加 `ObjectMapper.framework` 。 -7. 点击面板左上角的 `+` 按钮,选择 "New Copy Files Phase"。将这个阶段重命名为 "Copy Frameworks",设置 "Destination" 为 "Frameworks",最后添加 `ObjectMapper.framework` 。 - - diff --git a/Example/Pods/ObjectMapper/Sources/CodableTransform.swift b/Example/Pods/ObjectMapper/Sources/CodableTransform.swift deleted file mode 100644 index 117cf11..0000000 --- a/Example/Pods/ObjectMapper/Sources/CodableTransform.swift +++ /dev/null @@ -1,65 +0,0 @@ -// -// CodableTransform.swift -// ObjectMapper -// -// Created by Jari Kalinainen on 10/10/2018. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -/// Transforms JSON dictionary to Codable type T and back -open class CodableTransform: TransformType { - - public typealias Object = T - public typealias JSON = Any - - public init() {} - - open func transformFromJSON(_ value: Any?) -> Object? { - guard let dict = value as? [String: Any], let data = try? JSONSerialization.data(withJSONObject: dict, options: []) else { - return nil - } - do { - let decoder = JSONDecoder() - let item = try decoder.decode(T.self, from: data) - return item - } catch { - return nil - } - } - - open func transformToJSON(_ value: T?) -> JSON? { - guard let item = value else { - return nil - } - do { - let encoder = JSONEncoder() - let data = try encoder.encode(item) - let dictionary = try JSONSerialization.jsonObject(with: data, options: .allowFragments) - return dictionary - } catch { - return nil - } - } -} diff --git a/Example/Pods/ObjectMapper/Sources/DateFormatterTransform.swift b/Example/Pods/ObjectMapper/Sources/DateFormatterTransform.swift deleted file mode 100644 index 9828e2d..0000000 --- a/Example/Pods/ObjectMapper/Sources/DateFormatterTransform.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// DateFormatterTransform.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2015-03-09. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -open class DateFormatterTransform: TransformType { - public typealias Object = Date - public typealias JSON = String - - public let dateFormatter: DateFormatter - - public init(dateFormatter: DateFormatter) { - self.dateFormatter = dateFormatter - } - - open func transformFromJSON(_ value: Any?) -> Date? { - if let dateString = value as? String { - return dateFormatter.date(from: dateString) - } - return nil - } - - open func transformToJSON(_ value: Date?) -> String? { - if let date = value { - return dateFormatter.string(from: date) - } - return nil - } -} diff --git a/Example/Pods/ObjectMapper/Sources/DateTransform.swift b/Example/Pods/ObjectMapper/Sources/DateTransform.swift deleted file mode 100644 index f55c87f..0000000 --- a/Example/Pods/ObjectMapper/Sources/DateTransform.swift +++ /dev/null @@ -1,75 +0,0 @@ -// -// DateTransform.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2014-10-13. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -open class DateTransform: TransformType { - public typealias Object = Date - public typealias JSON = Double - - public enum Unit: TimeInterval { - case seconds = 1 - case milliseconds = 1_000 - - func addScale(to interval: TimeInterval) -> TimeInterval { - return interval * rawValue - } - - func removeScale(from interval: TimeInterval) -> TimeInterval { - return interval / rawValue - } - } - - private let unit: Unit - - public init(unit: Unit = .seconds) { - self.unit = unit - } - - open func transformFromJSON(_ value: Any?) -> Date? { - var timeInterval: TimeInterval? - if let timeInt = value as? Double { - timeInterval = TimeInterval(timeInt) - } - - if let timeStr = value as? String { - timeInterval = TimeInterval(atof(timeStr)) - } - - return timeInterval.flatMap { - return Date(timeIntervalSince1970: unit.removeScale(from: $0)) - } - } - - open func transformToJSON(_ value: Date?) -> Double? { - if let date = value { - return Double(unit.addScale(to: date.timeIntervalSince1970)) - } - return nil - } -} diff --git a/Example/Pods/ObjectMapper/Sources/DictionaryTransform.swift b/Example/Pods/ObjectMapper/Sources/DictionaryTransform.swift deleted file mode 100644 index 35a1e6f..0000000 --- a/Example/Pods/ObjectMapper/Sources/DictionaryTransform.swift +++ /dev/null @@ -1,76 +0,0 @@ -// -// DictionaryTransform.swift -// ObjectMapper -// -// Created by Milen Halachev on 7/20/16. -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -///Transforms [String: AnyObject] <-> [Key: Value] where Key is RawRepresentable as String, Value is Mappable -public struct DictionaryTransform: TransformType where Key: Hashable, Key: RawRepresentable, Key.RawValue == String, Value: Mappable { - - public init() { - - } - - public func transformFromJSON(_ value: Any?) -> [Key: Value]? { - - guard let json = value as? [String: Any] else { - - return nil - } - - let result = json.reduce([:]) { (result, element) -> [Key: Value] in - - guard - let key = Key(rawValue: element.0), - let valueJSON = element.1 as? [String: Any], - let value = Value(JSON: valueJSON) - else { - - return result - } - - var result = result - result[key] = value - return result - } - - return result - } - - public func transformToJSON(_ value: [Key: Value]?) -> Any? { - - let result = value?.reduce([:]) { (result, element) -> [String: Any] in - - let key = element.0.rawValue - let value = element.1.toJSON() - - var result = result - result[key] = value - return result - } - - return result - } -} diff --git a/Example/Pods/ObjectMapper/Sources/EnumOperators.swift b/Example/Pods/ObjectMapper/Sources/EnumOperators.swift deleted file mode 100644 index 3693a1d..0000000 --- a/Example/Pods/ObjectMapper/Sources/EnumOperators.swift +++ /dev/null @@ -1,120 +0,0 @@ -// -// EnumOperators.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2016-09-26. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - - -// MARK:- Raw Representable types - -/// Object of Raw Representable type -public func <- (left: inout T, right: Map) { - left <- (right, EnumTransform()) -} - -public func >>> (left: T, right: Map) { - left >>> (right, EnumTransform()) -} - - -/// Optional Object of Raw Representable type -public func <- (left: inout T?, right: Map) { - left <- (right, EnumTransform()) -} - -public func >>> (left: T?, right: Map) { - left >>> (right, EnumTransform()) -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly Unwrapped Optional Object of Raw Representable type -public func <- (left: inout T!, right: Map) { - left <- (right, EnumTransform()) -} -#endif - -// MARK:- Arrays of Raw Representable type - -/// Array of Raw Representable object -public func <- (left: inout [T], right: Map) { - left <- (right, EnumTransform()) -} - -public func >>> (left: [T], right: Map) { - left >>> (right, EnumTransform()) -} - - -/// Array of Raw Representable object -public func <- (left: inout [T]?, right: Map) { - left <- (right, EnumTransform()) -} - -public func >>> (left: [T]?, right: Map) { - left >>> (right, EnumTransform()) -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Array of Raw Representable object -public func <- (left: inout [T]!, right: Map) { - left <- (right, EnumTransform()) -} -#endif - -// MARK:- Dictionaries of Raw Representable type - -/// Dictionary of Raw Representable object -public func <- (left: inout [String: T], right: Map) { - left <- (right, EnumTransform()) -} - -public func >>> (left: [String: T], right: Map) { - left >>> (right, EnumTransform()) -} - - -/// Dictionary of Raw Representable object -public func <- (left: inout [String: T]?, right: Map) { - left <- (right, EnumTransform()) -} - -public func >>> (left: [String: T]?, right: Map) { - left >>> (right, EnumTransform()) -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Dictionary of Raw Representable object -public func <- (left: inout [String: T]!, right: Map) { - left <- (right, EnumTransform()) -} -#endif diff --git a/Example/Pods/ObjectMapper/Sources/FromJSON.swift b/Example/Pods/ObjectMapper/Sources/FromJSON.swift deleted file mode 100755 index 78268de..0000000 --- a/Example/Pods/ObjectMapper/Sources/FromJSON.swift +++ /dev/null @@ -1,202 +0,0 @@ -// -// FromJSON.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2014-10-09. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2016 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -internal final class FromJSON { - - /// Basic type - class func basicType(_ field: inout FieldType, object: FieldType?) { - if let value = object { - field = value - } - } - - /// optional basic type - class func optionalBasicType(_ field: inout FieldType?, object: FieldType?) { - field = object - } - - // Code targeting the Swift 4.1 compiler and below. - #if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) - /// Implicitly unwrapped optional basic type - class func optionalBasicType(_ field: inout FieldType!, object: FieldType?) { - field = object - } - #endif - - /// Mappable object - class func object(_ field: inout N, map: Map) { - if map.toObject { - field = Mapper(context: map.context).map(JSONObject: map.currentValue, toObject: field) - } else if let value: N = Mapper(context: map.context).map(JSONObject: map.currentValue) { - field = value - } - } - - /// Optional Mappable Object - - class func optionalObject(_ field: inout N?, map: Map) { - if let f = field , map.toObject && map.currentValue != nil { - field = Mapper(context: map.context).map(JSONObject: map.currentValue, toObject: f) - } else { - field = Mapper(context: map.context).map(JSONObject: map.currentValue) - } - } - - // Code targeting the Swift 4.1 compiler and below. - #if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) - /// Implicitly unwrapped Optional Mappable Object - class func optionalObject(_ field: inout N!, map: Map) { - if let f = field , map.toObject && map.currentValue != nil { - field = Mapper(context: map.context).map(JSONObject: map.currentValue, toObject: f) - } else { - field = Mapper(context: map.context).map(JSONObject: map.currentValue) - } - } - #endif - - /// mappable object array - class func objectArray(_ field: inout Array, map: Map) { - if let objects = Mapper(context: map.context).mapArray(JSONObject: map.currentValue) { - field = objects - } - } - - /// optional mappable object array - - class func optionalObjectArray(_ field: inout Array?, map: Map) { - if let objects: Array = Mapper(context: map.context).mapArray(JSONObject: map.currentValue) { - field = objects - } else { - field = nil - } - } - - // Code targeting the Swift 4.1 compiler and below. - #if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) - /// Implicitly unwrapped optional mappable object array - class func optionalObjectArray(_ field: inout Array!, map: Map) { - if let objects: Array = Mapper(context: map.context).mapArray(JSONObject: map.currentValue) { - field = objects - } else { - field = nil - } - } - #endif - - /// mappable object array - class func twoDimensionalObjectArray(_ field: inout Array>, map: Map) { - if let objects = Mapper(context: map.context).mapArrayOfArrays(JSONObject: map.currentValue) { - field = objects - } - } - - /// optional mappable 2 dimentional object array - class func optionalTwoDimensionalObjectArray(_ field: inout Array>?, map: Map) { - field = Mapper(context: map.context).mapArrayOfArrays(JSONObject: map.currentValue) - } - - // Code targeting the Swift 4.1 compiler and below. - #if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) - /// Implicitly unwrapped optional 2 dimentional mappable object array - class func optionalTwoDimensionalObjectArray(_ field: inout Array>!, map: Map) { - field = Mapper(context: map.context).mapArrayOfArrays(JSONObject: map.currentValue) - } - #endif - - /// Dctionary containing Mappable objects - class func objectDictionary(_ field: inout Dictionary, map: Map) { - if map.toObject { - field = Mapper(context: map.context).mapDictionary(JSONObject: map.currentValue, toDictionary: field) - } else { - if let objects = Mapper(context: map.context).mapDictionary(JSONObject: map.currentValue) { - field = objects - } - } - } - - /// Optional dictionary containing Mappable objects - class func optionalObjectDictionary(_ field: inout Dictionary?, map: Map) { - if let f = field , map.toObject && map.currentValue != nil { - field = Mapper(context: map.context).mapDictionary(JSONObject: map.currentValue, toDictionary: f) - } else { - field = Mapper(context: map.context).mapDictionary(JSONObject: map.currentValue) - } - } - - // Code targeting the Swift 4.1 compiler and below. - #if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) - /// Implicitly unwrapped Dictionary containing Mappable objects - class func optionalObjectDictionary(_ field: inout Dictionary!, map: Map) { - if let f = field , map.toObject && map.currentValue != nil { - field = Mapper(context: map.context).mapDictionary(JSONObject: map.currentValue, toDictionary: f) - } else { - field = Mapper(context: map.context).mapDictionary(JSONObject: map.currentValue) - } - } - #endif - - /// Dictionary containing Array of Mappable objects - class func objectDictionaryOfArrays(_ field: inout Dictionary, map: Map) { - if let objects = Mapper(context: map.context).mapDictionaryOfArrays(JSONObject: map.currentValue) { - field = objects - } - } - - /// Optional Dictionary containing Array of Mappable objects - class func optionalObjectDictionaryOfArrays(_ field: inout Dictionary?, map: Map) { - field = Mapper(context: map.context).mapDictionaryOfArrays(JSONObject: map.currentValue) - } - - // Code targeting the Swift 4.1 compiler and below. - #if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) - /// Implicitly unwrapped Dictionary containing Array of Mappable objects - class func optionalObjectDictionaryOfArrays(_ field: inout Dictionary!, map: Map) { - field = Mapper(context: map.context).mapDictionaryOfArrays(JSONObject: map.currentValue) - } - #endif - - /// mappable object Set - class func objectSet(_ field: inout Set, map: Map) { - if let objects = Mapper(context: map.context).mapSet(JSONObject: map.currentValue) { - field = objects - } - } - - /// optional mappable object array - class func optionalObjectSet(_ field: inout Set?, map: Map) { - field = Mapper(context: map.context).mapSet(JSONObject: map.currentValue) - } - - // Code targeting the Swift 4.1 compiler and below. - #if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) - /// Implicitly unwrapped optional mappable object array - class func optionalObjectSet(_ field: inout Set!, map: Map) { - field = Mapper(context: map.context).mapSet(JSONObject: map.currentValue) - } - #endif -} diff --git a/Example/Pods/ObjectMapper/Sources/HexColorTransform.swift b/Example/Pods/ObjectMapper/Sources/HexColorTransform.swift deleted file mode 100644 index 1f02289..0000000 --- a/Example/Pods/ObjectMapper/Sources/HexColorTransform.swift +++ /dev/null @@ -1,144 +0,0 @@ -// -// HexColorTransform.swift -// ObjectMapper -// -// Created by Vitaliy Kuzmenko on 10/10/16. -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#if os(iOS) || os(tvOS) || os(watchOS) -import UIKit -#elseif os(macOS) -import Cocoa -#endif - -#if os(iOS) || os(tvOS) || os(watchOS) || os(macOS) -open class HexColorTransform: TransformType { - - #if os(iOS) || os(tvOS) || os(watchOS) - public typealias Object = UIColor - #else - public typealias Object = NSColor - #endif - - public typealias JSON = String - - var prefix: Bool = false - - var alpha: Bool = false - - public init(prefixToJSON: Bool = false, alphaToJSON: Bool = false) { - alpha = alphaToJSON - prefix = prefixToJSON - } - - open func transformFromJSON(_ value: Any?) -> Object? { - if let rgba = value as? String { - if rgba.hasPrefix("#") { - let index = rgba.index(rgba.startIndex, offsetBy: 1) - let hex = String(rgba[index...]) - return getColor(hex: hex) - } else { - return getColor(hex: rgba) - } - } - return nil - } - - open func transformToJSON(_ value: Object?) -> JSON? { - if let value = value { - return hexString(color: value) - } - return nil - } - - fileprivate func hexString(color: Object) -> String { - let comps = color.cgColor.components! - let compsCount = color.cgColor.numberOfComponents - let r: Int - let g: Int - var b: Int - let a = Int(comps[compsCount - 1] * 255) - if compsCount == 4 { // RGBA - r = Int(comps[0] * 255) - g = Int(comps[1] * 255) - b = Int(comps[2] * 255) - } else { // Grayscale - r = Int(comps[0] * 255) - g = Int(comps[0] * 255) - b = Int(comps[0] * 255) - } - var hexString: String = "" - if prefix { - hexString = "#" - } - hexString += String(format: "%02X%02X%02X", r, g, b) - - if alpha { - hexString += String(format: "%02X", a) - } - return hexString - } - - fileprivate func getColor(hex: String) -> Object? { - var red: CGFloat = 0.0 - var green: CGFloat = 0.0 - var blue: CGFloat = 0.0 - var alpha: CGFloat = 1.0 - - let scanner = Scanner(string: hex) - var hexValue: CUnsignedLongLong = 0 - if scanner.scanHexInt64(&hexValue) { - switch (hex.count) { - case 3: - red = CGFloat((hexValue & 0xF00) >> 8) / 15.0 - green = CGFloat((hexValue & 0x0F0) >> 4) / 15.0 - blue = CGFloat(hexValue & 0x00F) / 15.0 - case 4: - red = CGFloat((hexValue & 0xF000) >> 12) / 15.0 - green = CGFloat((hexValue & 0x0F00) >> 8) / 15.0 - blue = CGFloat((hexValue & 0x00F0) >> 4) / 15.0 - alpha = CGFloat(hexValue & 0x000F) / 15.0 - case 6: - red = CGFloat((hexValue & 0xFF0000) >> 16) / 255.0 - green = CGFloat((hexValue & 0x00FF00) >> 8) / 255.0 - blue = CGFloat(hexValue & 0x0000FF) / 255.0 - case 8: - red = CGFloat((hexValue & 0xFF000000) >> 24) / 255.0 - green = CGFloat((hexValue & 0x00FF0000) >> 16) / 255.0 - blue = CGFloat((hexValue & 0x0000FF00) >> 8) / 255.0 - alpha = CGFloat(hexValue & 0x000000FF) / 255.0 - default: - // Invalid RGB string, number of characters after '#' should be either 3, 4, 6 or 8 - return nil - } - } else { - // "Scan hex error - return nil - } - #if os(iOS) || os(tvOS) || os(watchOS) - return UIColor(red: red, green: green, blue: blue, alpha: alpha) - #else - return NSColor(red: red, green: green, blue: blue, alpha: alpha) - #endif - } -} -#endif diff --git a/Example/Pods/ObjectMapper/Sources/ISO8601DateTransform.swift b/Example/Pods/ObjectMapper/Sources/ISO8601DateTransform.swift deleted file mode 100644 index 1ea3bce..0000000 --- a/Example/Pods/ObjectMapper/Sources/ISO8601DateTransform.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// ISO8601DateTransform.swift -// ObjectMapper -// -// Created by Jean-Pierre Mouilleseaux on 21 Nov 2014. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -public extension DateFormatter { - public convenience init(withFormat format : String, locale : String) { - self.init() - self.locale = Locale(identifier: locale) - dateFormat = format - } -} - -open class ISO8601DateTransform: DateFormatterTransform { - - static let reusableISODateFormatter = DateFormatter(withFormat: "yyyy-MM-dd'T'HH:mm:ssZZZZZ", locale: "en_US_POSIX") - - public init() { - super.init(dateFormatter: ISO8601DateTransform.reusableISODateFormatter) - } -} - diff --git a/Example/Pods/ObjectMapper/Sources/ImmutableMappable.swift b/Example/Pods/ObjectMapper/Sources/ImmutableMappable.swift deleted file mode 100644 index 6e17ab2..0000000 --- a/Example/Pods/ObjectMapper/Sources/ImmutableMappable.swift +++ /dev/null @@ -1,321 +0,0 @@ -// -// ImmutableMappble.swift -// ObjectMapper -// -// Created by Suyeol Jeon on 23/09/2016. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -public protocol ImmutableMappable: BaseMappable { - init(map: Map) throws -} - -public extension ImmutableMappable { - - /// Implement this method to support object -> JSON transform. - public func mapping(map: Map) {} - - /// Initializes object from a JSON String - public init(JSONString: String, context: MapContext? = nil) throws { - self = try Mapper(context: context).map(JSONString: JSONString) - } - - /// Initializes object from a JSON Dictionary - public init(JSON: [String: Any], context: MapContext? = nil) throws { - self = try Mapper(context: context).map(JSON: JSON) - } - - /// Initializes object from a JSONObject - public init(JSONObject: Any, context: MapContext? = nil) throws { - self = try Mapper(context: context).map(JSONObject: JSONObject) - } - -} - -public extension Map { - - fileprivate func currentValue(for key: String, nested: Bool? = nil, delimiter: String = ".") -> Any? { - let isNested = nested ?? key.contains(delimiter) - return self[key, nested: isNested, delimiter: delimiter].currentValue - } - - // MARK: Basic - - /// Returns a value or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> T { - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let value = currentValue as? T else { - throw MapError(key: key, currentValue: currentValue, reason: "Cannot cast to '\(T.self)'", file: file, function: function, line: line) - } - return value - } - - /// Returns a transformed value or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", using transform: Transform, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> Transform.Object { - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let value = transform.transformFromJSON(currentValue) else { - throw MapError(key: key, currentValue: currentValue, reason: "Cannot transform to '\(Transform.Object.self)' using \(transform)", file: file, function: function, line: line) - } - return value - } - - /// Returns a RawRepresentable type or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> T { - return try self.value(key, nested: nested, delimiter: delimiter, using: EnumTransform(), file: file, function: function, line: line) - } - - /// Returns a `[RawRepresentable]` type or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [T] { - return try self.value(key, nested: nested, delimiter: delimiter, using: EnumTransform(), file: file, function: function, line: line) - } - - // MARK: BaseMappable - - /// Returns a `BaseMappable` object or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> T { - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let JSONObject = currentValue else { - throw MapError(key: key, currentValue: currentValue, reason: "Found unexpected nil value", file: file, function: function, line: line) - } - return try Mapper(context: context).mapOrFail(JSONObject: JSONObject) - } - - // MARK: [BaseMappable] - - /// Returns a `[BaseMappable]` or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [T] { - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let jsonArray = currentValue as? [Any] else { - throw MapError(key: key, currentValue: currentValue, reason: "Cannot cast to '[Any]'", file: file, function: function, line: line) - } - - return try jsonArray.map { JSONObject -> T in - return try Mapper(context: context).mapOrFail(JSONObject: JSONObject) - } - } - - /// Returns a `[BaseMappable]` using transform or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", using transform: Transform, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [Transform.Object] { - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let jsonArray = currentValue as? [Any] else { - throw MapError(key: key, currentValue: currentValue, reason: "Cannot cast to '[Any]'", file: file, function: function, line: line) - } - - return try jsonArray.map { json -> Transform.Object in - guard let object = transform.transformFromJSON(json) else { - throw MapError(key: "\(key)", currentValue: json, reason: "Cannot transform to '\(Transform.Object.self)' using \(transform)", file: file, function: function, line: line) - } - return object - } - } - - // MARK: [String: BaseMappable] - - /// Returns a `[String: BaseMappable]` or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [String: T] { - - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let jsonDictionary = currentValue as? [String: Any] else { - throw MapError(key: key, currentValue: currentValue, reason: "Cannot cast to '[String: Any]'", file: file, function: function, line: line) - } - var value: [String: T] = [:] - for (key, json) in jsonDictionary { - value[key] = try Mapper(context: context).mapOrFail(JSONObject: json) - } - return value - } - - /// Returns a `[String: BaseMappable]` using transform or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", using transform: Transform, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [String: Transform.Object] { - - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let jsonDictionary = currentValue as? [String: Any] else { - throw MapError(key: key, currentValue: currentValue, reason: "Cannot cast to '[String: Any]'", file: file, function: function, line: line) - } - var value: [String: Transform.Object] = [:] - for (key, json) in jsonDictionary { - guard let object = transform.transformFromJSON(json) else { - throw MapError(key: key, currentValue: json, reason: "Cannot transform to '\(Transform.Object.self)' using \(transform)", file: file, function: function, line: line) - } - value[key] = object - } - return value - } - - // MARK: [[BaseMappable]] - /// Returns a `[[BaseMappable]]` or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [[T]] { - - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let json2DArray = currentValue as? [[Any]] else { - throw MapError(key: key, currentValue: currentValue, reason: "Cannot cast to '[[Any]]'", file: file, function: function, line: line) - } - return try json2DArray.map { jsonArray in - try jsonArray.map { jsonObject -> T in - return try Mapper(context: context).mapOrFail(JSONObject: jsonObject) - } - } - } - - /// Returns a `[[BaseMappable]]` using transform or throws an error. - public func value(_ key: String, nested: Bool? = nil, delimiter: String = ".", using transform: Transform, file: StaticString = #file, function: StaticString = #function, line: UInt = #line) throws -> [[Transform.Object]] { - - let currentValue = self.currentValue(for: key, nested: nested, delimiter: delimiter) - guard let json2DArray = currentValue as? [[Any]] else { - throw MapError(key: key, currentValue: currentValue, reason: "Cannot cast to '[[Any]]'", - file: file, function: function, line: line) - } - - return try json2DArray.map { jsonArray in - try jsonArray.map { json -> Transform.Object in - guard let object = transform.transformFromJSON(json) else { - throw MapError(key: "\(key)", currentValue: json, reason: "Cannot transform to '\(Transform.Object.self)' using \(transform)", file: file, function: function, line: line) - } - return object - } - } - } -} - -public extension Mapper where N: ImmutableMappable { - - public func map(JSON: [String: Any]) throws -> N { - return try self.mapOrFail(JSON: JSON) - } - - public func map(JSONString: String) throws -> N { - return try mapOrFail(JSONString: JSONString) - } - - public func map(JSONObject: Any) throws -> N { - return try mapOrFail(JSONObject: JSONObject) - } - - // MARK: Array mapping functions - - public func mapArray(JSONArray: [[String: Any]]) throws -> [N] { - #if swift(>=4.1) - return try JSONArray.compactMap(mapOrFail) - #else - return try JSONArray.flatMap(mapOrFail) - #endif - } - - public func mapArray(JSONString: String) throws -> [N] { - guard let JSONObject = Mapper.parseJSONString(JSONString: JSONString) else { - throw MapError(key: nil, currentValue: JSONString, reason: "Cannot convert string into Any'") - } - - return try mapArray(JSONObject: JSONObject) - } - - public func mapArray(JSONObject: Any) throws -> [N] { - guard let JSONArray = JSONObject as? [[String: Any]] else { - throw MapError(key: nil, currentValue: JSONObject, reason: "Cannot cast to '[[String: Any]]'") - } - - return try mapArray(JSONArray: JSONArray) - } - - // MARK: Dictionary mapping functions - - public func mapDictionary(JSONString: String) throws -> [String: N] { - guard let JSONObject = Mapper.parseJSONString(JSONString: JSONString) else { - throw MapError(key: nil, currentValue: JSONString, reason: "Cannot convert string into Any'") - } - - return try mapDictionary(JSONObject: JSONObject) - } - - public func mapDictionary(JSONObject: Any?) throws -> [String: N] { - guard let JSON = JSONObject as? [String: [String: Any]] else { - throw MapError(key: nil, currentValue: JSONObject, reason: "Cannot cast to '[String: [String: Any]]''") - } - - return try mapDictionary(JSON: JSON) - } - - public func mapDictionary(JSON: [String: [String: Any]]) throws -> [String: N] { - return try JSON.filterMap(mapOrFail) - } - - // MARK: Dictinoary of arrays mapping functions - - public func mapDictionaryOfArrays(JSONObject: Any?) throws -> [String: [N]] { - guard let JSON = JSONObject as? [String: [[String: Any]]] else { - throw MapError(key: nil, currentValue: JSONObject, reason: "Cannot cast to '[String: [String: Any]]''") - } - return try mapDictionaryOfArrays(JSON: JSON) - } - - public func mapDictionaryOfArrays(JSON: [String: [[String: Any]]]) throws -> [String: [N]] { - return try JSON.filterMap { array -> [N] in - try mapArray(JSONArray: array) - } - } - - // MARK: 2 dimentional array mapping functions - - public func mapArrayOfArrays(JSONObject: Any?) throws -> [[N]] { - guard let JSONArray = JSONObject as? [[[String: Any]]] else { - throw MapError(key: nil, currentValue: JSONObject, reason: "Cannot cast to '[[[String: Any]]]''") - } - return try JSONArray.map(mapArray) - } - -} - -internal extension Mapper { - - internal func mapOrFail(JSON: [String: Any]) throws -> N { - let map = Map(mappingType: .fromJSON, JSON: JSON, context: context, shouldIncludeNilValues: shouldIncludeNilValues) - - // Check if object is ImmutableMappable, if so use ImmutableMappable protocol for mapping - if let klass = N.self as? ImmutableMappable.Type, - var object = try klass.init(map: map) as? N { - object.mapping(map: map) - return object - } - - // If not, map the object the standard way - guard let value = self.map(JSON: JSON) else { - throw MapError(key: nil, currentValue: JSON, reason: "Cannot map to '\(N.self)'") - } - return value - } - - internal func mapOrFail(JSONString: String) throws -> N { - guard let JSON = Mapper.parseJSONStringIntoDictionary(JSONString: JSONString) else { - throw MapError(key: nil, currentValue: JSONString, reason: "Cannot parse into '[String: Any]'") - } - return try mapOrFail(JSON: JSON) - } - - internal func mapOrFail(JSONObject: Any) throws -> N { - guard let JSON = JSONObject as? [String: Any] else { - throw MapError(key: nil, currentValue: JSONObject, reason: "Cannot cast to '[String: Any]'") - } - return try mapOrFail(JSON: JSON) - } - -} diff --git a/Example/Pods/ObjectMapper/Sources/IntegerOperators.swift b/Example/Pods/ObjectMapper/Sources/IntegerOperators.swift deleted file mode 100644 index 6e548d4..0000000 --- a/Example/Pods/ObjectMapper/Sources/IntegerOperators.swift +++ /dev/null @@ -1,171 +0,0 @@ -// -// IntegerOperators.swift -// ObjectMapper -// -// Created by Suyeol Jeon on 17/02/2017. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -// MARK: - Signed Integer - -/// SignedInteger mapping -public func <- (left: inout T, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - let value: T = toSignedInteger(right.currentValue) ?? 0 - FromJSON.basicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} - -/// Optional SignedInteger mapping -public func <- (left: inout T?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - let value: T? = toSignedInteger(right.currentValue) - FromJSON.basicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// ImplicitlyUnwrappedOptional SignedInteger mapping -public func <- (left: inout T!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - let value: T! = toSignedInteger(right.currentValue) - FromJSON.basicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} -#endif - - -// MARK: - Unsigned Integer - -/// UnsignedInteger mapping -public func <- (left: inout T, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - let value: T = toUnsignedInteger(right.currentValue) ?? 0 - FromJSON.basicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} - - -/// Optional UnsignedInteger mapping -public func <- (left: inout T?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - let value: T? = toUnsignedInteger(right.currentValue) - FromJSON.basicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// ImplicitlyUnwrappedOptional UnsignedInteger mapping -public func <- (left: inout T!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - let value: T! = toUnsignedInteger(right.currentValue) - FromJSON.basicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} -#endif - -// MARK: - Casting Utils - -/// Convert any value to `SignedInteger`. -private func toSignedInteger(_ value: Any?) -> T? { - guard - let value = value, - case let number as NSNumber = value - else { - return nil - } - - if T.self == Int.self, let x = Int(exactly: number.int64Value) { - return T.init(x) - } - if T.self == Int8.self, let x = Int8(exactly: number.int64Value) { - return T.init(x) - } - if T.self == Int16.self, let x = Int16(exactly: number.int64Value) { - return T.init(x) - } - if T.self == Int32.self, let x = Int32(exactly: number.int64Value) { - return T.init(x) - } - if T.self == Int64.self, let x = Int64(exactly: number.int64Value) { - return T.init(x) - } - - return nil -} - -/// Convert any value to `UnsignedInteger`. -private func toUnsignedInteger(_ value: Any?) -> T? { - guard - let value = value, - case let number as NSNumber = value - else { - return nil - } - - if T.self == UInt.self, let x = UInt(exactly: number.uint64Value) { - return T.init(x) - } - if T.self == UInt8.self, let x = UInt8(exactly: number.uint64Value) { - return T.init(x) - } - if T.self == UInt16.self, let x = UInt16(exactly: number.uint64Value) { - return T.init(x) - } - if T.self == UInt32.self, let x = UInt32(exactly: number.uint64Value) { - return T.init(x) - } - if T.self == UInt64.self, let x = UInt64(exactly: number.uint64Value) { - return T.init(x) - } - - return nil -} diff --git a/Example/Pods/ObjectMapper/Sources/Map.swift b/Example/Pods/ObjectMapper/Sources/Map.swift deleted file mode 100644 index 38dc2a3..0000000 --- a/Example/Pods/ObjectMapper/Sources/Map.swift +++ /dev/null @@ -1,204 +0,0 @@ -// -// Map.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2015-10-09. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - - -import Foundation - -/// MapContext is available for developers who wish to pass information around during the mapping process. -public protocol MapContext { - -} - -/// A class used for holding mapping data -public final class Map { - public let mappingType: MappingType - - public internal(set) var JSON: [String: Any] = [:] - public internal(set) var isKeyPresent = false - public internal(set) var currentValue: Any? - public internal(set) var currentKey: String? - var keyIsNested = false - public internal(set) var nestedKeyDelimiter: String = "." - public var context: MapContext? - public var shouldIncludeNilValues = false /// If this is set to true, toJSON output will include null values for any variables that are not set. - - public let toObject: Bool // indicates whether the mapping is being applied to an existing object - - public init(mappingType: MappingType, JSON: [String: Any], toObject: Bool = false, context: MapContext? = nil, shouldIncludeNilValues: Bool = false) { - - self.mappingType = mappingType - self.JSON = JSON - self.toObject = toObject - self.context = context - self.shouldIncludeNilValues = shouldIncludeNilValues - } - - /// Sets the current mapper value and key. - /// The Key paramater can be a period separated string (ex. "distance.value") to access sub objects. - public subscript(key: String) -> Map { - // save key and value associated to it - return self.subscript(key: key) - } - - public subscript(key: String, delimiter delimiter: String) -> Map { - return self.subscript(key: key, delimiter: delimiter) - } - - public subscript(key: String, nested nested: Bool) -> Map { - return self.subscript(key: key, nested: nested) - } - - public subscript(key: String, nested nested: Bool, delimiter delimiter: String) -> Map { - return self.subscript(key: key, nested: nested, delimiter: delimiter) - } - - public subscript(key: String, ignoreNil ignoreNil: Bool) -> Map { - return self.subscript(key: key, ignoreNil: ignoreNil) - } - - public subscript(key: String, delimiter delimiter: String, ignoreNil ignoreNil: Bool) -> Map { - return self.subscript(key: key, delimiter: delimiter, ignoreNil: ignoreNil) - } - - public subscript(key: String, nested nested: Bool, ignoreNil ignoreNil: Bool) -> Map { - return self.subscript(key: key, nested: nested, ignoreNil: ignoreNil) - } - - public subscript(key: String, nested nested: Bool?, delimiter delimiter: String, ignoreNil ignoreNil: Bool) -> Map { - return self.subscript(key: key, nested: nested, delimiter: delimiter, ignoreNil: ignoreNil) - } - - private func `subscript`(key: String, nested: Bool? = nil, delimiter: String = ".", ignoreNil: Bool = false) -> Map { - // save key and value associated to it - currentKey = key - keyIsNested = nested ?? key.contains(delimiter) - nestedKeyDelimiter = delimiter - - if mappingType == .fromJSON { - // check if a value exists for the current key - // do this pre-check for performance reasons - if keyIsNested { - // break down the components of the key that are separated by delimiter - (isKeyPresent, currentValue) = valueFor(ArraySlice(key.components(separatedBy: delimiter)), dictionary: JSON) - } else { - let object = JSON[key] - let isNSNull = object is NSNull - isKeyPresent = isNSNull ? true : object != nil - currentValue = isNSNull ? nil : object - } - - // update isKeyPresent if ignoreNil is true - if ignoreNil && currentValue == nil { - isKeyPresent = false - } - } - - return self - } - - public func value() -> T? { - let value = currentValue as? T - - // Swift 4.1 breaks Float casting from `NSNumber`. So Added extra checks for `Float` `[Float]` and `[String:Float]` - if value == nil && T.self == Float.self { - if let v = currentValue as? NSNumber { - return v.floatValue as? T - } - } else if value == nil && T.self == [Float].self { - if let v = currentValue as? [Double] { - #if swift(>=4.1) - return v.compactMap{ Float($0) } as? T - #else - return v.flatMap{ Float($0) } as? T - #endif - } - } else if value == nil && T.self == [String:Float].self { - if let v = currentValue as? [String:Double] { - return v.mapValues{ Float($0) } as? T - } - } - return value - } -} - -/// Fetch value from JSON dictionary, loop through keyPathComponents until we reach the desired object -private func valueFor(_ keyPathComponents: ArraySlice, dictionary: [String: Any]) -> (Bool, Any?) { - // Implement it as a tail recursive function. - if keyPathComponents.isEmpty { - return (false, nil) - } - - if let keyPath = keyPathComponents.first { - let isTail = keyPathComponents.count == 1 - let object = dictionary[keyPath] - if object is NSNull { - return (isTail, nil) - } else if keyPathComponents.count > 1, let dict = object as? [String: Any] { - let tail = keyPathComponents.dropFirst() - return valueFor(tail, dictionary: dict) - } else if keyPathComponents.count > 1, let array = object as? [Any] { - let tail = keyPathComponents.dropFirst() - return valueFor(tail, array: array) - } else { - return (isTail && object != nil, object) - } - } - - return (false, nil) -} - -/// Fetch value from JSON Array, loop through keyPathComponents them until we reach the desired object -private func valueFor(_ keyPathComponents: ArraySlice, array: [Any]) -> (Bool, Any?) { - // Implement it as a tail recursive function. - - if keyPathComponents.isEmpty { - return (false, nil) - } - - //Try to convert keypath to Int as index - if let keyPath = keyPathComponents.first, - let index = Int(keyPath) , index >= 0 && index < array.count { - - let isTail = keyPathComponents.count == 1 - let object = array[index] - - if object is NSNull { - return (isTail, nil) - } else if keyPathComponents.count > 1, let array = object as? [Any] { - let tail = keyPathComponents.dropFirst() - return valueFor(tail, array: array) - } else if keyPathComponents.count > 1, let dict = object as? [String: Any] { - let tail = keyPathComponents.dropFirst() - return valueFor(tail, dictionary: dict) - } else { - return (isTail, object) - } - } - - return (false, nil) -} diff --git a/Example/Pods/ObjectMapper/Sources/MapError.swift b/Example/Pods/ObjectMapper/Sources/MapError.swift deleted file mode 100644 index 9e9736b..0000000 --- a/Example/Pods/ObjectMapper/Sources/MapError.swift +++ /dev/null @@ -1,68 +0,0 @@ -// -// MapError.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2016-09-26. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -public struct MapError: Error { - public var key: String? - public var currentValue: Any? - public var reason: String? - public var file: StaticString? - public var function: StaticString? - public var line: UInt? - - public init(key: String?, currentValue: Any?, reason: String?, file: StaticString? = nil, function: StaticString? = nil, line: UInt? = nil) { - self.key = key - self.currentValue = currentValue - self.reason = reason - self.file = file - self.function = function - self.line = line - } -} - -extension MapError: CustomStringConvertible { - - private var location: String? { - guard let file = file, let function = function, let line = line else { return nil } - let fileName = ((String(describing: file).components(separatedBy: "/").last ?? "").components(separatedBy: ".").first ?? "") - return "\(fileName).\(function):\(line)" - } - - public var description: String { - let info: [(String, Any?)] = [ - ("- reason", reason), - ("- location", location), - ("- key", key), - ("- currentValue", currentValue), - ] - let infoString = info.map { "\($0.0): \($0.1 ?? "nil")" }.joined(separator: "\n") - return "Got an error while mapping.\n\(infoString)" - } - -} diff --git a/Example/Pods/ObjectMapper/Sources/Mappable.swift b/Example/Pods/ObjectMapper/Sources/Mappable.swift deleted file mode 100644 index f03cd47..0000000 --- a/Example/Pods/ObjectMapper/Sources/Mappable.swift +++ /dev/null @@ -1,136 +0,0 @@ -// -// Mappable.swift -// ObjectMapper -// -// Created by Scott Hoyt on 10/25/15. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -/// BaseMappable should not be implemented directly. Mappable or StaticMappable should be used instead -public protocol BaseMappable { - /// This function is where all variable mappings should occur. It is executed by Mapper during the mapping (serialization and deserialization) process. - mutating func mapping(map: Map) -} - -public protocol Mappable: BaseMappable { - /// This function can be used to validate JSON prior to mapping. Return nil to cancel mapping at this point - init?(map: Map) -} - -public protocol StaticMappable: BaseMappable { - /// This is function that can be used to: - /// 1) provide an existing cached object to be used for mapping - /// 2) return an object of another class (which conforms to BaseMappable) to be used for mapping. For instance, you may inspect the JSON to infer the type of object that should be used for any given mapping - static func objectForMapping(map: Map) -> BaseMappable? -} - -public extension BaseMappable { - - /// Initializes object from a JSON String - public init?(JSONString: String, context: MapContext? = nil) { - if let obj: Self = Mapper(context: context).map(JSONString: JSONString) { - self = obj - } else { - return nil - } - } - - /// Initializes object from a JSON Dictionary - public init?(JSON: [String: Any], context: MapContext? = nil) { - if let obj: Self = Mapper(context: context).map(JSON: JSON) { - self = obj - } else { - return nil - } - } - - /// Returns the JSON Dictionary for the object - public func toJSON() -> [String: Any] { - return Mapper().toJSON(self) - } - - /// Returns the JSON String for the object - public func toJSONString(prettyPrint: Bool = false) -> String? { - return Mapper().toJSONString(self, prettyPrint: prettyPrint) - } -} - -public extension Array where Element: BaseMappable { - - /// Initialize Array from a JSON String - public init?(JSONString: String, context: MapContext? = nil) { - if let obj: [Element] = Mapper(context: context).mapArray(JSONString: JSONString) { - self = obj - } else { - return nil - } - } - - /// Initialize Array from a JSON Array - public init(JSONArray: [[String: Any]], context: MapContext? = nil) { - let obj: [Element] = Mapper(context: context).mapArray(JSONArray: JSONArray) - self = obj - } - - /// Returns the JSON Array - public func toJSON() -> [[String: Any]] { - return Mapper().toJSONArray(self) - } - - /// Returns the JSON String for the object - public func toJSONString(prettyPrint: Bool = false) -> String? { - return Mapper().toJSONString(self, prettyPrint: prettyPrint) - } -} - -public extension Set where Element: BaseMappable { - - /// Initializes a set from a JSON String - public init?(JSONString: String, context: MapContext? = nil) { - if let obj: Set = Mapper(context: context).mapSet(JSONString: JSONString) { - self = obj - } else { - return nil - } - } - - /// Initializes a set from JSON - public init?(JSONArray: [[String: Any]], context: MapContext? = nil) { - guard let obj = Mapper(context: context).mapSet(JSONArray: JSONArray) as Set? else { - return nil - } - self = obj - } - - /// Returns the JSON Set - public func toJSON() -> [[String: Any]] { - return Mapper().toJSONSet(self) - } - - /// Returns the JSON String for the object - public func toJSONString(prettyPrint: Bool = false) -> String? { - return Mapper().toJSONString(self, prettyPrint: prettyPrint) - } -} diff --git a/Example/Pods/ObjectMapper/Sources/Mapper.swift b/Example/Pods/ObjectMapper/Sources/Mapper.swift deleted file mode 100755 index 97cf087..0000000 --- a/Example/Pods/ObjectMapper/Sources/Mapper.swift +++ /dev/null @@ -1,490 +0,0 @@ -// -// Mapper.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2014-10-09. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -public enum MappingType { - case fromJSON - case toJSON -} - -/// The Mapper class provides methods for converting Model objects to JSON and methods for converting JSON to Model objects -public final class Mapper { - - public var context: MapContext? - public var shouldIncludeNilValues = false /// If this is set to true, toJSON output will include null values for any variables that are not set. - - public init(context: MapContext? = nil, shouldIncludeNilValues: Bool = false){ - self.context = context - self.shouldIncludeNilValues = shouldIncludeNilValues - } - - // MARK: Mapping functions that map to an existing object toObject - - /// Maps a JSON object to an existing Mappable object if it is a JSON dictionary, or returns the passed object as is - public func map(JSONObject: Any?, toObject object: N) -> N { - if let JSON = JSONObject as? [String: Any] { - return map(JSON: JSON, toObject: object) - } - - return object - } - - /// Map a JSON string onto an existing object - public func map(JSONString: String, toObject object: N) -> N { - if let JSON = Mapper.parseJSONStringIntoDictionary(JSONString: JSONString) { - return map(JSON: JSON, toObject: object) - } - return object - } - - /// Maps a JSON dictionary to an existing object that conforms to Mappable. - /// Usefull for those pesky objects that have crappy designated initializers like NSManagedObject - public func map(JSON: [String: Any], toObject object: N) -> N { - var mutableObject = object - let map = Map(mappingType: .fromJSON, JSON: JSON, toObject: true, context: context, shouldIncludeNilValues: shouldIncludeNilValues) - mutableObject.mapping(map: map) - return mutableObject - } - - //MARK: Mapping functions that create an object - - /// Map a JSON string to an object that conforms to Mappable - public func map(JSONString: String) -> N? { - if let JSON = Mapper.parseJSONStringIntoDictionary(JSONString: JSONString) { - return map(JSON: JSON) - } - - return nil - } - - /// Maps a JSON object to a Mappable object if it is a JSON dictionary or NSString, or returns nil. - public func map(JSONObject: Any?) -> N? { - if let JSON = JSONObject as? [String: Any] { - return map(JSON: JSON) - } - - return nil - } - - /// Maps a JSON dictionary to an object that conforms to Mappable - public func map(JSON: [String: Any]) -> N? { - let map = Map(mappingType: .fromJSON, JSON: JSON, context: context, shouldIncludeNilValues: shouldIncludeNilValues) - - if let klass = N.self as? StaticMappable.Type { // Check if object is StaticMappable - if var object = klass.objectForMapping(map: map) as? N { - object.mapping(map: map) - return object - } - } else if let klass = N.self as? Mappable.Type { // Check if object is Mappable - if var object = klass.init(map: map) as? N { - object.mapping(map: map) - return object - } - } else if let klass = N.self as? ImmutableMappable.Type { // Check if object is ImmutableMappable - do { - return try klass.init(map: map) as? N - } catch let error { - #if DEBUG - let exception: NSException - if let mapError = error as? MapError { - exception = NSException(name: .init(rawValue: "MapError"), reason: mapError.description, userInfo: nil) - } else { - exception = NSException(name: .init(rawValue: "ImmutableMappableError"), reason: error.localizedDescription, userInfo: nil) - } - exception.raise() - #endif - } - } else { - // Ensure BaseMappable is not implemented directly - assert(false, "BaseMappable should not be implemented directly. Please implement Mappable, StaticMappable or ImmutableMappable") - } - - return nil - } - - // MARK: Mapping functions for Arrays and Dictionaries - - /// Maps a JSON array to an object that conforms to Mappable - public func mapArray(JSONString: String) -> [N]? { - let parsedJSON: Any? = Mapper.parseJSONString(JSONString: JSONString) - - if let objectArray = mapArray(JSONObject: parsedJSON) { - return objectArray - } - - // failed to parse JSON into array form - // try to parse it into a dictionary and then wrap it in an array - if let object = map(JSONObject: parsedJSON) { - return [object] - } - - return nil - } - - /// Maps a JSON object to an array of Mappable objects if it is an array of JSON dictionary, or returns nil. - public func mapArray(JSONObject: Any?) -> [N]? { - if let JSONArray = JSONObject as? [[String: Any]] { - return mapArray(JSONArray: JSONArray) - } - - return nil - } - - /// Maps an array of JSON dictionary to an array of Mappable objects - public func mapArray(JSONArray: [[String: Any]]) -> [N] { - // map every element in JSON array to type N - #if swift(>=4.1) - let result = JSONArray.compactMap(map) - #else - let result = JSONArray.flatMap(map) - #endif - return result - } - - /// Maps a JSON object to a dictionary of Mappable objects if it is a JSON dictionary of dictionaries, or returns nil. - public func mapDictionary(JSONString: String) -> [String: N]? { - let parsedJSON: Any? = Mapper.parseJSONString(JSONString: JSONString) - return mapDictionary(JSONObject: parsedJSON) - } - - /// Maps a JSON object to a dictionary of Mappable objects if it is a JSON dictionary of dictionaries, or returns nil. - public func mapDictionary(JSONObject: Any?) -> [String: N]? { - if let JSON = JSONObject as? [String: [String: Any]] { - return mapDictionary(JSON: JSON) - } - - return nil - } - - /// Maps a JSON dictionary of dictionaries to a dictionary of Mappable objects - public func mapDictionary(JSON: [String: [String: Any]]) -> [String: N]? { - // map every value in dictionary to type N - let result = JSON.filterMap(map) - if result.isEmpty == false { - return result - } - - return nil - } - - /// Maps a JSON object to a dictionary of Mappable objects if it is a JSON dictionary of dictionaries, or returns nil. - public func mapDictionary(JSONObject: Any?, toDictionary dictionary: [String: N]) -> [String: N] { - if let JSON = JSONObject as? [String : [String : Any]] { - return mapDictionary(JSON: JSON, toDictionary: dictionary) - } - - return dictionary - } - - /// Maps a JSON dictionary of dictionaries to an existing dictionary of Mappable objects - public func mapDictionary(JSON: [String: [String: Any]], toDictionary dictionary: [String: N]) -> [String: N] { - var mutableDictionary = dictionary - for (key, value) in JSON { - if let object = dictionary[key] { - _ = map(JSON: value, toObject: object) - } else { - mutableDictionary[key] = map(JSON: value) - } - } - - return mutableDictionary - } - - /// Maps a JSON object to a dictionary of arrays of Mappable objects - public func mapDictionaryOfArrays(JSONObject: Any?) -> [String: [N]]? { - if let JSON = JSONObject as? [String: [[String: Any]]] { - return mapDictionaryOfArrays(JSON: JSON) - } - - return nil - } - - ///Maps a JSON dictionary of arrays to a dictionary of arrays of Mappable objects - public func mapDictionaryOfArrays(JSON: [String: [[String: Any]]]) -> [String: [N]]? { - // map every value in dictionary to type N - let result = JSON.filterMap { - mapArray(JSONArray: $0) - } - - if result.isEmpty == false { - return result - } - - return nil - } - - /// Maps an 2 dimentional array of JSON dictionaries to a 2 dimentional array of Mappable objects - public func mapArrayOfArrays(JSONObject: Any?) -> [[N]]? { - if let JSONArray = JSONObject as? [[[String: Any]]] { - var objectArray = [[N]]() - for innerJSONArray in JSONArray { - let array = mapArray(JSONArray: innerJSONArray) - objectArray.append(array) - } - - if objectArray.isEmpty == false { - return objectArray - } - } - - return nil - } - - // MARK: Utility functions for converting strings to JSON objects - - /// Convert a JSON String into a Dictionary using NSJSONSerialization - public static func parseJSONStringIntoDictionary(JSONString: String) -> [String: Any]? { - let parsedJSON: Any? = Mapper.parseJSONString(JSONString: JSONString) - return parsedJSON as? [String: Any] - } - - /// Convert a JSON String into an Object using NSJSONSerialization - public static func parseJSONString(JSONString: String) -> Any? { - let data = JSONString.data(using: String.Encoding.utf8, allowLossyConversion: true) - if let data = data { - let parsedJSON: Any? - do { - parsedJSON = try JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.allowFragments) - } catch let error { - print(error) - parsedJSON = nil - } - return parsedJSON - } - - return nil - } -} - -extension Mapper { - // MARK: Functions that create model from JSON file - - /// JSON file to Mappable object - /// - parameter JSONfile: Filename - /// - Returns: Mappable object - public func map(JSONfile: String) -> N? { - if let path = Bundle.main.path(forResource: JSONfile, ofType: nil) { - do { - let JSONString = try String(contentsOfFile: path) - do { - return self.map(JSONString: JSONString) - } - } catch { - return nil - } - } - return nil - } - - /// JSON file to Mappable object array - /// - parameter JSONfile: Filename - /// - Returns: Mappable object array - public func mapArray(JSONfile: String) -> [N]? { - if let path = Bundle.main.path(forResource: JSONfile, ofType: nil) { - do { - let JSONString = try String(contentsOfFile: path) - do { - return self.mapArray(JSONString: JSONString) - } - } catch { - return nil - } - } - return nil - } -} - -extension Mapper { - - // MARK: Functions that create JSON from objects - - ///Maps an object that conforms to Mappable to a JSON dictionary - public func toJSON(_ object: N) -> [String: Any] { - var mutableObject = object - let map = Map(mappingType: .toJSON, JSON: [:], context: context, shouldIncludeNilValues: shouldIncludeNilValues) - mutableObject.mapping(map: map) - return map.JSON - } - - ///Maps an array of Objects to an array of JSON dictionaries [[String: Any]] - public func toJSONArray(_ array: [N]) -> [[String: Any]] { - return array.map { - // convert every element in array to JSON dictionary equivalent - self.toJSON($0) - } - } - - ///Maps a dictionary of Objects that conform to Mappable to a JSON dictionary of dictionaries. - public func toJSONDictionary(_ dictionary: [String: N]) -> [String: [String: Any]] { - return dictionary.map { (arg: (key: String, value: N)) in - // convert every value in dictionary to its JSON dictionary equivalent - return (arg.key, self.toJSON(arg.value)) - } - } - - ///Maps a dictionary of Objects that conform to Mappable to a JSON dictionary of dictionaries. - public func toJSONDictionaryOfArrays(_ dictionary: [String: [N]]) -> [String: [[String: Any]]] { - return dictionary.map { (arg: (key: String, value: [N])) in - // convert every value (array) in dictionary to its JSON dictionary equivalent - return (arg.key, self.toJSONArray(arg.value)) - } - } - - /// Maps an Object to a JSON string with option of pretty formatting - public func toJSONString(_ object: N, prettyPrint: Bool = false) -> String? { - let JSONDict = toJSON(object) - - return Mapper.toJSONString(JSONDict as Any, prettyPrint: prettyPrint) - } - - /// Maps an array of Objects to a JSON string with option of pretty formatting - public func toJSONString(_ array: [N], prettyPrint: Bool = false) -> String? { - let JSONDict = toJSONArray(array) - - return Mapper.toJSONString(JSONDict as Any, prettyPrint: prettyPrint) - } - - /// Converts an Object to a JSON string with option of pretty formatting - public static func toJSONString(_ JSONObject: Any, prettyPrint: Bool) -> String? { - let options: JSONSerialization.WritingOptions = prettyPrint ? .prettyPrinted : [] - if let JSON = Mapper.toJSONData(JSONObject, options: options) { - return String(data: JSON, encoding: String.Encoding.utf8) - } - - return nil - } - - /// Converts an Object to JSON data with options - public static func toJSONData(_ JSONObject: Any, options: JSONSerialization.WritingOptions) -> Data? { - if JSONSerialization.isValidJSONObject(JSONObject) { - let JSONData: Data? - do { - JSONData = try JSONSerialization.data(withJSONObject: JSONObject, options: options) - } catch let error { - print(error) - JSONData = nil - } - - return JSONData - } - - return nil - } -} - -extension Mapper where N: Hashable { - - /// Maps a JSON array to an object that conforms to Mappable - public func mapSet(JSONString: String) -> Set? { - let parsedJSON: Any? = Mapper.parseJSONString(JSONString: JSONString) - - if let objectArray = mapArray(JSONObject: parsedJSON) { - return Set(objectArray) - } - - // failed to parse JSON into array form - // try to parse it into a dictionary and then wrap it in an array - if let object = map(JSONObject: parsedJSON) { - return Set([object]) - } - - return nil - } - - /// Maps a JSON object to an Set of Mappable objects if it is an array of JSON dictionary, or returns nil. - public func mapSet(JSONObject: Any?) -> Set? { - if let JSONArray = JSONObject as? [[String: Any]] { - return mapSet(JSONArray: JSONArray) - } - - return nil - } - - /// Maps an Set of JSON dictionary to an array of Mappable objects - public func mapSet(JSONArray: [[String: Any]]) -> Set { - // map every element in JSON array to type N - #if swift(>=4.1) - return Set(JSONArray.compactMap(map)) - #else - return Set(JSONArray.flatMap(map)) - #endif - } - - ///Maps a Set of Objects to a Set of JSON dictionaries [[String : Any]] - public func toJSONSet(_ set: Set) -> [[String: Any]] { - return set.map { - // convert every element in set to JSON dictionary equivalent - self.toJSON($0) - } - } - - /// Maps a set of Objects to a JSON string with option of pretty formatting - public func toJSONString(_ set: Set, prettyPrint: Bool = false) -> String? { - let JSONDict = toJSONSet(set) - - return Mapper.toJSONString(JSONDict as Any, prettyPrint: prettyPrint) - } -} - -extension Dictionary { - internal func map(_ f: (Element) throws -> (K, V)) rethrows -> [K: V] { - var mapped = [K: V]() - - for element in self { - let newElement = try f(element) - mapped[newElement.0] = newElement.1 - } - - return mapped - } - - internal func map(_ f: (Element) throws -> (K, [V])) rethrows -> [K: [V]] { - var mapped = [K: [V]]() - - for element in self { - let newElement = try f(element) - mapped[newElement.0] = newElement.1 - } - - return mapped - } - - - internal func filterMap(_ f: (Value) throws -> U?) rethrows -> [Key: U] { - var mapped = [Key: U]() - - for (key, value) in self { - if let newValue = try f(value) { - mapped[key] = newValue - } - } - - return mapped - } -} diff --git a/Example/Pods/ObjectMapper/Sources/Operators.swift b/Example/Pods/ObjectMapper/Sources/Operators.swift deleted file mode 100755 index 2c12c52..0000000 --- a/Example/Pods/ObjectMapper/Sources/Operators.swift +++ /dev/null @@ -1,398 +0,0 @@ -// -// Operators.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2014-10-09. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -/** -* This file defines a new operator which is used to create a mapping between an object and a JSON key value. -* There is an overloaded operator definition for each type of object that is supported in ObjectMapper. -* This provides a way to add custom logic to handle specific types of objects -*/ - -/// Operator used for defining mappings to and from JSON -infix operator <- - -/// Operator used to define mappings to JSON -infix operator >>> - -// MARK:- Objects with Basic types - -/// Object of Basic type -public func <- (left: inout T, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.basicType(&left, object: right.value()) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: T, right: Map) { - if right.mappingType == .toJSON { - ToJSON.basicType(left, map: right) - } -} - - -/// Optional object of basic type -public func <- (left: inout T?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalBasicType(&left, object: right.value()) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: T?, right: Map) { - if right.mappingType == .toJSON { - ToJSON.optionalBasicType(left, map: right) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped optional object of basic type -public func <- (left: inout T!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalBasicType(&left, object: right.value()) - case .toJSON: - left >>> right - default: () - } -} -#endif - -// MARK:- Mappable Objects - - -/// Object conforming to Mappable -public func <- (left: inout T, right: Map) { - switch right.mappingType { - case .fromJSON: - FromJSON.object(&left, map: right) - case .toJSON: - left >>> right - } -} - -public func >>> (left: T, right: Map) { - if right.mappingType == .toJSON { - ToJSON.object(left, map: right) - } -} - - -/// Optional Mappable objects -public func <- (left: inout T?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObject(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: T?, right: Map) { - if right.mappingType == .toJSON { - ToJSON.optionalObject(left, map: right) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped optional Mappable objects -public func <- (left: inout T!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObject(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} -#endif - -// MARK:- Dictionary of Mappable objects - Dictionary - -/// Dictionary of Mappable objects -public func <- (left: inout Dictionary, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.objectDictionary(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Dictionary, right: Map) { - if right.mappingType == .toJSON { - ToJSON.objectDictionary(left, map: right) - } -} - - -/// Optional Dictionary of Mappable object -public func <- (left: inout Dictionary?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObjectDictionary(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Dictionary?, right: Map) { - if right.mappingType == .toJSON { - ToJSON.optionalObjectDictionary(left, map: right) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional Dictionary of Mappable object -public func <- (left: inout Dictionary!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObjectDictionary(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} -#endif - -/// Dictionary of Mappable objects -public func <- (left: inout Dictionary, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.objectDictionaryOfArrays(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Dictionary, right: Map) { - if right.mappingType == .toJSON { - ToJSON.objectDictionaryOfArrays(left, map: right) - } -} - -/// Optional Dictionary of Mappable object -public func <- (left: inout Dictionary?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObjectDictionaryOfArrays(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Dictionary?, right: Map) { - if right.mappingType == .toJSON { - ToJSON.optionalObjectDictionaryOfArrays(left, map: right) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional Dictionary of Mappable object -public func <- (left: inout Dictionary!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObjectDictionaryOfArrays(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} -#endif - -// MARK:- Array of Mappable objects - Array - -/// Array of Mappable objects -public func <- (left: inout Array, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.objectArray(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Array, right: Map) { - if right.mappingType == .toJSON { - ToJSON.objectArray(left, map: right) - } -} - -/// Optional array of Mappable objects -public func <- (left: inout Array?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObjectArray(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Array?, right: Map) { - if right.mappingType == .toJSON { - ToJSON.optionalObjectArray(left, map: right) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional array of Mappable objects -public func <- (left: inout Array!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObjectArray(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} -#endif - -// MARK:- Array of Array of Mappable objects - Array> - -/// Array of Array Mappable objects -public func <- (left: inout Array>, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.twoDimensionalObjectArray(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Array>, right: Map) { - if right.mappingType == .toJSON { - ToJSON.twoDimensionalObjectArray(left, map: right) - } -} - - -/// Optional array of Mappable objects -public func <- (left:inout Array>?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalTwoDimensionalObjectArray(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Array>?, right: Map) { - if right.mappingType == .toJSON { - ToJSON.optionalTwoDimensionalObjectArray(left, map: right) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional array of Mappable objects -public func <- (left: inout Array>!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalTwoDimensionalObjectArray(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} -#endif - -// MARK:- Set of Mappable objects - Set - -/// Set of Mappable objects -public func <- (left: inout Set, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.objectSet(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Set, right: Map) { - if right.mappingType == .toJSON { - ToJSON.objectSet(left, map: right) - } -} - - -/// Optional Set of Mappable objects -public func <- (left: inout Set?, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObjectSet(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Set?, right: Map) { - if right.mappingType == .toJSON { - ToJSON.optionalObjectSet(left, map: right) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional Set of Mappable objects -public func <- (left: inout Set!, right: Map) { - switch right.mappingType { - case .fromJSON where right.isKeyPresent: - FromJSON.optionalObjectSet(&left, map: right) - case .toJSON: - left >>> right - default: () - } -} -#endif diff --git a/Example/Pods/ObjectMapper/Sources/ToJSON.swift b/Example/Pods/ObjectMapper/Sources/ToJSON.swift deleted file mode 100644 index c2bf008..0000000 --- a/Example/Pods/ObjectMapper/Sources/ToJSON.swift +++ /dev/null @@ -1,181 +0,0 @@ -// -// ToJSON.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2014-10-13. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -private func setValue(_ value: Any, map: Map) { - setValue(value, key: map.currentKey!, checkForNestedKeys: map.keyIsNested, delimiter: map.nestedKeyDelimiter, dictionary: &map.JSON) -} - -private func setValue(_ value: Any, key: String, checkForNestedKeys: Bool, delimiter: String, dictionary: inout [String : Any]) { - if checkForNestedKeys { - let keyComponents = ArraySlice(key.components(separatedBy: delimiter).filter { !$0.isEmpty }.map { $0 }) - setValue(value, forKeyPathComponents: keyComponents, dictionary: &dictionary) - } else { - dictionary[key] = value - } -} - -private func setValue(_ value: Any, forKeyPathComponents components: ArraySlice, dictionary: inout [String : Any]) { - if components.isEmpty { - return - } - - let head = components.first! - - if components.count == 1 { - dictionary[String(head)] = value - } else { - var child = dictionary[String(head)] as? [String : Any] - if child == nil { - child = [:] - } - - let tail = components.dropFirst() - setValue(value, forKeyPathComponents: tail, dictionary: &child!) - - dictionary[String(head)] = child - } -} - -internal final class ToJSON { - - class func basicType(_ field: N, map: Map) { - if let x = field as Any? , false - || x is NSNumber // Basic types - || x is Bool - || x is Int - || x is Double - || x is Float - || x is String - || x is NSNull - || x is Array // Arrays - || x is Array - || x is Array - || x is Array - || x is Array - || x is Array - || x is Array - || x is Array> - || x is Dictionary // Dictionaries - || x is Dictionary - || x is Dictionary - || x is Dictionary - || x is Dictionary - || x is Dictionary - || x is Dictionary - { - setValue(x, map: map) - } - } - - class func optionalBasicType(_ field: N?, map: Map) { - if let field = field { - basicType(field, map: map) - } else if map.shouldIncludeNilValues { - basicType(NSNull(), map: map) //If BasicType is nil, emit NSNull into the JSON output - } - } - - class func object(_ field: N, map: Map) { - if let result = Mapper(context: map.context, shouldIncludeNilValues: map.shouldIncludeNilValues).toJSON(field) as Any? { - setValue(result, map: map) - } - } - - class func optionalObject(_ field: N?, map: Map) { - if let field = field { - object(field, map: map) - } else if map.shouldIncludeNilValues { - basicType(NSNull(), map: map) //If field is nil, emit NSNull into the JSON output - } - } - - class func objectArray(_ field: Array, map: Map) { - let JSONObjects = Mapper(context: map.context, shouldIncludeNilValues: map.shouldIncludeNilValues).toJSONArray(field) - - setValue(JSONObjects, map: map) - } - - class func optionalObjectArray(_ field: Array?, map: Map) { - if let field = field { - objectArray(field, map: map) - } - } - - class func twoDimensionalObjectArray(_ field: Array>, map: Map) { - var array = [[[String: Any]]]() - for innerArray in field { - let JSONObjects = Mapper(context: map.context, shouldIncludeNilValues: map.shouldIncludeNilValues).toJSONArray(innerArray) - array.append(JSONObjects) - } - setValue(array, map: map) - } - - class func optionalTwoDimensionalObjectArray(_ field: Array>?, map: Map) { - if let field = field { - twoDimensionalObjectArray(field, map: map) - } - } - - class func objectSet(_ field: Set, map: Map) { - let JSONObjects = Mapper(context: map.context, shouldIncludeNilValues: map.shouldIncludeNilValues).toJSONSet(field) - - setValue(JSONObjects, map: map) - } - - class func optionalObjectSet(_ field: Set?, map: Map) { - if let field = field { - objectSet(field, map: map) - } - } - - class func objectDictionary(_ field: Dictionary, map: Map) { - let JSONObjects = Mapper(context: map.context, shouldIncludeNilValues: map.shouldIncludeNilValues).toJSONDictionary(field) - - setValue(JSONObjects, map: map) - } - - class func optionalObjectDictionary(_ field: Dictionary?, map: Map) { - if let field = field { - objectDictionary(field, map: map) - } - } - - class func objectDictionaryOfArrays(_ field: Dictionary, map: Map) { - let JSONObjects = Mapper(context: map.context, shouldIncludeNilValues: map.shouldIncludeNilValues).toJSONDictionaryOfArrays(field) - - setValue(JSONObjects, map: map) - } - - class func optionalObjectDictionaryOfArrays(_ field: Dictionary?, map: Map) { - if let field = field { - objectDictionaryOfArrays(field, map: map) - } - } -} diff --git a/Example/Pods/ObjectMapper/Sources/TransformOf.swift b/Example/Pods/ObjectMapper/Sources/TransformOf.swift deleted file mode 100644 index 6012260..0000000 --- a/Example/Pods/ObjectMapper/Sources/TransformOf.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// TransformOf.swift -// ObjectMapper -// -// Created by Syo Ikeda on 1/23/15. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -open class TransformOf: TransformType { - public typealias Object = ObjectType - public typealias JSON = JSONType - - private let fromJSON: (JSONType?) -> ObjectType? - private let toJSON: (ObjectType?) -> JSONType? - - public init(fromJSON: @escaping(JSONType?) -> ObjectType?, toJSON: @escaping(ObjectType?) -> JSONType?) { - self.fromJSON = fromJSON - self.toJSON = toJSON - } - - open func transformFromJSON(_ value: Any?) -> ObjectType? { - return fromJSON(value as? JSONType) - } - - open func transformToJSON(_ value: ObjectType?) -> JSONType? { - return toJSON(value) - } -} diff --git a/Example/Pods/ObjectMapper/Sources/TransformOperators.swift b/Example/Pods/ObjectMapper/Sources/TransformOperators.swift deleted file mode 100644 index 1c55f9b..0000000 --- a/Example/Pods/ObjectMapper/Sources/TransformOperators.swift +++ /dev/null @@ -1,709 +0,0 @@ -// -// TransformOperators.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2016-09-26. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -// MARK:- Transforms - -/// Object of Basic type with Transform -public func <- (left: inout Transform.Object, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let value = transform.transformFromJSON(map.currentValue) - FromJSON.basicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Transform.Object, right: (Map, Transform)) { - let (map, transform) = right - if map.mappingType == .toJSON { - let value: Transform.JSON? = transform.transformToJSON(left) - ToJSON.optionalBasicType(value, map: map) - } -} - - -/// Optional object of basic type with Transform -public func <- (left: inout Transform.Object?, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let value = transform.transformFromJSON(map.currentValue) - FromJSON.optionalBasicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Transform.Object?, right: (Map, Transform)) { - let (map, transform) = right - if map.mappingType == .toJSON { - let value: Transform.JSON? = transform.transformToJSON(left) - ToJSON.optionalBasicType(value, map: map) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped optional object of basic type with Transform -public func <- (left: inout Transform.Object!, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let value = transform.transformFromJSON(map.currentValue) - FromJSON.optionalBasicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} -#endif - -/// Array of Basic type with Transform -public func <- (left: inout [Transform.Object], right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let values = fromJSONArrayWithTransform(map.currentValue, transform: transform) - FromJSON.basicType(&left, object: values) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: [Transform.Object], right: (Map, Transform)) { - let (map, transform) = right - if map.mappingType == .toJSON{ - let values = toJSONArrayWithTransform(left, transform: transform) - ToJSON.optionalBasicType(values, map: map) - } -} - - -/// Optional array of Basic type with Transform -public func <- (left: inout [Transform.Object]?, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let values = fromJSONArrayWithTransform(map.currentValue, transform: transform) - FromJSON.optionalBasicType(&left, object: values) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: [Transform.Object]?, right: (Map, Transform)) { - let (map, transform) = right - if map.mappingType == .toJSON { - let values = toJSONArrayWithTransform(left, transform: transform) - ToJSON.optionalBasicType(values, map: map) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped optional array of Basic type with Transform -public func <- (left: inout [Transform.Object]!, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let values = fromJSONArrayWithTransform(map.currentValue, transform: transform) - FromJSON.optionalBasicType(&left, object: values) - case .toJSON: - left >>> right - default: () - } -} -#endif - -/// Dictionary of Basic type with Transform -public func <- (left: inout [String: Transform.Object], right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let values = fromJSONDictionaryWithTransform(map.currentValue, transform: transform) - FromJSON.basicType(&left, object: values) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: [String: Transform.Object], right: (Map, Transform)) { - let (map, transform) = right - if map.mappingType == . toJSON { - let values = toJSONDictionaryWithTransform(left, transform: transform) - ToJSON.optionalBasicType(values, map: map) - } -} - - -/// Optional dictionary of Basic type with Transform -public func <- (left: inout [String: Transform.Object]?, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let values = fromJSONDictionaryWithTransform(map.currentValue, transform: transform) - FromJSON.optionalBasicType(&left, object: values) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: [String: Transform.Object]?, right: (Map, Transform)) { - let (map, transform) = right - if map.mappingType == .toJSON { - let values = toJSONDictionaryWithTransform(left, transform: transform) - ToJSON.optionalBasicType(values, map: map) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped optional dictionary of Basic type with Transform -public func <- (left: inout [String: Transform.Object]!, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let values = fromJSONDictionaryWithTransform(map.currentValue, transform: transform) - FromJSON.optionalBasicType(&left, object: values) - case .toJSON: - left >>> right - default: () - } -} -#endif - -// MARK:- Transforms of Mappable Objects - - -/// Object conforming to Mappable that have transforms -public func <- (left: inout Transform.Object, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let value: Transform.Object? = transform.transformFromJSON(map.currentValue) - FromJSON.basicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Transform.Object, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .toJSON { - let value: Transform.JSON? = transform.transformToJSON(left) - ToJSON.optionalBasicType(value, map: map) - } -} - - -/// Optional Mappable objects that have transforms -public func <- (left: inout Transform.Object?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let value: Transform.Object? = transform.transformFromJSON(map.currentValue) - FromJSON.optionalBasicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Transform.Object?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .toJSON{ - let value: Transform.JSON? = transform.transformToJSON(left) - ToJSON.optionalBasicType(value, map: map) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped optional Mappable objects that have transforms -public func <- (left: inout Transform.Object!, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let value: Transform.Object? = transform.transformFromJSON(map.currentValue) - FromJSON.optionalBasicType(&left, object: value) - case .toJSON: - left >>> right - default: () - } -} -#endif - - -// MARK:- Dictionary of Mappable objects with a transform - Dictionary - -/// Dictionary of Mappable objects with a transform -public func <- (left: inout Dictionary, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .fromJSON && map.isKeyPresent, - let object = map.currentValue as? [String: Any] { - let value = fromJSONDictionaryWithTransform(object as Any?, transform: transform) ?? left - FromJSON.basicType(&left, object: value) - } else if map.mappingType == .toJSON { - left >>> right - } -} - -public func >>> (left: Dictionary, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .toJSON { - let value = toJSONDictionaryWithTransform(left, transform: transform) - ToJSON.basicType(value, map: map) - } -} - - -/// Optional Dictionary of Mappable object with a transform -public func <- (left: inout Dictionary?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .fromJSON && map.isKeyPresent, let object = map.currentValue as? [String : Any]{ - let value = fromJSONDictionaryWithTransform(object as Any?, transform: transform) ?? left - FromJSON.optionalBasicType(&left, object: value) - } else if map.mappingType == .toJSON { - left >>> right - } -} - -public func >>> (left: Dictionary?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .toJSON { - let value = toJSONDictionaryWithTransform(left, transform: transform) - ToJSON.optionalBasicType(value, map: map) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional Dictionary of Mappable object with a transform -public func <- (left: inout Dictionary!, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .fromJSON && map.isKeyPresent, let dictionary = map.currentValue as? [String : Any]{ - let transformedDictionary = fromJSONDictionaryWithTransform(dictionary as Any?, transform: transform) ?? left - FromJSON.optionalBasicType(&left, object: transformedDictionary) - } else if map.mappingType == .toJSON { - left >>> right - } -} -#endif - -/// Dictionary of Mappable objects with a transform -public func <- (left: inout Dictionary, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - - if let dictionary = map.currentValue as? [String : [Any]], map.mappingType == .fromJSON && map.isKeyPresent { - let transformedDictionary = dictionary.map { (arg: (key: String, values: [Any])) -> (String, [Transform.Object]) in - let (key, values) = arg - if let jsonArray = fromJSONArrayWithTransform(values, transform: transform) { - return (key, jsonArray) - } - if let leftValue = left[key] { - return (key, leftValue) - } - return (key, []) - } - - FromJSON.basicType(&left, object: transformedDictionary) - } else if map.mappingType == .toJSON { - left >>> right - } -} - -public func >>> (left: Dictionary, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - - if map.mappingType == .toJSON { - - let transformedDictionary = left.map { (arg: (key: String, value: [Transform.Object])) in - return (arg.key, toJSONArrayWithTransform(arg.value, transform: transform) ?? []) - } - - ToJSON.basicType(transformedDictionary, map: map) - } -} - - -/// Optional Dictionary of Mappable object with a transform -public func <- (left: inout Dictionary?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - - if let dictionary = map.currentValue as? [String : [Any]], map.mappingType == .fromJSON && map.isKeyPresent { - - let transformedDictionary = dictionary.map { (arg: (key: String, values: [Any])) -> (String, [Transform.Object]) in - let (key, values) = arg - if let jsonArray = fromJSONArrayWithTransform(values, transform: transform) { - return (key, jsonArray) - } - if let leftValue = left?[key] { - return (key, leftValue) - } - return (key, []) - } - - FromJSON.optionalBasicType(&left, object: transformedDictionary) - } else if map.mappingType == .toJSON { - left >>> right - } -} - -public func >>> (left: Dictionary?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - - if map.mappingType == .toJSON { - let transformedDictionary = left?.map { (arg: (key: String, values: [Transform.Object])) in - return (arg.key, toJSONArrayWithTransform(arg.values, transform: transform) ?? []) - } - - ToJSON.optionalBasicType(transformedDictionary, map: map) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional Dictionary of Mappable object with a transform -public func <- (left: inout Dictionary!, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - - if let dictionary = map.currentValue as? [String : [Any]], map.mappingType == .fromJSON && map.isKeyPresent { - let transformedDictionary = dictionary.map { (arg: (key: String, values: [Any])) -> (String, [Transform.Object]) in - let (key, values) = arg - if let jsonArray = fromJSONArrayWithTransform(values, transform: transform) { - return (key, jsonArray) - } - if let leftValue = left?[key] { - return (key, leftValue) - } - return (key, []) - } - FromJSON.optionalBasicType(&left, object: transformedDictionary) - } else if map.mappingType == .toJSON { - left >>> right - } -} -#endif - -// MARK:- Array of Mappable objects with transforms - Array - -/// Array of Mappable objects -public func <- (left: inout Array, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - if let transformedValues = fromJSONArrayWithTransform(map.currentValue, transform: transform) { - FromJSON.basicType(&left, object: transformedValues) - } - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Array, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .toJSON { - let transformedValues = toJSONArrayWithTransform(left, transform: transform) - ToJSON.optionalBasicType(transformedValues, map: map) - } -} - - -/// Optional array of Mappable objects -public func <- (left: inout Array?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let transformedValues = fromJSONArrayWithTransform(map.currentValue, transform: transform) - FromJSON.optionalBasicType(&left, object: transformedValues) - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Array?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .toJSON { - let transformedValues = toJSONArrayWithTransform(left, transform: transform) - ToJSON.optionalBasicType(transformedValues, map: map) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional array of Mappable objects -public func <- (left: inout Array!, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - let transformedValues = fromJSONArrayWithTransform(map.currentValue, transform: transform) - FromJSON.optionalBasicType(&left, object: transformedValues) - case .toJSON: - left >>> right - default: () - } -} -#endif - -// MARK:- Array of Array of objects - Array>> with transforms - -/// Array of Array of objects with transform -public func <- (left: inout [[Transform.Object]], right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .toJSON: - left >>> right - case .fromJSON where map.isKeyPresent: - guard let original2DArray = map.currentValue as? [[Any]] else { break } - #if swift(>=4.1) - let transformed2DArray = original2DArray.compactMap { values in - fromJSONArrayWithTransform(values as Any?, transform: transform) - } - #else - let transformed2DArray = original2DArray.flatMap { values in - fromJSONArrayWithTransform(values as Any?, transform: transform) - } - #endif - FromJSON.basicType(&left, object: transformed2DArray) - default: - break - } -} - -public func >>> (left: [[Transform.Object]], right: (Map, Transform)) { - let (map, transform) = right - if map.mappingType == .toJSON{ - #if swift(>=4.1) - let transformed2DArray = left.compactMap { values in - toJSONArrayWithTransform(values, transform: transform) - } - #else - let transformed2DArray = left.flatMap { values in - toJSONArrayWithTransform(values, transform: transform) - } - #endif - ToJSON.basicType(transformed2DArray, map: map) - } -} - -/// Optional array of array of objects with transform -public func <- (left: inout [[Transform.Object]]?, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .toJSON: - left >>> right - case .fromJSON where map.isKeyPresent: - guard let original2DArray = map.currentValue as? [[Any]] else { break } - #if swift(>=4.1) - let transformed2DArray = original2DArray.compactMap { values in - fromJSONArrayWithTransform(values as Any?, transform: transform) - } - #else - let transformed2DArray = original2DArray.flatMap { values in - fromJSONArrayWithTransform(values as Any?, transform: transform) - } - #endif - FromJSON.optionalBasicType(&left, object: transformed2DArray) - default: - break - } -} - -public func >>> (left: [[Transform.Object]]?, right: (Map, Transform)) { - let (map, transform) = right - if map.mappingType == .toJSON { - #if swift(>=4.1) - let transformed2DArray = left?.compactMap { values in - toJSONArrayWithTransform(values, transform: transform) - } - #else - let transformed2DArray = left?.flatMap { values in - toJSONArrayWithTransform(values, transform: transform) - } - #endif - ToJSON.optionalBasicType(transformed2DArray, map: map) - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional array of array of objects with transform -public func <- (left: inout [[Transform.Object]]!, right: (Map, Transform)) { - let (map, transform) = right - switch map.mappingType { - case .toJSON: - left >>> right - case .fromJSON where map.isKeyPresent: - guard let original2DArray = map.currentValue as? [[Any]] else { break } - #if swift(>=4.1) - let transformed2DArray = original2DArray.compactMap { values in - fromJSONArrayWithTransform(values as Any?, transform: transform) - } - #else - let transformed2DArray = original2DArray.flatMap { values in - fromJSONArrayWithTransform(values as Any?, transform: transform) - } - #endif - FromJSON.optionalBasicType(&left, object: transformed2DArray) - default: - break - } -} -#endif - -// MARK:- Set of Mappable objects with a transform - Set - -/// Set of Mappable objects with transform -public func <- (left: inout Set, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - if let transformedValues = fromJSONArrayWithTransform(map.currentValue, transform: transform) { - FromJSON.basicType(&left, object: Set(transformedValues)) - } - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Set, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .toJSON { - let transformedValues = toJSONArrayWithTransform(Array(left), transform: transform) - ToJSON.optionalBasicType(transformedValues, map: map) - } -} - - -/// Optional Set of Mappable objects with transform -public func <- (left: inout Set?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - if let transformedValues = fromJSONArrayWithTransform(map.currentValue, transform: transform) { - FromJSON.basicType(&left, object: Set(transformedValues)) - } - case .toJSON: - left >>> right - default: () - } -} - -public func >>> (left: Set?, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - if map.mappingType == .toJSON { - if let values = left { - let transformedValues = toJSONArrayWithTransform(Array(values), transform: transform) - ToJSON.optionalBasicType(transformedValues, map: map) - } - } -} - - -// Code targeting the Swift 4.1 compiler and below. -#if !(swift(>=4.1.50) || (swift(>=3.4) && !swift(>=4.0))) -/// Implicitly unwrapped Optional set of Mappable objects with transform -public func <- (left: inout Set!, right: (Map, Transform)) where Transform.Object: BaseMappable { - let (map, transform) = right - switch map.mappingType { - case .fromJSON where map.isKeyPresent: - if let transformedValues = fromJSONArrayWithTransform(map.currentValue, transform: transform) { - FromJSON.basicType(&left, object: Set(transformedValues)) - } - case .toJSON: - left >>> right - default: () - } -} -#endif - - -private func fromJSONArrayWithTransform(_ input: Any?, transform: Transform) -> [Transform.Object]? { - if let values = input as? [Any] { - #if swift(>=4.1) - return values.compactMap { value in - return transform.transformFromJSON(value) - } - #else - return values.flatMap { value in - return transform.transformFromJSON(value) - } - #endif - } else { - return nil - } -} - -private func fromJSONDictionaryWithTransform(_ input: Any?, transform: Transform) -> [String: Transform.Object]? { - if let values = input as? [String: Any] { - return values.filterMap { value in - return transform.transformFromJSON(value) - } - } else { - return nil - } -} - -private func toJSONArrayWithTransform(_ input: [Transform.Object]?, transform: Transform) -> [Transform.JSON]? { - #if swift(>=4.1) - return input?.compactMap { value in - return transform.transformToJSON(value) - } - #else - return input?.flatMap { value in - return transform.transformToJSON(value) - } - #endif -} - -private func toJSONDictionaryWithTransform(_ input: [String: Transform.Object]?, transform: Transform) -> [String: Transform.JSON]? { - return input?.filterMap { value in - return transform.transformToJSON(value) - } -} diff --git a/Example/Pods/ObjectMapper/Sources/URLTransform.swift b/Example/Pods/ObjectMapper/Sources/URLTransform.swift deleted file mode 100644 index 1e8bbb2..0000000 --- a/Example/Pods/ObjectMapper/Sources/URLTransform.swift +++ /dev/null @@ -1,67 +0,0 @@ -// -// URLTransform.swift -// ObjectMapper -// -// Created by Tristan Himmelman on 2014-10-27. -// -// The MIT License (MIT) -// -// Copyright (c) 2014-2018 Tristan Himmelman -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -open class URLTransform: TransformType { - public typealias Object = URL - public typealias JSON = String - private let shouldEncodeURLString: Bool - private let allowedCharacterSet: CharacterSet - - /** - Initializes the URLTransform with an option to encode URL strings before converting them to an NSURL - - parameter shouldEncodeUrlString: when true (the default) the string is encoded before passing - to `NSURL(string:)` - - returns: an initialized transformer - */ - public init(shouldEncodeURLString: Bool = false, allowedCharacterSet: CharacterSet = .urlQueryAllowed) { - self.shouldEncodeURLString = shouldEncodeURLString - self.allowedCharacterSet = allowedCharacterSet - } - - open func transformFromJSON(_ value: Any?) -> URL? { - guard let URLString = value as? String else { return nil } - - if !shouldEncodeURLString { - return URL(string: URLString) - } - - guard let escapedURLString = URLString.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) else { - return nil - } - return URL(string: escapedURLString) - } - - open func transformToJSON(_ value: URL?) -> String? { - if let URL = value { - return URL.absoluteString - } - return nil - } -} diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj index cbd4b0a..4ecd5a6 100644 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ b/Example/Pods/Pods.xcodeproj/project.pbxproj @@ -7,176 +7,138 @@ objects = { /* Begin PBXBuildFile section */ - 059603888075C317971A67A7C0FB2BDF /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2ED549F2DC83D7271F7248E4203429D /* Alamofire.framework */; }; - 09369883A939A86D0CF866C9B1EB8949 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF4095683BE4B1801975A55A61E5B7F0 /* Alamofire.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0B021AA17DA9CBC92077C157DF57E77B /* ConstraintViewDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D743022554B904DB53D6D96B5FE07DE /* ConstraintViewDSL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0B9136E10A10E7DA166FA1C0FE890F41 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - 0D247B7FD6BED62EBAF48C603546DA07 /* TransformType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 889BE315DB67139197F28DE8EE3EA85E /* TransformType.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 0FA6F9EC9EB5F24D5A0F3EC6EB9BDCE5 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F07FD18089A35DE6118D46AB7E6F7F18 /* Logger.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 11D765699D13EE4F7841BE90CCDB9665 /* Operators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7D45D5CA2893A723C5794147D5D7C234 /* Operators.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 128AC72A989601909F66C3AD1432C4FF /* TransformOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ABD412A2CE4610A79D769C19A679B54 /* TransformOf.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 135FC69E1ACBD7025512F5DCC3AD4D18 /* SnapKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 502FA0459DB306676EA5C3AC16180CEC /* SnapKit-dummy.m */; }; - 13C8B217548B98BCB136AD0041012564 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D380DFD0564A547FC5E66CC2CF9BFAE /* QuartzCore.framework */; }; - 14769964BF0934257E5F4D4DE4BF16AF /* GrowingNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91170D0D82346FEAAE80B9ACB43605FB /* GrowingNotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 18F9908A2D8E6C39FC8D5C1A3643CAFC /* ImmutableMappable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4625CFB5ACA5BED57DE31FA8792AB3B /* ImmutableMappable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1AC1B5A4591A55BFEC6F1C05BD2C1848 /* ConstraintLayoutGuideDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD8C3CD55330C65364B75B93B4C1D593 /* ConstraintLayoutGuideDSL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1B2CD16C2E2412DD05858D636E3EA7E4 /* Mappable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D4000709A234FE95C6100354C477D9C /* Mappable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 1E0DC649FBD5FA1F86F475FFEF6A20F2 /* Map.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12BD10D79C2941FD5FD486410D0E967C /* Map.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 240B9397F73CCBDC537707F9BC7A4511 /* SessionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA085235155CEF376BABD3F403DAF7AB /* SessionDelegate.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 2541DCFE54659B7358851A7665305624 /* NotificationBannerSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 73D9C1055852F66228AB9326A79C080A /* NotificationBannerSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 273CB7A7349BDB62173F968C76110477 /* URLTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = AD7F209A66EA00AAF392E29CB39BD904 /* URLTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 2C71E600BF6EA544657D89DCA69BDF12 /* KeyboardSpy-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 40F3B470948ED264367161413642731F /* KeyboardSpy-dummy.m */; }; - 2D466CE6D91A39E651FA6AF708A2A801 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = A7D18E457963DABA37CD5D647FAE7C36 /* Request.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 2E4D58BEA2CF406C1A4D98E060D68590 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 213473CEED915F00E1E1D33310005755 /* Constraint.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 2E5D0257EA23FF768A14A3A4BBAFDF81 /* AlamofireObjectMapper-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4A09B1B0A8C8715314A862FC4166D810 /* AlamofireObjectMapper-dummy.m */; }; - 2F79E24F8855CF12C6D8620A822CF1A4 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFC3391A4077A38A410CB2627D53B321 /* LayoutConstraint.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 3103F0EB03335F8873ED5F3FF65032F0 /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67BF0D5DAA70A1AD94EB205FAE70B317 /* Validation.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 33E1D1AABC1408623B60017EB8DA0A88 /* ObjectMapper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03F596D751854D9A88DEECC4DB3B25EE /* ObjectMapper.framework */; }; - 34DB8EDA1994BEEF50E1D933EB94E5C4 /* UILayoutSupport+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19ED65590817E36BDEDD34B9B0AC9C90 /* UILayoutSupport+Extensions.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 36E1FA5F1473B0D592F43119FA2B3A54 /* ConstraintInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15DF2C5C4F93FAC0BEDC802D5571EB01 /* ConstraintInsets.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 38E557B68266D46E019E2665C4253AD4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - 3BD1DAFE1F3E6C9E4EB0F2099B6D6FA2 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - 3F6499E5F107B36B9182812E6D84E249 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C854944A3178BECC85F96DF60B5A97C /* ConstraintAttributes.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4120A26D8D88F114F055992A95780044 /* ConstraintRelatableTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A2CCF4B0FDDD6AFECE7B89C04ED1BC1 /* ConstraintRelatableTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4131149580995BD1D66C6221F487A3C3 /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 215BA8533A0B8E711D2ED5D6CAEB4976 /* SessionManager.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 44CE3D3E22CCACC25495483A36369083 /* TransformOperators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7CE34DCFFE8DFC5406F8A0085D9796CC /* TransformOperators.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 468DB129E24F8911C86272113D7E39A5 /* ObjectMapper-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 7ABE886E4AED9D9563F58D8D809528F0 /* ObjectMapper-dummy.m */; }; - 478AAF7EA0166849EF449F07A6ADFD81 /* EnumOperators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 120E6520780E7D6BAE90F463496F4B1D /* EnumOperators.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 48D76E7DEA0D816C77F74C11FF345292 /* ConstraintInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 218CC958A08B26670CEC3CD51D393A1E /* ConstraintInsetTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4BAA24B44DEEED0F2A0495294C368681 /* KeyboardSpy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D60FA77F919260DA1DCB14B39FE2723 /* KeyboardSpy.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4BB302C988FDA9068F589E4043DA1EB0 /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8AADAE9F2E0623E45F7E8D913D2A1F2 /* ConstraintDescription.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 4BB67062EAFFC7225D299DAB6E200AC9 /* NotificationBannerUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05F5E2395B4C5AF3CBD0A299EB85885 /* NotificationBannerUtilities.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 51AC4C9BF88335DACA79A8676E5677E4 /* AlamofireObjectMapper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DBB9F96850DA4C60CBBBE8F92C4AB2D4 /* AlamofireObjectMapper.framework */; }; - 51C5B72D5FEBE2BBCC761A51F40B7FE7 /* LayoutConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 347258D7DA6785927BD639C7C9D2F71B /* LayoutConstraintItem.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5257F96980C8CE0C6ADA232B77F7E90F /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = B36DCA6D3FEC23F74CA24DFA55397071 /* ParameterEncoding.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 526327495E48CA8365453E36B8888D69 /* BaseNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B96C90A9FAD16EF903E40FCCAD8BF77 /* BaseNotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 54D1DCC8C0DFC0E625E4B3688C341254 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A3B55314B211B6C48BA67549D43E648 /* ConstraintRelation.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 55F98A0A870E144230E80800B7F3BA82 /* ConstraintMakerExtendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0217D4E44FD6D154FA86624AA141EA0F /* ConstraintMakerExtendable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5709F35927410DCDA55DAB801A78D269 /* HexColorTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C44B4FFFE68FB353B418C1D1F3AA286 /* HexColorTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 577E5F5BCBB982A7C59A890BF3F58586 /* ConstraintMakerFinalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01FD9852175271ADCA1150DE380023C4 /* ConstraintMakerFinalizable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5B3C54D6CA47E67D0173D4998D5DA84D /* Alamofire-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = AF65D5D1A361F18FCC13B0A56F7B2E99 /* Alamofire-dummy.m */; }; - 5BE0B7718D339AA8D5A2B80E11C63C34 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8E995C812F4E1BD0F13AD692C753A7F /* ConstraintItem.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5CE53D704C4411A43519453A2B0FEBD0 /* MarqueeLabel-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9D29A87D83FC11AA2BDEA81C29032568 /* MarqueeLabel-dummy.m */; }; - 5CEC69E2962550BE91F896D479DE14F9 /* ErrorParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD884B1BA395376837A41FB973CFB1CC /* ErrorParser.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 5F7A920C16F1850B1AFC8B4A156E6B30 /* BannerStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49B0E203D2CB9BC96D32F2533B6A7C60 /* BannerStyle.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 624FD1983268AE270F4BC36B87F2B979 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - 62B8346B755FFBB016CC6915C4325988 /* KeyboardSpyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADD50A84B921BBE457CBCF258725924C /* KeyboardSpyEvent.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 68014529230EDFDFD7724AC15E13D040 /* DictionaryTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53E25871E7E7C63F40D17552F3FBBF1B /* DictionaryTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 688A27C4A5EE5C40D06A8393342FEA1D /* MarqueeLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3AB196CC8CDB0DEB8E55829816F036 /* MarqueeLabel.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6916D7F8F2EE48F19DC372A32580D395 /* ConstraintMultiplierTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 215F4A1A28905320E0ADB77A7787C9A5 /* ConstraintMultiplierTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6993D9E5806AA1ABC6229B8B4B581F5F /* StatusBarNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 350CD04A3950CF96F1A71B563729300B /* StatusBarNotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6A1D16C78B32AD0993396A6852C71C24 /* FromJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 878B8CDDDB7926F2F8A086B522184741 /* FromJSON.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6B6F69F37AAD16D071110F09CDB75ED7 /* CustomDateFormatTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 834EBA9325A3892E960FB4D4D8E6EFF5 /* CustomDateFormatTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6C67ECEE4ED460363BAFE74AB179EBB5 /* ConstraintView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9835856025CD11E340D3151D91023A02 /* ConstraintView.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6D21E85E2F294A2E98CE208994D771A3 /* KeyboardSpyAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EB07032E89A248B14916C89DDB22ECD /* KeyboardSpyAgent.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 6D520D65677B87148A8CDC37DD13E820 /* Pods-AlamoRecord_Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = EFE517016DE8687C521833DCD3C9E95D /* Pods-AlamoRecord_Example-dummy.m */; }; - 6FC2ADC124763EAFAB7D61ADF999A7A0 /* DateFormatterTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0C8618C93771E9A1AA2EDBE48610178 /* DateFormatterTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 72AF4608332F7A1FCE35669472E7298C /* ConstraintConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19FC9C238EC1BDDD89A0CD6F0EB9673B /* ConstraintConfig.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7365FD63A89D0F66C595256355900917 /* TaskDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 57809E061BA8111EDBEB220FC9A7D48B /* TaskDelegate.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 74E569542E9D2017B93F8CC845F24279 /* IntegerOperators.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35F5DF9E484E7CE93CF13A6BC13CAAF2 /* IntegerOperators.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7649867BFAD63534C91B7A24D8D85E37 /* ConstraintMakerPriortizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD75853B729C60DCBFBCAFD14F7C1AD2 /* ConstraintMakerPriortizable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 776CBDB8B1100437E5A2AA7CF7866A84 /* ConstraintOffsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79415C4C5B2D92AAAFA0E7C01814EB70 /* ConstraintOffsetTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7BAC6FBA74ADD8B40C958B4426109025 /* BannerColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40F141EB436A5E0EEB7EA65C506FBA71 /* BannerColors.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7BB395EF9D22A22878D12CC5F48D672D /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DF64894ACEA05955EB6E75AC8FC4782 /* Configuration.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7D4D4839D07AB54F5CA28644E5E79627 /* StatusCodeObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF1A077B0BDBCE1A817FE9245E2C1F52 /* StatusCodeObserver.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7E2EE91BAAC0B7D8F87A5D5CA36A1CD8 /* ToJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = C635984B8203FAA3A909B63E32665EB3 /* ToJSON.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 7F424C046646FE578B5BAA8AE3D30B37 /* ObjectMapper-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B8EFBCA05FE1ED8D779987AF49E50ECC /* ObjectMapper-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 816D8F658A00AB47546F72A655192183 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FD9498CD966C40ACE474014B5FA8827 /* Result.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8286D921D81F7BA1AEDB7185194EDC9A /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = B19ADE34DFB1592D54754675C372696F /* MultipartFormData.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 83563CCFC4B57D52A80ADFDB1C230A18 /* MapError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 248D024518D93C44D684C704E3DF3551 /* MapError.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8585189D0D8BF1302138ACCA1D8D8A41 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54F2AAD28B4E8678FA824C9C88B42268 /* Notifications.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8801AA0C35B8E76FF5DB7B2AA981F31F /* ConstraintView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82B4E664058041A39A467472B49D0C11 /* ConstraintView+Extensions.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 88A4088D8C257A8BE746CF24C0A1744E /* NSDecimalNumberTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85B520A451A17AE070F501795A29701B /* NSDecimalNumberTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8BCA376227BE1036BAAFECFA17168D12 /* AlamoRecord-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 89586C9B12A6F87300EF9022A1DBF4A2 /* AlamoRecord-dummy.m */; }; - 8C82A0DC43F539E8961EE089DA2F55E2 /* AFError.swift in Sources */ = {isa = PBXBuildFile; fileRef = CF16D951E2E0F7C5432D492AA3B26FCA /* AFError.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 8ED7180B604220170DC67B3ED0B70BEE /* KeyboardSpy-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = A56D622E916F305372A8469BBE973080 /* KeyboardSpy-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8FE805A0D70DA7D5E6E3CABCD1C6B5D1 /* NotificationBannerQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = CB2CE8655B78FBE06EAE5AE478C31629 /* NotificationBannerQueue.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 90106EE3BC220C98588CBAFF58653E78 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - 91BC535DF58D2F455A324FA1127F65E0 /* ConstraintLayoutSupportDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06EAA2C50CB99C7BB54B80AFEFB0343D /* ConstraintLayoutSupportDSL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 91F3F7D589783AE987010E227E834E5F /* Pods-Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 53C1CDF96E28F28662FF63B765603155 /* Pods-Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 923CBFAF954C3EF1CAFE2CB889BA0D8D /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = E282E4DBF370859C58A6438BA4C3BC02 /* ConstraintMaker.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 92CCCBD96B5F5D72AA0B53D1BE28B3E3 /* CodableTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 604CB73BB684B1F25C88E9569C7726AE /* CodableTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9302420D70925404A685B89EFEEF0B7C /* ConstraintMakerRelatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F617C72E2FD384977701BFBDD1E9FEDF /* ConstraintMakerRelatable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 93B86E7677061308E5D602D4AE89BAF2 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69FC850F7C80DDAB589A4B8A5DF9DC9B /* Response.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 980501A2BF77B6BD654CB772CA83F666 /* NetworkReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67F8332AA591F533B8673805D8BC2BE4 /* NetworkReachabilityManager.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9CB583D9D590B393ECFC9E118EF4103E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - 9E5D5307045ACAB8BF8B00D9EC1E1FB5 /* EnumTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA52B3307CF62B01DF8E9DFB2867F19E /* EnumTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - 9F84A9A143208A92A0E18634F79A9760 /* AlamoRecordURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC8E2B4D3AD57569286DD16552BD0C83 /* AlamoRecordURL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A07426CA7EF6005C0AFB98CB1CAF0671 /* NotificationBannerSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B888E9C9B01157570AF470F8F7F6FE9E /* NotificationBannerSwift-dummy.m */; }; - A2EE7BD0527B779A4C6D48D49506C096 /* KeyboardSpyInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B5F3712C37711504C196B96782E90F8 /* KeyboardSpyInfo.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A5A98B80EC8040F404F7343DCA04899E /* Pods-AlamoRecord_Example-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 7183091987FEC8671A8513179D0E71FB /* Pods-AlamoRecord_Example-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A5B000E9E3FEEF484B648C0D67FA4096 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - A768F04AB851C803302081712B9C53E7 /* SnapKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 5AC247E17A2026CA741ECD52FB64934B /* SnapKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A92754E90015E38811C73AD647E5C907 /* String+heightForConstrainedWidth.swift in Sources */ = {isa = PBXBuildFile; fileRef = B09EAB01E5527FA2B0B7E57EB1F11FEE /* String+heightForConstrainedWidth.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - A9951E52505B7BCF234447B3FF2BFD4E /* AlamoRecordObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = E51119BAD1E76F2E29C7A19160D43C96 /* AlamoRecordObject.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - AA0AB9037F22C4EA9B3E712A0FE43F2E /* Mapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BDD7C4C5E90E9D5251990602B523979 /* Mapper.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - ADB5DE14557FC95AB23882D410B3D780 /* MarqueeLabel-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = BD47D8174DE77276132CC0E7A948C50D /* MarqueeLabel-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B26DBECE911AB60775C6BE6FC6F7B5FE /* AlamofireObjectMapper-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 413AA55CD5838B72D4B36F93C9D4E6CB /* AlamofireObjectMapper-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B6F6E4CC26451E91B59FAE0F6841DC1F /* Alamofire-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 8BD87D48DDA20716B8343C140F9007E5 /* Alamofire-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B776E5CD55DECFD9A8C70AA90C2740F0 /* Pods-Tests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 36583CA7365A6914C1C4B978D1E6B569 /* Pods-Tests-dummy.m */; }; - BACE6027F99455BB5F98BBE44178947A /* BannerHapticGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2705CA753350F7A3A3C056FF3D39B85 /* BannerHapticGenerator.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - BB46766B47C42F0E3443528D3B3CD5EC /* ISO8601DateTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = B752F09AF6041F71FD1FB78C94B801D0 /* ISO8601DateTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - BE5297501015DF5CDDBA5078F897717C /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84AF4FC5BA5B58C3B1706C9A9607523E /* ConstraintLayoutSupport.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - BE8738060AFD20EFF41C849849CA16AE /* NotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54547DB6EFF6814C1C1EB771BAFB7982 /* NotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - BFDD253057221EAD2A53C62928952315 /* ServerTrustPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0A9E80D43C77A5DCA464A3A588E53F6 /* ServerTrustPolicy.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - BFE99DF0D5D49A93F430809099212374 /* AlamofireObjectMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B9CC806A2B102540A8998EFF9BB69F /* AlamofireObjectMapper.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C2CC3C527B195FD3E7146FB8446F8937 /* Typealiases.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1AE9BB049C5EE2D232F3131DA9FA3AA /* Typealiases.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C430739EC649DC30911FBB7EDB5C3532 /* ConstraintDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3873D7DB4EDC42629767800FC7D325D /* ConstraintDSL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C859C9A20A147CFA0AADE2939E5D29CA /* ConstraintLayoutGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = F183E50C6F582180944249C26B3976CE /* ConstraintLayoutGuide.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - C8E9E4A08330E4931C61EDD3527B6E2C /* MarqueeLabel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 709570AF6AF07CD37295DE6BEBFEC138 /* MarqueeLabel.framework */; }; - CA4352B50BE1D4CD042CFE6FCDBC6E1C /* AlamoRecord-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = DE392E429D3AA0CAF8BA64B3AC9811E0 /* AlamoRecord-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - CD36A84C0278E53667C6D327BA0A30C1 /* DateTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 42CB33DD49381C039CB689ED77B97858 /* DateTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - CE5ADC801A12F82D243089EB47F762E6 /* ConstraintConstantTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8264135DF2820C0D1A7F533C48D2A300 /* ConstraintConstantTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D0A28826916584B0ED2DD4F43C1146D8 /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C232CE1D829CB367E4CC353D1B55649 /* ResponseSerialization.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D22F6F9872046E3D6229D897C34379CC /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DCF610A7F46279C67770D6B6283819CE /* SnapKit.framework */; }; - D294198C5D62E94BDDDF4493EEEB5CB6 /* ConstraintPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E0BD13787623254480353B4BDA81F84 /* ConstraintPriority.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D2DCBAE3FDB8ECF9C08FC064D55FEC08 /* ConstraintLayoutGuide+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 815285991858A8A97BE0FF81659A6728 /* ConstraintLayoutGuide+Extensions.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D5C01B53FB609BA73E5DE4C9CCFBAA60 /* AlamoRecordError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D557EB749A1A3921A51C7E1D4DA5918F /* AlamoRecordError.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D5F8FAAE8F3C7C369577BCC97F37F06A /* BannerPositionFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B690DC94AB97C77B5ED24EA73A8032F /* BannerPositionFrame.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D5FB191F50ED4A2CC9FA653F283BCD73 /* ConstraintPriorityTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 449904D2F47AF0F10B2900948BAED969 /* ConstraintPriorityTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D654F916111BBECF57D0502292D2461A /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = B32975EC2DA5CDFF49C6DE8068A3AADC /* Timeline.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - D9A82B7E7A06E0C9FC9AEA559A284C59 /* RequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1F921D7DE3CF3D1E50CBBDEED6B8E56 /* RequestManager.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - DE55962F75288607CD2183F80A4D223B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - E032556821E68D1E28F2C419673CEE74 /* RequestObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 000B3CE708AC831445FC177F077E7017 /* RequestObserver.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E079BF566EA598A2FD56F90A3CD0C919 /* FloatGrowingNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3354E9B4F2223F341FAE9019BDC3CD16 /* FloatGrowingNotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E238ECE58D1AF1FCF69950893C49D779 /* DataTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0519FD2FE223D95E52D3D1C2ABD1760E /* DataTransform.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - E6F0911747D36BB05B096E3C8E0A11D7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - F1B43076C5E4AA3100AF90E970127D82 /* DispatchQueue+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = C06E24A668380282906EC2ECD2644E1A /* DispatchQueue+Alamofire.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - F62A1BBFD9D414C079B5A05217D339B4 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 10AD5C92C89277A1340FFDC2E6A7A366 /* Debugging.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - FE25336B0EEEA765D1EB65ADEA78BADE /* ConstraintMakerEditable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 934B334C0600030B89197A60A6DBA675 /* ConstraintMakerEditable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; - FE7D96EB49017B0BAB2689163B375DD6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */; }; - FF2F28C178B59EFF56879D29B0C71914 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BFA1879B516ACCA6863CEB33CE6D912 /* UIKit.framework */; }; + 01907C3A3A223653627706943E5895D0 /* HTTPHeaders.swift in Sources */ = {isa = PBXBuildFile; fileRef = A460B75FFEB80630A1623154DE748597 /* HTTPHeaders.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 027EC92D039E77EAB5AFEDFBBBB34D3D /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F793A0808A70024D4C7FC2288EF1E956 /* Validation.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 08755CA56AE42CD2CD3E216445C1FC45 /* URLRequest+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F99929244F997A21EAC8303B4E93094 /* URLRequest+Alamofire.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 0B021AA17DA9CBC92077C157DF57E77B /* ConstraintViewDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBD0960156B56BC727589993C13DBEC3 /* ConstraintViewDSL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 0B9136E10A10E7DA166FA1C0FE890F41 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */; }; + 12075157A00AEB436B81EE7F30A39ED4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */; }; + 135FC69E1ACBD7025512F5DCC3AD4D18 /* SnapKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 77ED7240D64B124AE1D8F28CCE7DF194 /* SnapKit-dummy.m */; }; + 13C8B217548B98BCB136AD0041012564 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 98A295464AAFAEA2CFDFC1DDF82CB4F6 /* QuartzCore.framework */; }; + 14769964BF0934257E5F4D4DE4BF16AF /* GrowingNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = A90B7AAA69FC35875CF5FF5BDBC18939 /* GrowingNotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 19179A8F8D87C14E7BA6E9C4BCC55597 /* RetryPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E9E0CB2C5FFD1DACC42E19AA5077AD /* RetryPolicy.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 1AC1B5A4591A55BFEC6F1C05BD2C1848 /* ConstraintLayoutGuideDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D8008F9E47E8C19C60843442C6F816C /* ConstraintLayoutGuideDSL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 1D6AE6A3D8A7FA6EF92115C54F890005 /* MultipartUpload.swift in Sources */ = {isa = PBXBuildFile; fileRef = 504AFD1E039AE867356420B7C0C901AE /* MultipartUpload.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 23EB8B918358CDCB6D706260FC86DFC3 /* AFError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 004611CCBC80B2CA56C6332A34A7572F /* AFError.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 2541DCFE54659B7358851A7665305624 /* NotificationBannerSwift-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 396D47EB931C6DD614374085781269F0 /* NotificationBannerSwift-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 27D0949C74708133B627E26C9FCF3D8D /* RedirectHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2F9C762E1170660BCF5158E17B1D99F7 /* RedirectHandler.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 2A8C8063FC1F201FCA0B5E0B577D4FC3 /* Pods-Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 53C1CDF96E28F28662FF63B765603155 /* Pods-Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2C71E600BF6EA544657D89DCA69BDF12 /* KeyboardSpy-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 58CAD67C11D4BE3082C0836E2E4991AF /* KeyboardSpy-dummy.m */; }; + 2E4D58BEA2CF406C1A4D98E060D68590 /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 16CF02F87A36E46ECDD43D8DD58F3B7F /* Constraint.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 2EA94D2AE23D0AC4E4FC62741B99FA43 /* ErrorParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD884B1BA395376837A41FB973CFB1CC /* ErrorParser.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 2F79E24F8855CF12C6D8620A822CF1A4 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = F628D9D43D46FDB435702F512C8803CC /* LayoutConstraint.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 32A85E3C69C4559570F707C9ABFB6703 /* Alamofire-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = FC7CA066C5B4E667A5FD1641C791E2D1 /* Alamofire-dummy.m */; }; + 34DB8EDA1994BEEF50E1D933EB94E5C4 /* UILayoutSupport+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 609C148640B607967069037F0257FF87 /* UILayoutSupport+Extensions.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 35FE5051FB07D565FFCB80244B058781 /* ParameterEncoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4D57C435AFC6D6A2C0414A90DE35E807 /* ParameterEncoder.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 36D5F871078F7FEC0EDF01FF9709E69B /* AlamoRecordObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = E51119BAD1E76F2E29C7A19160D43C96 /* AlamoRecordObject.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 36E1FA5F1473B0D592F43119FA2B3A54 /* ConstraintInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74C884E2E496CE031A23390B8BF5FC29 /* ConstraintInsets.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 3711F5371EF1265C4391EF9FF7DB7CF7 /* Pods-Tests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 36583CA7365A6914C1C4B978D1E6B569 /* Pods-Tests-dummy.m */; }; + 3CC3D0938A90AA4B51A9D8DDC9747AAB /* StatusCodeObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF1A077B0BDBCE1A817FE9245E2C1F52 /* StatusCodeObserver.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 3F6499E5F107B36B9182812E6D84E249 /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E413280AE0E8ADED713332CD2DDD658 /* ConstraintAttributes.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 4120A26D8D88F114F055992A95780044 /* ConstraintRelatableTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = B56580985349C472B7F212E3A19D9037 /* ConstraintRelatableTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 48D76E7DEA0D816C77F74C11FF345292 /* ConstraintInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D8D92F0294BA4AD00EDE414BB598FD /* ConstraintInsetTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 4BAA24B44DEEED0F2A0495294C368681 /* KeyboardSpy.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20E275A0C2C8BE1F72C5AB5A3DF2E01 /* KeyboardSpy.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 4BB302C988FDA9068F589E4043DA1EB0 /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93BA652A42056B71DA77D37706DADC11 /* ConstraintDescription.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 4BB67062EAFFC7225D299DAB6E200AC9 /* NotificationBannerUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = B2E99AEA748448495DDBA0170EAF2062 /* NotificationBannerUtilities.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 4F103671FF7EA9545B6F5A5FF8353342 /* DispatchQueue+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87B25B4C74539EC55678005AAC0EBE6B /* DispatchQueue+Alamofire.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 4FBC5A490611446DFBCC87B962B652B8 /* SessionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08B29434B60C2153F9CB8D18D3378D64 /* SessionDelegate.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 51C5B72D5FEBE2BBCC761A51F40B7FE7 /* LayoutConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = C593B5B4795FC32FE77C9494DC1AFDF2 /* LayoutConstraintItem.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 526327495E48CA8365453E36B8888D69 /* BaseNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 48128FA83E630C1AAF5EFA6CBE6808C5 /* BaseNotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 54D1DCC8C0DFC0E625E4B3688C341254 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E435E79679D782C7FF34B720ADE2E7D /* ConstraintRelation.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 55F98A0A870E144230E80800B7F3BA82 /* ConstraintMakerExtendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67CA5B78FEC6356D234976FECF5E2F15 /* ConstraintMakerExtendable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 577E5F5BCBB982A7C59A890BF3F58586 /* ConstraintMakerFinalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D8CC7ECCC21AE66487E086A4F165628 /* ConstraintMakerFinalizable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 5853C42A153F9AB0AD190F0753EFEEA3 /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DD85328FAA744087DE8172FB2929E95 /* ParameterEncoding.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 5A6C1D01381312B8767F41323A0184A9 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5108FE68F99DA272BA99E7D5239A48F /* Request.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 5AE63CB0AA6A6DC105546845ED0ED9B1 /* AFResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = C147AE9895A70067E1E947FE38E6765C /* AFResult.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 5B29BB548683F730FAFC03374C5169D9 /* AlamoRecordURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FC8E2B4D3AD57569286DD16552BD0C83 /* AlamoRecordURL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 5B6F87C78BC3CE0BC26B2A04FB4BC6FD /* RequestInterceptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24ED80356652F7DBB5EBAB5E448F5AA6 /* RequestInterceptor.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 5BE0B7718D339AA8D5A2B80E11C63C34 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14A366C85D07348A356D5F0A794ACFB5 /* ConstraintItem.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 5C25BD0622A9EFF50074320C /* AlamoRecordDecoder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C25BD0522A9EFF50074320C /* AlamoRecordDecoder.swift */; }; + 5CE53D704C4411A43519453A2B0FEBD0 /* MarqueeLabel-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 522C37FDB9C31E8C74FFC3ECFEBEA366 /* MarqueeLabel-dummy.m */; }; + 5E0B3AF5D479EDF7F942FD7D9968B7E0 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = FCD1538074F7FDA9A4C4441E048A681E /* Alamofire.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 5F7A920C16F1850B1AFC8B4A156E6B30 /* BannerStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = F53CBCED9B997C0E6EA9B4F1670141B6 /* BannerStyle.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 624FD1983268AE270F4BC36B87F2B979 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */; }; + 62B8346B755FFBB016CC6915C4325988 /* KeyboardSpyEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = A08376A79D718A23EFEA405F28F2C8CD /* KeyboardSpyEvent.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 637FDC0C3BE62D55482CE613023DB3D0 /* RequestManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1F921D7DE3CF3D1E50CBBDEED6B8E56 /* RequestManager.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 65F9482829E46B30BDEE8B5090A51777 /* AlamoRecord-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 89586C9B12A6F87300EF9022A1DBF4A2 /* AlamoRecord-dummy.m */; }; + 688A27C4A5EE5C40D06A8393342FEA1D /* MarqueeLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ABF6902831972177036147ECE4CBBC9 /* MarqueeLabel.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 6916D7F8F2EE48F19DC372A32580D395 /* ConstraintMultiplierTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14C3DBF105A194B9ECAFCB685F5F5EE2 /* ConstraintMultiplierTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 6993D9E5806AA1ABC6229B8B4B581F5F /* StatusBarNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9059F1FD35488CAC45F8D01AD9023A2F /* StatusBarNotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 6C67ECEE4ED460363BAFE74AB179EBB5 /* ConstraintView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0056561A2CAB37A70D162D1C7AAB1C14 /* ConstraintView.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 6D21E85E2F294A2E98CE208994D771A3 /* KeyboardSpyAgent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3926B1C95CFAFA1E703331173F4CF3E6 /* KeyboardSpyAgent.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 72AF4608332F7A1FCE35669472E7298C /* ConstraintConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A08E4AC23A6E9CAF23CDE3F5764F162 /* ConstraintConfig.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 7649867BFAD63534C91B7A24D8D85E37 /* ConstraintMakerPriortizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = DFEAD6F7A97F87822ED3027B2C0C5943 /* ConstraintMakerPriortizable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 776CBDB8B1100437E5A2AA7CF7866A84 /* ConstraintOffsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDCED1B6F3A0CDB234906438635F1C04 /* ConstraintOffsetTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 7770A0F6A39A762E6C8B7FF01C9E24F5 /* Pods-AlamoRecord_Example-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 7183091987FEC8671A8513179D0E71FB /* Pods-AlamoRecord_Example-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 7BAC6FBA74ADD8B40C958B4426109025 /* BannerColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD5F14B4C61B0E45B4EA0709991EE207 /* BannerColors.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 7EBD112DDEBE9E67BA288AC55EC8D687 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65D6DDA179FD4D65C1F64C7C8BC6F949 /* Response.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 82DC01AE7CF12FD4F8CF928B86DD4BB3 /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 053CACA91F2E751BFAD8722331559429 /* EventMonitor.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 86220456689EC309DB8E7BA1D3A66477 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */; }; + 8801AA0C35B8E76FF5DB7B2AA981F31F /* ConstraintView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B204DFACB00A11293713845A654AFDFF /* ConstraintView+Extensions.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 8ED7180B604220170DC67B3ED0B70BEE /* KeyboardSpy-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = EA692E121C536F3A533B162086769302 /* KeyboardSpy-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 8FE805A0D70DA7D5E6E3CABCD1C6B5D1 /* NotificationBannerQueue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A5BFAF622177BEB6FDA7EF32B2380BC /* NotificationBannerQueue.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 91BC535DF58D2F455A324FA1127F65E0 /* ConstraintLayoutSupportDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EEC2E3441BA4E4D9233CB984CC4B6EB /* ConstraintLayoutSupportDSL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 923CBFAF954C3EF1CAFE2CB889BA0D8D /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBE9236D0F7491CB6DB9998F1BD8B3E4 /* ConstraintMaker.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 9302420D70925404A685B89EFEEF0B7C /* ConstraintMakerRelatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B4B657FF97F9EF9CB2C5CDD8A544229 /* ConstraintMakerRelatable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + 9B60C9CBC40ECB22D74D2C4BBC3BCE20 /* URLSessionConfiguration+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82BFF4D561F3AF63B807BCAAC63926CD /* URLSessionConfiguration+Alamofire.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + A00C32320D2AAEC9039307A430CBCB1F /* URLConvertible+URLRequestConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25CC63271DAB30A19EC738FD14C062D7 /* URLConvertible+URLRequestConvertible.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + A07426CA7EF6005C0AFB98CB1CAF0671 /* NotificationBannerSwift-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8ED6CC6028EDA486E4998BB7EBAF4052 /* NotificationBannerSwift-dummy.m */; }; + A2EE7BD0527B779A4C6D48D49506C096 /* KeyboardSpyInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 424992F538A848EBE1A36CFA06BEA98A /* KeyboardSpyInfo.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + A507F1125986B30B7BAC14F4123017E9 /* RequestObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 000B3CE708AC831445FC177F077E7017 /* RequestObserver.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + A5B000E9E3FEEF484B648C0D67FA4096 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */; }; + A768F04AB851C803302081712B9C53E7 /* SnapKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6546EB52BBCCC8095ED60BDB9711BF51 /* SnapKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + A8A568C85E8DA720DCD4AC3FD1F737F9 /* Pods-AlamoRecord_Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = EFE517016DE8687C521833DCD3C9E95D /* Pods-AlamoRecord_Example-dummy.m */; }; + A92754E90015E38811C73AD647E5C907 /* String+heightForConstrainedWidth.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7198C32DC947419CB7C2E75C3EA3A65 /* String+heightForConstrainedWidth.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + AD3B58BEDA6E46FDA7CF9643F1863AD5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */; }; + ADB5DE14557FC95AB23882D410B3D780 /* MarqueeLabel-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = A8124A3370E07C0B3434D3F9E9FC8E53 /* MarqueeLabel-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + B5B18BDAFFF85C31368E40950F0EEB1F /* RequestTaskMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = C10F2C81523673581050F158C6D1691B /* RequestTaskMap.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + BACE6027F99455BB5F98BBE44178947A /* BannerHapticGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05792DD7292FA5B48C12E866AA917F25 /* BannerHapticGenerator.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + BE5297501015DF5CDDBA5078F897717C /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEEA5EACD093B45B8278EECB70A32907 /* ConstraintLayoutSupport.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + BE8738060AFD20EFF41C849849CA16AE /* NotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C6D2227CCEF728754FA917323657AF8 /* NotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + C151F1B3F8274837EFF34C8D2E9D5BB3 /* Alamofire-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = DECD749DD0BBC7E30B1FFA94E9953D65 /* Alamofire-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C2CC3C527B195FD3E7146FB8446F8937 /* Typealiases.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD2B7C97D3DE9ACBA2861B0B5E5FE1A6 /* Typealiases.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + C430739EC649DC30911FBB7EDB5C3532 /* ConstraintDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = A19CD45AF8C46A0A720D21F69FDF6BCB /* ConstraintDSL.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + C51051F25CCA591B4656421E7C045136 /* Protector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B0071976763A642EAAFA226B3170B2F /* Protector.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + C7BDD5ABEA0A1ACC93BA5DD9F0C0C1ED /* NetworkReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1728953ACC9C0718E397DCF055C058E4 /* NetworkReachabilityManager.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + C859C9A20A147CFA0AADE2939E5D29CA /* ConstraintLayoutGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2773A9829ECED212ED35EA23520318B9 /* ConstraintLayoutGuide.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + C8E9E4A08330E4931C61EDD3527B6E2C /* MarqueeLabel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 99E2285C471300A5D2895FF65F407971 /* MarqueeLabel.framework */; }; + CCE1C86D007D45C4305645CE18DFB768 /* CachedResponseHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = DF50390352C0AC48349B817861F6206D /* CachedResponseHandler.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + CE5ADC801A12F82D243089EB47F762E6 /* ConstraintConstantTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6AA10BE1E9262BCBD3FBF8CA0E5DC9E1 /* ConstraintConstantTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + D044B3E2426BCE71E87E331C5573FB0B /* ServerTrustEvaluation.swift in Sources */ = {isa = PBXBuildFile; fileRef = AF1AA84406EBB5E3866FEC809F5AD161 /* ServerTrustEvaluation.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + D22A7D8D22D158465443F083893197DE /* AlamofireExtended.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F2BBD93DB8E31308CB7FFDA9E439DE /* AlamofireExtended.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + D22F6F9872046E3D6229D897C34379CC /* SnapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DB1F09D84E29A3D5E4238FAF456FED40 /* SnapKit.framework */; }; + D294198C5D62E94BDDDF4493EEEB5CB6 /* ConstraintPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6B07266FCD2E1FC334EAF5B0E90BF699 /* ConstraintPriority.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + D2DCBAE3FDB8ECF9C08FC064D55FEC08 /* ConstraintLayoutGuide+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B60CC2504B346CFF500A070D328F8227 /* ConstraintLayoutGuide+Extensions.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + D48F2B431C58B7C7D915E1C73F4603BA /* AlamoRecord-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = DE392E429D3AA0CAF8BA64B3AC9811E0 /* AlamoRecord-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D5F8FAAE8F3C7C369577BCC97F37F06A /* BannerPositionFrame.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41D4089821FCA1936350003561A200FC /* BannerPositionFrame.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + D5FB191F50ED4A2CC9FA653F283BCD73 /* ConstraintPriorityTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8866E76B360C1E410BDE12212A34D608 /* ConstraintPriorityTarget.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + DC1984523B87F391C23731D751CB5ABA /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE6CE49F232C2965FC8ED5EEDE0C9AB6 /* Notifications.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + DE0892BCA7F7841B3CD02AECAFBFB7C1 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F07FD18089A35DE6118D46AB7E6F7F18 /* Logger.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + E03A7E7468B35881D4B6295FF1A9A200 /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD7606470BA8DEF2E411F008ECEA1F46 /* ResponseSerialization.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + E079BF566EA598A2FD56F90A3CD0C919 /* FloatGrowingNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E47A7A6302D8EF64879E0CC0931B13B /* FloatGrowingNotificationBanner.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + E4EFE44864C5BBBDDC04F5ED3786BF0B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */; }; + EDBBE22742DF1243A34C0429DC2F6E0F /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F571C2164478BA0A90BA4044F60B7CA5 /* Alamofire.framework */; }; + EF9492998EB117C194B6B2BF013BF6C3 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5DF64894ACEA05955EB6E75AC8FC4782 /* Configuration.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + F425944D372B3A18AFDCE91C2771FA6F /* OperationQueue+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73EE703765293DD90041D329EBEB2CF1 /* OperationQueue+Alamofire.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + F524712400FFDCDFBD66BB224A930F45 /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0991BC521C4942AFB7D867C3229A6C7 /* MultipartFormData.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + F62A1BBFD9D414C079B5A05217D339B4 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACF8081EEEE76AAD4F0C7EC76A4AAE65 /* Debugging.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + F65A6EFAB81B22FBCD89497954C5AE2E /* HTTPMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08C41B926D6B76D888B2B5239CC0E403 /* HTTPMethod.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + F8C5AA3174C8EB8768F7E0AC22D2460B /* Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = 194E88402915B03DEFF66DD825385422 /* Session.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + F90CCE0F5C56A32525CCD0CFA63AD497 /* AlamoRecordError.swift in Sources */ = {isa = PBXBuildFile; fileRef = D557EB749A1A3921A51C7E1D4DA5918F /* AlamoRecordError.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + FA548C954F24AE41DC616F6FA6A764A4 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B0CC5EC9362CEA08BE90F2E7C1B255F /* CFNetwork.framework */; }; + FE25336B0EEEA765D1EB65ADEA78BADE /* ConstraintMakerEditable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18B58AEA863EFDD10C3D94B55E5BF9E2 /* ConstraintMakerEditable.swift */; settings = {COMPILER_FLAGS = "-w -Xanalyzer -analyzer-disable-all-checks"; }; }; + FE7D96EB49017B0BAB2689163B375DD6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */; }; + FF2F28C178B59EFF56879D29B0C71914 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8034F172A40F594F703C825A1A5111AD /* UIKit.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - 3AC76E94D03FB4F156558629F12EAEDA /* PBXContainerItemProxy */ = { + 0A73E48A3EE59CA2C9AE8177A40AEEC1 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 7BD97CF7F99456542B92924626C189AE; - remoteInfo = KeyboardSpy; - }; - 460A02A78994A29719FDA2F782C84F31 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 40ADC2569ACCEFAB702FA16ADF849D69; - remoteInfo = SnapKit; - }; - 4E4EDA87036908ADFEBC517939B0C502 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 3383968E74B5371B20BB519B170DC7FD; + remoteGlobalIDString = 5455B208045065E5218D2C58C300B938; remoteInfo = Alamofire; }; - 5A1D23338ED041CA3697CCFE957C0182 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 743E4A349913BA26BF7AEE81D0D0DC34; - remoteInfo = AlamofireObjectMapper; - }; 6681896758E71C4BD73B5D2C27292729 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; @@ -184,344 +146,289 @@ remoteGlobalIDString = 40ADC2569ACCEFAB702FA16ADF849D69; remoteInfo = SnapKit; }; - 69CE40A19DE8003D90BD6C7FA270FDCF /* PBXContainerItemProxy */ = { + 7EBE6902BBBCF6D4AA45B71FEFBC7E5C /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 3383968E74B5371B20BB519B170DC7FD; - remoteInfo = Alamofire; - }; - 6E4A57BB98DF2E96F09A02D6FCF8E328 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = C96DAD7E39A2D336B0233A69073F19DF; - remoteInfo = AlamoRecord; + remoteGlobalIDString = 40ADC2569ACCEFAB702FA16ADF849D69; + remoteInfo = SnapKit; }; - 72BE027F0407C0A5CC1A346FB2509229 /* PBXContainerItemProxy */ = { + 86852F781E7F46AE918E0D455B3C197B /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = C96DAD7E39A2D336B0233A69073F19DF; - remoteInfo = AlamoRecord; + remoteGlobalIDString = 93560C05B87988775E43AA3CEBFCA82A; + remoteInfo = MarqueeLabel; }; - 7406314BF67149382A044F7CBAF62FE1 /* PBXContainerItemProxy */ = { + A0BAA68975C00BEE256D706506DFB18D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 05FF60AFEB7D11852C2197FC7231A986; - remoteInfo = NotificationBannerSwift; + remoteGlobalIDString = 7BD97CF7F99456542B92924626C189AE; + remoteInfo = KeyboardSpy; }; - 803F81A9ED00474E12D041CAD20A1020 /* PBXContainerItemProxy */ = { + D715A63632471B0A927BF9667D21F646 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 0882708950626A3ECBCB6A065347330B; - remoteInfo = ObjectMapper; + remoteGlobalIDString = 5455B208045065E5218D2C58C300B938; + remoteInfo = Alamofire; }; - 8F4D60820A98B72636961F0A23BF3916 /* PBXContainerItemProxy */ = { + D9EF13C4AE1BB4F440AAE30D55BBF678 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; remoteGlobalIDString = 93560C05B87988775E43AA3CEBFCA82A; remoteInfo = MarqueeLabel; }; - 8FCABDDEF260E260D6F2A9A1BBFB5F16 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 743E4A349913BA26BF7AEE81D0D0DC34; - remoteInfo = AlamofireObjectMapper; - }; - 955348F5776F6CED84E6E385CB499F89 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 743E4A349913BA26BF7AEE81D0D0DC34; - remoteInfo = AlamofireObjectMapper; - }; - 9F95E621710F4B7EBD56B83C134F6AD5 /* PBXContainerItemProxy */ = { + E9DF2DCABDC278E9AB9AEB7B68ABEEB0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 3383968E74B5371B20BB519B170DC7FD; - remoteInfo = Alamofire; + remoteGlobalIDString = 05FF60AFEB7D11852C2197FC7231A986; + remoteInfo = NotificationBannerSwift; }; - AA8E631247685B6214916112686EE9CA /* PBXContainerItemProxy */ = { + EB32560DCE3EF621F9F2B4ADA44F2574 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 0882708950626A3ECBCB6A065347330B; - remoteInfo = ObjectMapper; + remoteGlobalIDString = 098B42A464D8136D2AF9CA5F88494F05; + remoteInfo = AlamoRecord; }; - D9EF13C4AE1BB4F440AAE30D55BBF678 /* PBXContainerItemProxy */ = { + F26446072A67EB950F55FFAB578F4306 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 93560C05B87988775E43AA3CEBFCA82A; - remoteInfo = MarqueeLabel; + remoteGlobalIDString = 098B42A464D8136D2AF9CA5F88494F05; + remoteInfo = AlamoRecord; }; - E63485A32F51F54076553D54B3F94444 /* PBXContainerItemProxy */ = { + FF0DCFF2711D5AD9B1FE2F61F41456D8 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; proxyType = 1; - remoteGlobalIDString = 0882708950626A3ECBCB6A065347330B; - remoteInfo = ObjectMapper; + remoteGlobalIDString = 5455B208045065E5218D2C58C300B938; + remoteInfo = Alamofire; }; /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ 000B3CE708AC831445FC177F077E7017 /* RequestObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RequestObserver.swift; path = AlamoRecord/Classes/RequestObserver.swift; sourceTree = ""; }; - 01FD9852175271ADCA1150DE380023C4 /* ConstraintMakerFinalizable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerFinalizable.swift; path = Source/ConstraintMakerFinalizable.swift; sourceTree = ""; }; - 0217D4E44FD6D154FA86624AA141EA0F /* ConstraintMakerExtendable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerExtendable.swift; path = Source/ConstraintMakerExtendable.swift; sourceTree = ""; }; - 03F596D751854D9A88DEECC4DB3B25EE /* ObjectMapper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ObjectMapper.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 0519FD2FE223D95E52D3D1C2ABD1760E /* DataTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DataTransform.swift; path = Sources/DataTransform.swift; sourceTree = ""; }; - 05352A7A2959B7C8FBBB6501DE4E3903 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; path = README.md; sourceTree = ""; }; + 004611CCBC80B2CA56C6332A34A7572F /* AFError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AFError.swift; path = Source/AFError.swift; sourceTree = ""; }; + 0056561A2CAB37A70D162D1C7AAB1C14 /* ConstraintView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintView.swift; path = Source/ConstraintView.swift; sourceTree = ""; }; + 0090D04D23AD59223CA6ABE2B1815B57 /* KeyboardSpy.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = KeyboardSpy.xcconfig; sourceTree = ""; }; + 00E678BDDA678E307E9CCFD5A9E60013 /* NotificationBannerSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "NotificationBannerSwift-Info.plist"; sourceTree = ""; }; + 0263821A0DEEA2F45D3D6746E5011D0C /* NotificationBannerSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "NotificationBannerSwift-prefix.pch"; sourceTree = ""; }; + 0297F679206FD3720700DD9A5C094393 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 05352A7A2959B7C8FBBB6501DE4E3903 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; + 053CACA91F2E751BFAD8722331559429 /* EventMonitor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EventMonitor.swift; path = Source/EventMonitor.swift; sourceTree = ""; }; + 05792DD7292FA5B48C12E866AA917F25 /* BannerHapticGenerator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BannerHapticGenerator.swift; path = NotificationBanner/Classes/BannerHapticGenerator.swift; sourceTree = ""; }; 06A6669549A3A474BAD3F6FA4AE0ACB3 /* Pods-Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Tests-acknowledgements.markdown"; sourceTree = ""; }; - 06EAA2C50CB99C7BB54B80AFEFB0343D /* ConstraintLayoutSupportDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutSupportDSL.swift; path = Source/ConstraintLayoutSupportDSL.swift; sourceTree = ""; }; - 08EF89F7422A45E4B0E5F5A7826B7963 /* AlamofireObjectMapper-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "AlamofireObjectMapper-prefix.pch"; sourceTree = ""; }; - 092CA9EA42D8532373F954DECB940CB9 /* Alamofire.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Alamofire.modulemap; sourceTree = ""; }; - 0ABD412A2CE4610A79D769C19A679B54 /* TransformOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TransformOf.swift; path = Sources/TransformOf.swift; sourceTree = ""; }; - 0C232CE1D829CB367E4CC353D1B55649 /* ResponseSerialization.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ResponseSerialization.swift; path = Source/ResponseSerialization.swift; sourceTree = ""; }; - 0CF9A985DB050A33602C3F0DCA323481 /* AlamofireObjectMapper.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = AlamofireObjectMapper.modulemap; sourceTree = ""; }; + 07D462748235C19C5DF4E6C8091CCC27 /* Alamofire.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Alamofire.xcconfig; sourceTree = ""; }; + 08B29434B60C2153F9CB8D18D3378D64 /* SessionDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionDelegate.swift; path = Source/SessionDelegate.swift; sourceTree = ""; }; + 08C41B926D6B76D888B2B5239CC0E403 /* HTTPMethod.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HTTPMethod.swift; path = Source/HTTPMethod.swift; sourceTree = ""; }; + 09A4204C5F2BE7E966EEBA7C5756403C /* KeyboardSpy-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "KeyboardSpy-Info.plist"; sourceTree = ""; }; + 09D8D92F0294BA4AD00EDE414BB598FD /* ConstraintInsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintInsetTarget.swift; path = Source/ConstraintInsetTarget.swift; sourceTree = ""; }; + 0B0CC5EC9362CEA08BE90F2E7C1B255F /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; }; + 0B4B657FF97F9EF9CB2C5CDD8A544229 /* ConstraintMakerRelatable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerRelatable.swift; path = Source/ConstraintMakerRelatable.swift; sourceTree = ""; }; 0D5B54C64783A5A52E6D24C3049B15A3 /* Pods-AlamoRecord_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AlamoRecord_Example.debug.xcconfig"; sourceTree = ""; }; 0F4986073837DBBD295DC67541A50737 /* Pods-AlamoRecord_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-AlamoRecord_Example.modulemap"; sourceTree = ""; }; - 10AD5C92C89277A1340FFDC2E6A7A366 /* Debugging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debugging.swift; path = Source/Debugging.swift; sourceTree = ""; }; + 0F99929244F997A21EAC8303B4E93094 /* URLRequest+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "URLRequest+Alamofire.swift"; path = "Source/URLRequest+Alamofire.swift"; sourceTree = ""; }; 119A9CFD5491E8C6D2DA96A442F2003D /* AlamoRecord.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = AlamoRecord.xcconfig; sourceTree = ""; }; - 120E6520780E7D6BAE90F463496F4B1D /* EnumOperators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EnumOperators.swift; path = Sources/EnumOperators.swift; sourceTree = ""; }; - 12BD10D79C2941FD5FD486410D0E967C /* Map.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Map.swift; path = Sources/Map.swift; sourceTree = ""; }; - 13B91EBE185BA444F02F9AD8B0D1A76B /* ObjectMapper-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ObjectMapper-Info.plist"; sourceTree = ""; }; - 15DF2C5C4F93FAC0BEDC802D5571EB01 /* ConstraintInsets.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintInsets.swift; path = Source/ConstraintInsets.swift; sourceTree = ""; }; - 19B9CC806A2B102540A8998EFF9BB69F /* AlamofireObjectMapper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AlamofireObjectMapper.swift; path = AlamofireObjectMapper/AlamofireObjectMapper.swift; sourceTree = ""; }; - 19ED65590817E36BDEDD34B9B0AC9C90 /* UILayoutSupport+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UILayoutSupport+Extensions.swift"; path = "Source/UILayoutSupport+Extensions.swift"; sourceTree = ""; }; - 19FC9C238EC1BDDD89A0CD6F0EB9673B /* ConstraintConfig.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintConfig.swift; path = Source/ConstraintConfig.swift; sourceTree = ""; }; - 1D061C00D10861FBDB915A8F3B181010 /* ObjectMapper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = ObjectMapper.framework; path = ObjectMapper.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 1D380DFD0564A547FC5E66CC2CF9BFAE /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; - 1D4000709A234FE95C6100354C477D9C /* Mappable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Mappable.swift; path = Sources/Mappable.swift; sourceTree = ""; }; - 1D7453DABA1673B5BD3A14F1D5343093 /* NotificationBannerSwift-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "NotificationBannerSwift-prefix.pch"; sourceTree = ""; }; - 213473CEED915F00E1E1D33310005755 /* Constraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Constraint.swift; path = Source/Constraint.swift; sourceTree = ""; }; - 215BA8533A0B8E711D2ED5D6CAEB4976 /* SessionManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionManager.swift; path = Source/SessionManager.swift; sourceTree = ""; }; - 215F4A1A28905320E0ADB77A7787C9A5 /* ConstraintMultiplierTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMultiplierTarget.swift; path = Source/ConstraintMultiplierTarget.swift; sourceTree = ""; }; - 218CC958A08B26670CEC3CD51D393A1E /* ConstraintInsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintInsetTarget.swift; path = Source/ConstraintInsetTarget.swift; sourceTree = ""; }; - 248D024518D93C44D684C704E3DF3551 /* MapError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MapError.swift; path = Sources/MapError.swift; sourceTree = ""; }; - 2730EB1D6511E6AF0CB94D8C3BED1733 /* NotificationBannerSwift-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "NotificationBannerSwift-Info.plist"; sourceTree = ""; }; - 2895B9338AF8DA1BB8F8DD956E59CB8E /* MarqueeLabel.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = MarqueeLabel.xcconfig; sourceTree = ""; }; - 2A2CCF4B0FDDD6AFECE7B89C04ED1BC1 /* ConstraintRelatableTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintRelatableTarget.swift; path = Source/ConstraintRelatableTarget.swift; sourceTree = ""; }; - 2A3B55314B211B6C48BA67549D43E648 /* ConstraintRelation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintRelation.swift; path = Source/ConstraintRelation.swift; sourceTree = ""; }; - 2B6F64C80705075B15098110C34AAB5C /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_Tests.framework; path = "Pods-Tests.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2BFA1879B516ACCA6863CEB33CE6D912 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; - 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 12C5C9D79C82067B6E34C4F656F9A243 /* MarqueeLabel.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = MarqueeLabel.xcconfig; sourceTree = ""; }; + 14A366C85D07348A356D5F0A794ACFB5 /* ConstraintItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintItem.swift; path = Source/ConstraintItem.swift; sourceTree = ""; }; + 14C3DBF105A194B9ECAFCB685F5F5EE2 /* ConstraintMultiplierTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMultiplierTarget.swift; path = Source/ConstraintMultiplierTarget.swift; sourceTree = ""; }; + 16CF02F87A36E46ECDD43D8DD58F3B7F /* Constraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Constraint.swift; path = Source/Constraint.swift; sourceTree = ""; }; + 1728953ACC9C0718E397DCF055C058E4 /* NetworkReachabilityManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkReachabilityManager.swift; path = Source/NetworkReachabilityManager.swift; sourceTree = ""; }; + 18B58AEA863EFDD10C3D94B55E5BF9E2 /* ConstraintMakerEditable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerEditable.swift; path = Source/ConstraintMakerEditable.swift; sourceTree = ""; }; + 194E88402915B03DEFF66DD825385422 /* Session.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Session.swift; path = Source/Session.swift; sourceTree = ""; }; + 1B0071976763A642EAAFA226B3170B2F /* Protector.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Protector.swift; path = Source/Protector.swift; sourceTree = ""; }; + 1EEC2E3441BA4E4D9233CB984CC4B6EB /* ConstraintLayoutSupportDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutSupportDSL.swift; path = Source/ConstraintLayoutSupportDSL.swift; sourceTree = ""; }; + 1F0AF9114B6850A5B612F333CBF8C764 /* Pods_AlamoRecord_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AlamoRecord_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 24ED80356652F7DBB5EBAB5E448F5AA6 /* RequestInterceptor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RequestInterceptor.swift; path = Source/RequestInterceptor.swift; sourceTree = ""; }; + 25CC63271DAB30A19EC738FD14C062D7 /* URLConvertible+URLRequestConvertible.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "URLConvertible+URLRequestConvertible.swift"; path = "Source/URLConvertible+URLRequestConvertible.swift"; sourceTree = ""; }; + 2773A9829ECED212ED35EA23520318B9 /* ConstraintLayoutGuide.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutGuide.swift; path = Source/ConstraintLayoutGuide.swift; sourceTree = ""; }; + 2A08E4AC23A6E9CAF23CDE3F5764F162 /* ConstraintConfig.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintConfig.swift; path = Source/ConstraintConfig.swift; sourceTree = ""; }; + 2A5BFAF622177BEB6FDA7EF32B2380BC /* NotificationBannerQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NotificationBannerQueue.swift; path = NotificationBanner/Classes/NotificationBannerQueue.swift; sourceTree = ""; }; 2D744F6CC0299E04DCF6535E0EEDB13B /* Pods-AlamoRecord_Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-AlamoRecord_Example-acknowledgements.markdown"; sourceTree = ""; }; - 2E0BD13787623254480353B4BDA81F84 /* ConstraintPriority.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriority.swift; path = Source/ConstraintPriority.swift; sourceTree = ""; }; - 3354E9B4F2223F341FAE9019BDC3CD16 /* FloatGrowingNotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FloatGrowingNotificationBanner.swift; path = NotificationBanner/Classes/FloatGrowingNotificationBanner.swift; sourceTree = ""; }; - 347258D7DA6785927BD639C7C9D2F71B /* LayoutConstraintItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LayoutConstraintItem.swift; path = Source/LayoutConstraintItem.swift; sourceTree = ""; }; - 3495B5AAB601B330E05479622A787A21 /* Pods_AlamoRecord_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_AlamoRecord_Example.framework; path = "Pods-AlamoRecord_Example.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 350CD04A3950CF96F1A71B563729300B /* StatusBarNotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatusBarNotificationBanner.swift; path = NotificationBanner/Classes/StatusBarNotificationBanner.swift; sourceTree = ""; }; - 35F5DF9E484E7CE93CF13A6BC13CAAF2 /* IntegerOperators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = IntegerOperators.swift; path = Sources/IntegerOperators.swift; sourceTree = ""; }; + 2E413280AE0E8ADED713332CD2DDD658 /* ConstraintAttributes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintAttributes.swift; path = Source/ConstraintAttributes.swift; sourceTree = ""; }; + 2F9C762E1170660BCF5158E17B1D99F7 /* RedirectHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RedirectHandler.swift; path = Source/RedirectHandler.swift; sourceTree = ""; }; + 344269F51893250EB845FF1E971FC9E9 /* MarqueeLabel.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = MarqueeLabel.modulemap; sourceTree = ""; }; + 34F2BBD93DB8E31308CB7FFDA9E439DE /* AlamofireExtended.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AlamofireExtended.swift; path = Source/AlamofireExtended.swift; sourceTree = ""; }; + 3521E6E22044330574C3FA74960768D1 /* Alamofire.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = Alamofire.modulemap; sourceTree = ""; }; 36583CA7365A6914C1C4B978D1E6B569 /* Pods-Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Tests-dummy.m"; sourceTree = ""; }; - 39C9C70D1CDE64F25058FC3C936E5833 /* SnapKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SnapKit.modulemap; sourceTree = ""; }; - 3B690DC94AB97C77B5ED24EA73A8032F /* BannerPositionFrame.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BannerPositionFrame.swift; path = NotificationBanner/Classes/BannerPositionFrame.swift; sourceTree = ""; }; - 3D60FA77F919260DA1DCB14B39FE2723 /* KeyboardSpy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyboardSpy.swift; path = KeyboardSpy/Classes/KeyboardSpy.swift; sourceTree = ""; }; - 40F141EB436A5E0EEB7EA65C506FBA71 /* BannerColors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BannerColors.swift; path = NotificationBanner/Classes/BannerColors.swift; sourceTree = ""; }; - 40F3B470948ED264367161413642731F /* KeyboardSpy-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "KeyboardSpy-dummy.m"; sourceTree = ""; }; - 413AA55CD5838B72D4B36F93C9D4E6CB /* AlamofireObjectMapper-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "AlamofireObjectMapper-umbrella.h"; sourceTree = ""; }; - 423602EDC9CDB524D3333D6E59A0E77D /* NotificationBannerSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = NotificationBannerSwift.modulemap; sourceTree = ""; }; - 42CB33DD49381C039CB689ED77B97858 /* DateTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DateTransform.swift; path = Sources/DateTransform.swift; sourceTree = ""; }; - 449904D2F47AF0F10B2900948BAED969 /* ConstraintPriorityTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriorityTarget.swift; path = Source/ConstraintPriorityTarget.swift; sourceTree = ""; }; + 3926B1C95CFAFA1E703331173F4CF3E6 /* KeyboardSpyAgent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyboardSpyAgent.swift; path = KeyboardSpy/Classes/KeyboardSpyAgent.swift; sourceTree = ""; }; + 396D47EB931C6DD614374085781269F0 /* NotificationBannerSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "NotificationBannerSwift-umbrella.h"; sourceTree = ""; }; + 3ABF6902831972177036147ECE4CBBC9 /* MarqueeLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MarqueeLabel.swift; path = Sources/MarqueeLabel.swift; sourceTree = ""; }; + 3D8CC7ECCC21AE66487E086A4F165628 /* ConstraintMakerFinalizable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerFinalizable.swift; path = Source/ConstraintMakerFinalizable.swift; sourceTree = ""; }; + 4011BB46DB18D1F63C97B3C579424106 /* KeyboardSpy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KeyboardSpy.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 41D4089821FCA1936350003561A200FC /* BannerPositionFrame.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BannerPositionFrame.swift; path = NotificationBanner/Classes/BannerPositionFrame.swift; sourceTree = ""; }; + 424992F538A848EBE1A36CFA06BEA98A /* KeyboardSpyInfo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyboardSpyInfo.swift; path = KeyboardSpy/Classes/KeyboardSpyInfo.swift; sourceTree = ""; }; 455CC0E9C0302EA449522794EAD53C56 /* Pods-AlamoRecord_Example-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-AlamoRecord_Example-Info.plist"; sourceTree = ""; }; - 49B0E203D2CB9BC96D32F2533B6A7C60 /* BannerStyle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BannerStyle.swift; path = NotificationBanner/Classes/BannerStyle.swift; sourceTree = ""; }; - 4A09B1B0A8C8715314A862FC4166D810 /* AlamofireObjectMapper-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "AlamofireObjectMapper-dummy.m"; sourceTree = ""; }; + 48128FA83E630C1AAF5EFA6CBE6808C5 /* BaseNotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BaseNotificationBanner.swift; path = NotificationBanner/Classes/BaseNotificationBanner.swift; sourceTree = ""; }; 4B0D849A6AE01F027EAC81D9D89A85EC /* AlamoRecord-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "AlamoRecord-prefix.pch"; sourceTree = ""; }; - 4C379AD9ECE6A3D5AED48F1BB535157A /* AlamofireObjectMapper-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "AlamofireObjectMapper-Info.plist"; sourceTree = ""; }; - 4C854944A3178BECC85F96DF60B5A97C /* ConstraintAttributes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintAttributes.swift; path = Source/ConstraintAttributes.swift; sourceTree = ""; }; + 4D57C435AFC6D6A2C0414A90DE35E807 /* ParameterEncoder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoder.swift; path = Source/ParameterEncoder.swift; sourceTree = ""; }; + 4D8008F9E47E8C19C60843442C6F816C /* ConstraintLayoutGuideDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutGuideDSL.swift; path = Source/ConstraintLayoutGuideDSL.swift; sourceTree = ""; }; 4E57EBADAF6DF9C48DBFB4431E7ADDFF /* Pods-Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Tests-frameworks.sh"; sourceTree = ""; }; - 502FA0459DB306676EA5C3AC16180CEC /* SnapKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SnapKit-dummy.m"; sourceTree = ""; }; + 504AFD1E039AE867356420B7C0C901AE /* MultipartUpload.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartUpload.swift; path = Source/MultipartUpload.swift; sourceTree = ""; }; + 522C37FDB9C31E8C74FFC3ECFEBEA366 /* MarqueeLabel-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "MarqueeLabel-dummy.m"; sourceTree = ""; }; 53C1CDF96E28F28662FF63B765603155 /* Pods-Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Tests-umbrella.h"; sourceTree = ""; }; - 53E25871E7E7C63F40D17552F3FBBF1B /* DictionaryTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DictionaryTransform.swift; path = Sources/DictionaryTransform.swift; sourceTree = ""; }; - 54547DB6EFF6814C1C1EB771BAFB7982 /* NotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NotificationBanner.swift; path = NotificationBanner/Classes/NotificationBanner.swift; sourceTree = ""; }; - 54F2AAD28B4E8678FA824C9C88B42268 /* Notifications.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Notifications.swift; path = Source/Notifications.swift; sourceTree = ""; }; - 57809E061BA8111EDBEB220FC9A7D48B /* TaskDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TaskDelegate.swift; path = Source/TaskDelegate.swift; sourceTree = ""; }; - 5AC247E17A2026CA741ECD52FB64934B /* SnapKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SnapKit-umbrella.h"; sourceTree = ""; }; + 56C9AC36B053C92A05C5CAB0CDD75753 /* Pods_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 576CA603B81900C3CA26B274120B010B /* MarqueeLabel-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "MarqueeLabel-prefix.pch"; sourceTree = ""; }; + 58CAD67C11D4BE3082C0836E2E4991AF /* KeyboardSpy-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "KeyboardSpy-dummy.m"; sourceTree = ""; }; + 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 5C25BD0522A9EFF50074320C /* AlamoRecordDecoder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AlamoRecordDecoder.swift; path = AlamoRecord/Classes/AlamoRecordDecoder.swift; sourceTree = ""; }; + 5DD85328FAA744087DE8172FB2929E95 /* ParameterEncoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoding.swift; path = Source/ParameterEncoding.swift; sourceTree = ""; }; 5DF64894ACEA05955EB6E75AC8FC4782 /* Configuration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Configuration.swift; path = AlamoRecord/Classes/Configuration.swift; sourceTree = ""; }; - 5EFEE49862562AB8CC8C63777F2E3927 /* AlamoRecord.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = AlamoRecord.framework; path = AlamoRecord.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 5F3BE9D858C33D41F1C8CDCFCE3CE681 /* MarqueeLabel-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "MarqueeLabel-prefix.pch"; sourceTree = ""; }; - 604CB73BB684B1F25C88E9569C7726AE /* CodableTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CodableTransform.swift; path = Sources/CodableTransform.swift; sourceTree = ""; }; - 662459E0A08EEAF3DCEE71CE5CCCF467 /* MarqueeLabel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = MarqueeLabel.framework; path = MarqueeLabel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 67BF0D5DAA70A1AD94EB205FAE70B317 /* Validation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Source/Validation.swift; sourceTree = ""; }; - 67F8332AA591F533B8673805D8BC2BE4 /* NetworkReachabilityManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkReachabilityManager.swift; path = Source/NetworkReachabilityManager.swift; sourceTree = ""; }; - 69FC850F7C80DDAB589A4B8A5DF9DC9B /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Source/Response.swift; sourceTree = ""; }; - 6B96C90A9FAD16EF903E40FCCAD8BF77 /* BaseNotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BaseNotificationBanner.swift; path = NotificationBanner/Classes/BaseNotificationBanner.swift; sourceTree = ""; }; - 6D43F34CD034BD9E2E4DC744BC3049F6 /* AlamofireObjectMapper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = AlamofireObjectMapper.framework; path = AlamofireObjectMapper.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 6E33519A554C64941339EA8FF7F2FA75 /* NotificationBannerSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = NotificationBannerSwift.framework; path = NotificationBannerSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 709570AF6AF07CD37295DE6BEBFEC138 /* MarqueeLabel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MarqueeLabel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 5E47A7A6302D8EF64879E0CC0931B13B /* FloatGrowingNotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FloatGrowingNotificationBanner.swift; path = NotificationBanner/Classes/FloatGrowingNotificationBanner.swift; sourceTree = ""; }; + 609C148640B607967069037F0257FF87 /* UILayoutSupport+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UILayoutSupport+Extensions.swift"; path = "Source/UILayoutSupport+Extensions.swift"; sourceTree = ""; }; + 64A29AB26F295C677AEC43D9396B9B46 /* AlamoRecord.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AlamoRecord.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 6546EB52BBCCC8095ED60BDB9711BF51 /* SnapKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SnapKit-umbrella.h"; sourceTree = ""; }; + 65D6DDA179FD4D65C1F64C7C8BC6F949 /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Source/Response.swift; sourceTree = ""; }; + 67CA5B78FEC6356D234976FECF5E2F15 /* ConstraintMakerExtendable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerExtendable.swift; path = Source/ConstraintMakerExtendable.swift; sourceTree = ""; }; + 6AA10BE1E9262BCBD3FBF8CA0E5DC9E1 /* ConstraintConstantTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintConstantTarget.swift; path = Source/ConstraintConstantTarget.swift; sourceTree = ""; }; + 6B07266FCD2E1FC334EAF5B0E90BF699 /* ConstraintPriority.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriority.swift; path = Source/ConstraintPriority.swift; sourceTree = ""; }; + 6C6D2227CCEF728754FA917323657AF8 /* NotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NotificationBanner.swift; path = NotificationBanner/Classes/NotificationBanner.swift; sourceTree = ""; }; 7183091987FEC8671A8513179D0E71FB /* Pods-AlamoRecord_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-AlamoRecord_Example-umbrella.h"; sourceTree = ""; }; 71F9775402034BA8D0AF9B4C8C04CE22 /* Pods-Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-Tests.modulemap"; sourceTree = ""; }; - 73D9C1055852F66228AB9326A79C080A /* NotificationBannerSwift-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "NotificationBannerSwift-umbrella.h"; sourceTree = ""; }; - 7664F92AED1D37E8A7816914EF45B6B2 /* KeyboardSpy-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "KeyboardSpy-prefix.pch"; sourceTree = ""; }; - 79415C4C5B2D92AAAFA0E7C01814EB70 /* ConstraintOffsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintOffsetTarget.swift; path = Source/ConstraintOffsetTarget.swift; sourceTree = ""; }; - 7ABE886E4AED9D9563F58D8D809528F0 /* ObjectMapper-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "ObjectMapper-dummy.m"; sourceTree = ""; }; - 7BDD7C4C5E90E9D5251990602B523979 /* Mapper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Mapper.swift; path = Sources/Mapper.swift; sourceTree = ""; }; - 7CE34DCFFE8DFC5406F8A0085D9796CC /* TransformOperators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TransformOperators.swift; path = Sources/TransformOperators.swift; sourceTree = ""; }; - 7D45D5CA2893A723C5794147D5D7C234 /* Operators.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Operators.swift; path = Sources/Operators.swift; sourceTree = ""; }; - 7D53630CFB1C793A2CB6966A167FAD10 /* ObjectMapper.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = ObjectMapper.modulemap; sourceTree = ""; }; - 7D743022554B904DB53D6D96B5FE07DE /* ConstraintViewDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintViewDSL.swift; path = Source/ConstraintViewDSL.swift; sourceTree = ""; }; - 7EB07032E89A248B14916C89DDB22ECD /* KeyboardSpyAgent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyboardSpyAgent.swift; path = KeyboardSpy/Classes/KeyboardSpyAgent.swift; sourceTree = ""; }; - 815285991858A8A97BE0FF81659A6728 /* ConstraintLayoutGuide+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ConstraintLayoutGuide+Extensions.swift"; path = "Source/ConstraintLayoutGuide+Extensions.swift"; sourceTree = ""; }; - 8264135DF2820C0D1A7F533C48D2A300 /* ConstraintConstantTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintConstantTarget.swift; path = Source/ConstraintConstantTarget.swift; sourceTree = ""; }; - 82B4E664058041A39A467472B49D0C11 /* ConstraintView+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ConstraintView+Extensions.swift"; path = "Source/ConstraintView+Extensions.swift"; sourceTree = ""; }; - 834EBA9325A3892E960FB4D4D8E6EFF5 /* CustomDateFormatTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CustomDateFormatTransform.swift; path = Sources/CustomDateFormatTransform.swift; sourceTree = ""; }; - 84AC3080813AF841DA6330259A40F379 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; path = LICENSE; sourceTree = ""; }; - 84AF4FC5BA5B58C3B1706C9A9607523E /* ConstraintLayoutSupport.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutSupport.swift; path = Source/ConstraintLayoutSupport.swift; sourceTree = ""; }; - 85B520A451A17AE070F501795A29701B /* NSDecimalNumberTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NSDecimalNumberTransform.swift; path = Sources/NSDecimalNumberTransform.swift; sourceTree = ""; }; - 878B8CDDDB7926F2F8A086B522184741 /* FromJSON.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FromJSON.swift; path = Sources/FromJSON.swift; sourceTree = ""; }; - 889BE315DB67139197F28DE8EE3EA85E /* TransformType.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TransformType.swift; path = Sources/TransformType.swift; sourceTree = ""; }; + 72DD7D1C39A05EC0CBFC0C020A24F3FC /* SnapKit-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SnapKit-Info.plist"; sourceTree = ""; }; + 73EE703765293DD90041D329EBEB2CF1 /* OperationQueue+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "OperationQueue+Alamofire.swift"; path = "Source/OperationQueue+Alamofire.swift"; sourceTree = ""; }; + 74C884E2E496CE031A23390B8BF5FC29 /* ConstraintInsets.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintInsets.swift; path = Source/ConstraintInsets.swift; sourceTree = ""; }; + 77ED7240D64B124AE1D8F28CCE7DF194 /* SnapKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SnapKit-dummy.m"; sourceTree = ""; }; + 786FBA069EEFCE1F3FD8A21B9BFBF242 /* NotificationBannerSwift.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = NotificationBannerSwift.modulemap; sourceTree = ""; }; + 7E435E79679D782C7FF34B720ADE2E7D /* ConstraintRelation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintRelation.swift; path = Source/ConstraintRelation.swift; sourceTree = ""; }; + 8034F172A40F594F703C825A1A5111AD /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + 82BFF4D561F3AF63B807BCAAC63926CD /* URLSessionConfiguration+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "URLSessionConfiguration+Alamofire.swift"; path = "Source/URLSessionConfiguration+Alamofire.swift"; sourceTree = ""; }; + 83DD1DF437DC0769D32BF216F86DC851 /* SnapKit.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SnapKit.xcconfig; sourceTree = ""; }; + 84AC3080813AF841DA6330259A40F379 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; + 87B25B4C74539EC55678005AAC0EBE6B /* DispatchQueue+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Alamofire.swift"; path = "Source/DispatchQueue+Alamofire.swift"; sourceTree = ""; }; + 8866E76B360C1E410BDE12212A34D608 /* ConstraintPriorityTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriorityTarget.swift; path = Source/ConstraintPriorityTarget.swift; sourceTree = ""; }; 89586C9B12A6F87300EF9022A1DBF4A2 /* AlamoRecord-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "AlamoRecord-dummy.m"; sourceTree = ""; }; - 8B5F3712C37711504C196B96782E90F8 /* KeyboardSpyInfo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyboardSpyInfo.swift; path = KeyboardSpy/Classes/KeyboardSpyInfo.swift; sourceTree = ""; }; - 8BD87D48DDA20716B8343C140F9007E5 /* Alamofire-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-umbrella.h"; sourceTree = ""; }; - 8C44B4FFFE68FB353B418C1D1F3AA286 /* HexColorTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HexColorTransform.swift; path = Sources/HexColorTransform.swift; sourceTree = ""; }; - 8C9B3E136A42756FBCC4B82696B92A28 /* AlamofireObjectMapper.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = AlamofireObjectMapper.xcconfig; sourceTree = ""; }; - 8FD9498CD966C40ACE474014B5FA8827 /* Result.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Source/Result.swift; sourceTree = ""; }; - 91170D0D82346FEAAE80B9ACB43605FB /* GrowingNotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GrowingNotificationBanner.swift; path = NotificationBanner/Classes/GrowingNotificationBanner.swift; sourceTree = ""; }; - 934B334C0600030B89197A60A6DBA675 /* ConstraintMakerEditable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerEditable.swift; path = Source/ConstraintMakerEditable.swift; sourceTree = ""; }; - 9835856025CD11E340D3151D91023A02 /* ConstraintView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintView.swift; path = Source/ConstraintView.swift; sourceTree = ""; }; - 9A3AB196CC8CDB0DEB8E55829816F036 /* MarqueeLabel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MarqueeLabel.swift; path = Sources/MarqueeLabel.swift; sourceTree = ""; }; - 9BF227F917DE19C09FB301EEF8E5D934 /* KeyboardSpy-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "KeyboardSpy-Info.plist"; sourceTree = ""; }; - 9D29A87D83FC11AA2BDEA81C29032568 /* MarqueeLabel-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "MarqueeLabel-dummy.m"; sourceTree = ""; }; - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 8ED6CC6028EDA486E4998BB7EBAF4052 /* NotificationBannerSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "NotificationBannerSwift-dummy.m"; sourceTree = ""; }; + 9059F1FD35488CAC45F8D01AD9023A2F /* StatusBarNotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatusBarNotificationBanner.swift; path = NotificationBanner/Classes/StatusBarNotificationBanner.swift; sourceTree = ""; }; + 93BA652A42056B71DA77D37706DADC11 /* ConstraintDescription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDescription.swift; path = Source/ConstraintDescription.swift; sourceTree = ""; }; + 98A295464AAFAEA2CFDFC1DDF82CB4F6 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; + 98B71AD8CE912E2273C852CEB8D09B1B /* Alamofire-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-prefix.pch"; sourceTree = ""; }; + 99E2285C471300A5D2895FF65F407971 /* MarqueeLabel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MarqueeLabel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 9DE5A69C4AEB8742E1DB715FA729587B /* Pods-AlamoRecord_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AlamoRecord_Example.release.xcconfig"; sourceTree = ""; }; A0503BD8CC0EABF56B1179A5EBBE76EA /* AlamoRecord.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = AlamoRecord.modulemap; sourceTree = ""; }; - A152EBCE7776345A6978BF7E57DBEF00 /* NotificationBannerSwift.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = NotificationBannerSwift.xcconfig; sourceTree = ""; }; - A56D622E916F305372A8469BBE973080 /* KeyboardSpy-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "KeyboardSpy-umbrella.h"; sourceTree = ""; }; - A7D18E457963DABA37CD5D647FAE7C36 /* Request.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Request.swift; path = Source/Request.swift; sourceTree = ""; }; + A08376A79D718A23EFEA405F28F2C8CD /* KeyboardSpyEvent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyboardSpyEvent.swift; path = KeyboardSpy/Classes/KeyboardSpyEvent.swift; sourceTree = ""; }; + A19CD45AF8C46A0A720D21F69FDF6BCB /* ConstraintDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDSL.swift; path = Source/ConstraintDSL.swift; sourceTree = ""; }; + A20E275A0C2C8BE1F72C5AB5A3DF2E01 /* KeyboardSpy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyboardSpy.swift; path = KeyboardSpy/Classes/KeyboardSpy.swift; sourceTree = ""; }; + A460B75FFEB80630A1623154DE748597 /* HTTPHeaders.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HTTPHeaders.swift; path = Source/HTTPHeaders.swift; sourceTree = ""; }; + A6700AF2AF475672AE51A3B827BF8BBC /* KeyboardSpy.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = KeyboardSpy.modulemap; sourceTree = ""; }; + A8124A3370E07C0B3434D3F9E9FC8E53 /* MarqueeLabel-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "MarqueeLabel-umbrella.h"; sourceTree = ""; }; A834FA6B54CFEE22975D6226DBB30999 /* AlamoRecord-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "AlamoRecord-Info.plist"; sourceTree = ""; }; + A90B7AAA69FC35875CF5FF5BDBC18939 /* GrowingNotificationBanner.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = GrowingNotificationBanner.swift; path = NotificationBanner/Classes/GrowingNotificationBanner.swift; sourceTree = ""; }; AA65B2167C8B4564B9E6E171CDCFF2CE /* Pods-AlamoRecord_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-AlamoRecord_Example-acknowledgements.plist"; sourceTree = ""; }; AA70BC4DC4521412986C8932E7F5DF5D /* Pods-Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Tests.release.xcconfig"; sourceTree = ""; }; ABA6384B15D1CB24D1F2538CDCCE8A0B /* Pods-Tests-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Tests-Info.plist"; sourceTree = ""; }; - AD7F209A66EA00AAF392E29CB39BD904 /* URLTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = URLTransform.swift; path = Sources/URLTransform.swift; sourceTree = ""; }; - ADD50A84B921BBE457CBCF258725924C /* KeyboardSpyEvent.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = KeyboardSpyEvent.swift; path = KeyboardSpy/Classes/KeyboardSpyEvent.swift; sourceTree = ""; }; - ADDAC50344091227B60EEAC680FD7A87 /* MarqueeLabel.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = MarqueeLabel.modulemap; sourceTree = ""; }; + ACF8081EEEE76AAD4F0C7EC76A4AAE65 /* Debugging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debugging.swift; path = Source/Debugging.swift; sourceTree = ""; }; AF1A077B0BDBCE1A817FE9245E2C1F52 /* StatusCodeObserver.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StatusCodeObserver.swift; path = AlamoRecord/Classes/StatusCodeObserver.swift; sourceTree = ""; }; - AF65D5D1A361F18FCC13B0A56F7B2E99 /* Alamofire-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Alamofire-dummy.m"; sourceTree = ""; }; - B09EAB01E5527FA2B0B7E57EB1F11FEE /* String+heightForConstrainedWidth.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "String+heightForConstrainedWidth.swift"; path = "NotificationBanner/Classes/String+heightForConstrainedWidth.swift"; sourceTree = ""; }; - B19ADE34DFB1592D54754675C372696F /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Source/MultipartFormData.swift; sourceTree = ""; }; + AF1AA84406EBB5E3866FEC809F5AD161 /* ServerTrustEvaluation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ServerTrustEvaluation.swift; path = Source/ServerTrustEvaluation.swift; sourceTree = ""; }; B1F921D7DE3CF3D1E50CBBDEED6B8E56 /* RequestManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RequestManager.swift; path = AlamoRecord/Classes/RequestManager.swift; sourceTree = ""; }; - B2705CA753350F7A3A3C056FF3D39B85 /* BannerHapticGenerator.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BannerHapticGenerator.swift; path = NotificationBanner/Classes/BannerHapticGenerator.swift; sourceTree = ""; }; - B2C87FA79F9C1BB4A8C248B1A128F017 /* ObjectMapper.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = ObjectMapper.xcconfig; sourceTree = ""; }; - B32975EC2DA5CDFF49C6DE8068A3AADC /* Timeline.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timeline.swift; path = Source/Timeline.swift; sourceTree = ""; }; - B36DCA6D3FEC23F74CA24DFA55397071 /* ParameterEncoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoding.swift; path = Source/ParameterEncoding.swift; sourceTree = ""; }; - B752F09AF6041F71FD1FB78C94B801D0 /* ISO8601DateTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ISO8601DateTransform.swift; path = Sources/ISO8601DateTransform.swift; sourceTree = ""; }; - B888E9C9B01157570AF470F8F7F6FE9E /* NotificationBannerSwift-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "NotificationBannerSwift-dummy.m"; sourceTree = ""; }; - B8AADAE9F2E0623E45F7E8D913D2A1F2 /* ConstraintDescription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDescription.swift; path = Source/ConstraintDescription.swift; sourceTree = ""; }; - B8EFBCA05FE1ED8D779987AF49E50ECC /* ObjectMapper-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "ObjectMapper-umbrella.h"; sourceTree = ""; }; - BD47D8174DE77276132CC0E7A948C50D /* MarqueeLabel-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "MarqueeLabel-umbrella.h"; sourceTree = ""; }; - C05F5E2395B4C5AF3CBD0A299EB85885 /* NotificationBannerUtilities.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NotificationBannerUtilities.swift; path = NotificationBanner/Classes/NotificationBannerUtilities.swift; sourceTree = ""; }; - C06E24A668380282906EC2ECD2644E1A /* DispatchQueue+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Alamofire.swift"; path = "Source/DispatchQueue+Alamofire.swift"; sourceTree = ""; }; + B204DFACB00A11293713845A654AFDFF /* ConstraintView+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ConstraintView+Extensions.swift"; path = "Source/ConstraintView+Extensions.swift"; sourceTree = ""; }; + B2E99AEA748448495DDBA0170EAF2062 /* NotificationBannerUtilities.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NotificationBannerUtilities.swift; path = NotificationBanner/Classes/NotificationBannerUtilities.swift; sourceTree = ""; }; + B4E5FF1681F3BD9398E3EE7CF6E70D84 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B56580985349C472B7F212E3A19D9037 /* ConstraintRelatableTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintRelatableTarget.swift; path = Source/ConstraintRelatableTarget.swift; sourceTree = ""; }; + B5F881285A2243308D85D285D9BF8A06 /* MarqueeLabel.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MarqueeLabel.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + B60CC2504B346CFF500A070D328F8227 /* ConstraintLayoutGuide+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ConstraintLayoutGuide+Extensions.swift"; path = "Source/ConstraintLayoutGuide+Extensions.swift"; sourceTree = ""; }; + B7FB2260878E45887F6138A1D0948E5A /* NotificationBannerSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = NotificationBannerSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + BD2B7C97D3DE9ACBA2861B0B5E5FE1A6 /* Typealiases.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Typealiases.swift; path = Source/Typealiases.swift; sourceTree = ""; }; + BEEA5EACD093B45B8278EECB70A32907 /* ConstraintLayoutSupport.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutSupport.swift; path = Source/ConstraintLayoutSupport.swift; sourceTree = ""; }; C0C1AE1CEB5325B694E973B9BA0DC09B /* Pods-AlamoRecord_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-AlamoRecord_Example-frameworks.sh"; sourceTree = ""; }; - C0C8618C93771E9A1AA2EDBE48610178 /* DateFormatterTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DateFormatterTransform.swift; path = Sources/DateFormatterTransform.swift; sourceTree = ""; }; - C1F7685CFAF06D9BC9256D74B3FA9792 /* KeyboardSpy.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = KeyboardSpy.modulemap; sourceTree = ""; }; - C3873D7DB4EDC42629767800FC7D325D /* ConstraintDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDSL.swift; path = Source/ConstraintDSL.swift; sourceTree = ""; }; - C635984B8203FAA3A909B63E32665EB3 /* ToJSON.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ToJSON.swift; path = Sources/ToJSON.swift; sourceTree = ""; }; - C64E9817C9292918A417FE823434AC66 /* MarqueeLabel-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "MarqueeLabel-Info.plist"; sourceTree = ""; }; - C6DDF4FB814BA8F946383AF15600E294 /* AlamoRecord.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; path = AlamoRecord.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - C8353D18C1213689D7CCE859A5F68AD1 /* SnapKit-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SnapKit-Info.plist"; sourceTree = ""; }; - C94AC8995BF8FABEC313CBE55177B4D7 /* KeyboardSpy.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = KeyboardSpy.xcconfig; sourceTree = ""; }; - CB2CE8655B78FBE06EAE5AE478C31629 /* NotificationBannerQueue.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NotificationBannerQueue.swift; path = NotificationBanner/Classes/NotificationBannerQueue.swift; sourceTree = ""; }; - CD75853B729C60DCBFBCAFD14F7C1AD2 /* ConstraintMakerPriortizable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerPriortizable.swift; path = Source/ConstraintMakerPriortizable.swift; sourceTree = ""; }; - CDC2B743F1C36E432376A6C20D530136 /* Alamofire-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Alamofire-Info.plist"; sourceTree = ""; }; - CF16D951E2E0F7C5432D492AA3B26FCA /* AFError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AFError.swift; path = Source/AFError.swift; sourceTree = ""; }; - D4625CFB5ACA5BED57DE31FA8792AB3B /* ImmutableMappable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ImmutableMappable.swift; path = Sources/ImmutableMappable.swift; sourceTree = ""; }; + C10F2C81523673581050F158C6D1691B /* RequestTaskMap.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RequestTaskMap.swift; path = Source/RequestTaskMap.swift; sourceTree = ""; }; + C147AE9895A70067E1E947FE38E6765C /* AFResult.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AFResult.swift; path = Source/AFResult.swift; sourceTree = ""; }; + C593B5B4795FC32FE77C9494DC1AFDF2 /* LayoutConstraintItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LayoutConstraintItem.swift; path = Source/LayoutConstraintItem.swift; sourceTree = ""; }; + C6DDF4FB814BA8F946383AF15600E294 /* AlamoRecord.podspec */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; path = AlamoRecord.podspec; sourceTree = ""; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + CE6CE49F232C2965FC8ED5EEDE0C9AB6 /* Notifications.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Notifications.swift; path = Source/Notifications.swift; sourceTree = ""; }; + D1CAFE01B8FE036C9C3D7B4D24823E03 /* KeyboardSpy-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "KeyboardSpy-prefix.pch"; sourceTree = ""; }; + D4E9E0CB2C5FFD1DACC42E19AA5077AD /* RetryPolicy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RetryPolicy.swift; path = Source/RetryPolicy.swift; sourceTree = ""; }; + D5108FE68F99DA272BA99E7D5239A48F /* Request.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Request.swift; path = Source/Request.swift; sourceTree = ""; }; D557EB749A1A3921A51C7E1D4DA5918F /* AlamoRecordError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AlamoRecordError.swift; path = AlamoRecord/Classes/AlamoRecordError.swift; sourceTree = ""; }; - D72E61BF80B186C8BE4A7F40101A7BEE /* KeyboardSpy.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = KeyboardSpy.framework; path = KeyboardSpy.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D8469B6F0CFD4043F6CE6EA468AC2287 /* Pods-Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Tests.debug.xcconfig"; sourceTree = ""; }; - DBB9F96850DA4C60CBBBE8F92C4AB2D4 /* AlamofireObjectMapper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AlamofireObjectMapper.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DCF610A7F46279C67770D6B6283819CE /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DD113B4E3CD8AFA80C8629CD7B77A41A /* SnapKit.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SnapKit.xcconfig; sourceTree = ""; }; + DB1F09D84E29A3D5E4238FAF456FED40 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DBD0960156B56BC727589993C13DBEC3 /* ConstraintViewDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintViewDSL.swift; path = Source/ConstraintViewDSL.swift; sourceTree = ""; }; + DBE9236D0F7491CB6DB9998F1BD8B3E4 /* ConstraintMaker.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMaker.swift; path = Source/ConstraintMaker.swift; sourceTree = ""; }; + DD5F14B4C61B0E45B4EA0709991EE207 /* BannerColors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BannerColors.swift; path = NotificationBanner/Classes/BannerColors.swift; sourceTree = ""; }; DD884B1BA395376837A41FB973CFB1CC /* ErrorParser.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ErrorParser.swift; path = AlamoRecord/Classes/ErrorParser.swift; sourceTree = ""; }; DE392E429D3AA0CAF8BA64B3AC9811E0 /* AlamoRecord-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "AlamoRecord-umbrella.h"; sourceTree = ""; }; - E282E4DBF370859C58A6438BA4C3BC02 /* ConstraintMaker.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMaker.swift; path = Source/ConstraintMaker.swift; sourceTree = ""; }; - E2ED549F2DC83D7271F7248E4203429D /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + DECD749DD0BBC7E30B1FFA94E9953D65 /* Alamofire-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-umbrella.h"; sourceTree = ""; }; + DF50390352C0AC48349B817861F6206D /* CachedResponseHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = CachedResponseHandler.swift; path = Source/CachedResponseHandler.swift; sourceTree = ""; }; + DFEAD6F7A97F87822ED3027B2C0C5943 /* ConstraintMakerPriortizable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerPriortizable.swift; path = Source/ConstraintMakerPriortizable.swift; sourceTree = ""; }; E51119BAD1E76F2E29C7A19160D43C96 /* AlamoRecordObject.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AlamoRecordObject.swift; path = AlamoRecord/Classes/AlamoRecordObject.swift; sourceTree = ""; }; E5FB64F02A3F471AE588FF9B854C6D7B /* Pods-Tests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Tests-acknowledgements.plist"; sourceTree = ""; }; - E6CF029317CB422EDD8F5CE63EE27367 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SnapKit.framework; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - EA085235155CEF376BABD3F403DAF7AB /* SessionDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionDelegate.swift; path = Source/SessionDelegate.swift; sourceTree = ""; }; - EE62ACF3611869B5E31F54B3DC5E34B6 /* SnapKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SnapKit-prefix.pch"; sourceTree = ""; }; - EFC3391A4077A38A410CB2627D53B321 /* LayoutConstraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LayoutConstraint.swift; path = Source/LayoutConstraint.swift; sourceTree = ""; }; + E7198C32DC947419CB7C2E75C3EA3A65 /* String+heightForConstrainedWidth.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "String+heightForConstrainedWidth.swift"; path = "NotificationBanner/Classes/String+heightForConstrainedWidth.swift"; sourceTree = ""; }; + EA692E121C536F3A533B162086769302 /* KeyboardSpy-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "KeyboardSpy-umbrella.h"; sourceTree = ""; }; + EBF5371F2AC6A7D5466CD4BCB3C7A571 /* Alamofire-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Alamofire-Info.plist"; sourceTree = ""; }; EFE517016DE8687C521833DCD3C9E95D /* Pods-AlamoRecord_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-AlamoRecord_Example-dummy.m"; sourceTree = ""; }; F07FD18089A35DE6118D46AB7E6F7F18 /* Logger.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Logger.swift; path = AlamoRecord/Classes/Logger.swift; sourceTree = ""; }; - F0A9E80D43C77A5DCA464A3A588E53F6 /* ServerTrustPolicy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ServerTrustPolicy.swift; path = Source/ServerTrustPolicy.swift; sourceTree = ""; }; - F183E50C6F582180944249C26B3976CE /* ConstraintLayoutGuide.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutGuide.swift; path = Source/ConstraintLayoutGuide.swift; sourceTree = ""; }; - F1AE9BB049C5EE2D232F3131DA9FA3AA /* Typealiases.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Typealiases.swift; path = Source/Typealiases.swift; sourceTree = ""; }; - F5811A20A9551928A25CF0235A9906C6 /* ObjectMapper-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "ObjectMapper-prefix.pch"; sourceTree = ""; }; - F617C72E2FD384977701BFBDD1E9FEDF /* ConstraintMakerRelatable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerRelatable.swift; path = Source/ConstraintMakerRelatable.swift; sourceTree = ""; }; - F8E995C812F4E1BD0F13AD692C753A7F /* ConstraintItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintItem.swift; path = Source/ConstraintItem.swift; sourceTree = ""; }; - FA52B3307CF62B01DF8E9DFB2867F19E /* EnumTransform.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EnumTransform.swift; path = Sources/EnumTransform.swift; sourceTree = ""; }; - FB48A323817DDC176F26C7CE69B1D321 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Alamofire.framework; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F0991BC521C4942AFB7D867C3229A6C7 /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Source/MultipartFormData.swift; sourceTree = ""; }; + F2BE65A336256FD262C92432BB3CE442 /* NotificationBannerSwift.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = NotificationBannerSwift.xcconfig; sourceTree = ""; }; + F53CBCED9B997C0E6EA9B4F1670141B6 /* BannerStyle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BannerStyle.swift; path = NotificationBanner/Classes/BannerStyle.swift; sourceTree = ""; }; + F571C2164478BA0A90BA4044F60B7CA5 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + F628D9D43D46FDB435702F512C8803CC /* LayoutConstraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LayoutConstraint.swift; path = Source/LayoutConstraint.swift; sourceTree = ""; }; + F793A0808A70024D4C7FC2288EF1E956 /* Validation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Source/Validation.swift; sourceTree = ""; }; + FC7CA066C5B4E667A5FD1641C791E2D1 /* Alamofire-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Alamofire-dummy.m"; sourceTree = ""; }; FC8E2B4D3AD57569286DD16552BD0C83 /* AlamoRecordURL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AlamoRecordURL.swift; path = AlamoRecord/Classes/AlamoRecordURL.swift; sourceTree = ""; }; - FD31C6FE8C49CAF7CC0FA4775732786A /* Alamofire.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Alamofire.xcconfig; sourceTree = ""; }; - FD8C3CD55330C65364B75B93B4C1D593 /* ConstraintLayoutGuideDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutGuideDSL.swift; path = Source/ConstraintLayoutGuideDSL.swift; sourceTree = ""; }; - FF4095683BE4B1801975A55A61E5B7F0 /* Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alamofire.swift; path = Source/Alamofire.swift; sourceTree = ""; }; - FF93A36F4AE7FA8EADFAAD2852AF4397 /* Alamofire-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-prefix.pch"; sourceTree = ""; }; + FCD1538074F7FDA9A4C4441E048A681E /* Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alamofire.swift; path = Source/Alamofire.swift; sourceTree = ""; }; + FD71416AFB2DA01404DD9FB79BBBBDA3 /* SnapKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SnapKit-prefix.pch"; sourceTree = ""; }; + FD7606470BA8DEF2E411F008ECEA1F46 /* ResponseSerialization.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ResponseSerialization.swift; path = Source/ResponseSerialization.swift; sourceTree = ""; }; + FDCED1B6F3A0CDB234906438635F1C04 /* ConstraintOffsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintOffsetTarget.swift; path = Source/ConstraintOffsetTarget.swift; sourceTree = ""; }; + FDFFC322ED2730F340C04F545B2E7769 /* SnapKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SnapKit.modulemap; sourceTree = ""; }; + FF0D9B540B5408590D4FB5828E9C614C /* MarqueeLabel-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "MarqueeLabel-Info.plist"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 00C302CDB1E8ED410A3576841000BB89 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 51AC4C9BF88335DACA79A8676E5677E4 /* AlamofireObjectMapper.framework in Frameworks */, - 90106EE3BC220C98588CBAFF58653E78 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 21A635C26464218398A2F442365F57CB /* Frameworks */ = { + 6B440CF3AF1B2AA0DD36901672E18641 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9CB583D9D590B393ECFC9E118EF4103E /* Foundation.framework in Frameworks */, + 12075157A00AEB436B81EE7F30A39ED4 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 45ED8B159A97749309D4BE4C9C29C665 /* Frameworks */ = { + 89E554C4CEB9F6ADA1FC8D7C36AA1C8E /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 059603888075C317971A67A7C0FB2BDF /* Alamofire.framework in Frameworks */, - DE55962F75288607CD2183F80A4D223B /* Foundation.framework in Frameworks */, - 33E1D1AABC1408623B60017EB8DA0A88 /* ObjectMapper.framework in Frameworks */, + A5B000E9E3FEEF484B648C0D67FA4096 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 856F5790A9C2FC8BD2C98A0EE25C8872 /* Frameworks */ = { + 8CCA53CF29317955143C4339A8B5B646 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E6F0911747D36BB05B096E3C8E0A11D7 /* Foundation.framework in Frameworks */, + 0B9136E10A10E7DA166FA1C0FE890F41 /* Foundation.framework in Frameworks */, + C8E9E4A08330E4931C61EDD3527B6E2C /* MarqueeLabel.framework in Frameworks */, + D22F6F9872046E3D6229D897C34379CC /* SnapKit.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 89E554C4CEB9F6ADA1FC8D7C36AA1C8E /* Frameworks */ = { + BA826BDD7E34CCD06F20A1B9F5D693B1 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A5B000E9E3FEEF484B648C0D67FA4096 /* Foundation.framework in Frameworks */, + EDBBE22742DF1243A34C0429DC2F6E0F /* Alamofire.framework in Frameworks */, + AD3B58BEDA6E46FDA7CF9643F1863AD5 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - 8CCA53CF29317955143C4339A8B5B646 /* Frameworks */ = { + BF98892EDF450FC2F4F44C5F7AF33584 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 0B9136E10A10E7DA166FA1C0FE890F41 /* Foundation.framework in Frameworks */, - C8E9E4A08330E4931C61EDD3527B6E2C /* MarqueeLabel.framework in Frameworks */, - D22F6F9872046E3D6229D897C34379CC /* SnapKit.framework in Frameworks */, + E4EFE44864C5BBBDDC04F5ED3786BF0B /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; - CF7B8B80CA837517DB32A5426DAEF79D /* Frameworks */ = { + F0385CFD0F08A68A00EEABF0118CB3EA /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 38E557B68266D46E019E2665C4253AD4 /* Foundation.framework in Frameworks */, + FA548C954F24AE41DC616F6FA6A764A4 /* CFNetwork.framework in Frameworks */, + 86220456689EC309DB8E7BA1D3A66477 /* Foundation.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -533,14 +440,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - F1626ADC3A7EC435D2722B3173355D36 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 3BD1DAFE1F3E6C9E4EB0F2099B6D6FA2 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; F7A7823F1039142D608683A2E6B7B542 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; @@ -554,68 +453,35 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 00C9BED76DFA11B4F5244E560FE96991 /* NotificationBannerSwift */ = { + 050DF23815919A63EAFDE0EB65A3BD8D /* Frameworks */ = { isa = PBXGroup; children = ( - 40F141EB436A5E0EEB7EA65C506FBA71 /* BannerColors.swift */, - B2705CA753350F7A3A3C056FF3D39B85 /* BannerHapticGenerator.swift */, - 3B690DC94AB97C77B5ED24EA73A8032F /* BannerPositionFrame.swift */, - 49B0E203D2CB9BC96D32F2533B6A7C60 /* BannerStyle.swift */, - 6B96C90A9FAD16EF903E40FCCAD8BF77 /* BaseNotificationBanner.swift */, - 3354E9B4F2223F341FAE9019BDC3CD16 /* FloatGrowingNotificationBanner.swift */, - 91170D0D82346FEAAE80B9ACB43605FB /* GrowingNotificationBanner.swift */, - 54547DB6EFF6814C1C1EB771BAFB7982 /* NotificationBanner.swift */, - CB2CE8655B78FBE06EAE5AE478C31629 /* NotificationBannerQueue.swift */, - C05F5E2395B4C5AF3CBD0A299EB85885 /* NotificationBannerUtilities.swift */, - 350CD04A3950CF96F1A71B563729300B /* StatusBarNotificationBanner.swift */, - B09EAB01E5527FA2B0B7E57EB1F11FEE /* String+heightForConstrainedWidth.swift */, - 8AA868054DE5B6AE15FF033DC647AD30 /* Support Files */, + F571C2164478BA0A90BA4044F60B7CA5 /* Alamofire.framework */, + 99E2285C471300A5D2895FF65F407971 /* MarqueeLabel.framework */, + DB1F09D84E29A3D5E4238FAF456FED40 /* SnapKit.framework */, + 0929B71AE83CB604EF2ED7FFED0C331E /* iOS */, ); - name = NotificationBannerSwift; - path = NotificationBannerSwift; + name = Frameworks; sourceTree = ""; }; - 03712D5253744A20658DB9A5C16F0E2C /* SnapKit */ = { + 0929B71AE83CB604EF2ED7FFED0C331E /* iOS */ = { isa = PBXGroup; children = ( - 213473CEED915F00E1E1D33310005755 /* Constraint.swift */, - 4C854944A3178BECC85F96DF60B5A97C /* ConstraintAttributes.swift */, - 19FC9C238EC1BDDD89A0CD6F0EB9673B /* ConstraintConfig.swift */, - 8264135DF2820C0D1A7F533C48D2A300 /* ConstraintConstantTarget.swift */, - B8AADAE9F2E0623E45F7E8D913D2A1F2 /* ConstraintDescription.swift */, - C3873D7DB4EDC42629767800FC7D325D /* ConstraintDSL.swift */, - 15DF2C5C4F93FAC0BEDC802D5571EB01 /* ConstraintInsets.swift */, - 218CC958A08B26670CEC3CD51D393A1E /* ConstraintInsetTarget.swift */, - F8E995C812F4E1BD0F13AD692C753A7F /* ConstraintItem.swift */, - F183E50C6F582180944249C26B3976CE /* ConstraintLayoutGuide.swift */, - 815285991858A8A97BE0FF81659A6728 /* ConstraintLayoutGuide+Extensions.swift */, - FD8C3CD55330C65364B75B93B4C1D593 /* ConstraintLayoutGuideDSL.swift */, - 84AF4FC5BA5B58C3B1706C9A9607523E /* ConstraintLayoutSupport.swift */, - 06EAA2C50CB99C7BB54B80AFEFB0343D /* ConstraintLayoutSupportDSL.swift */, - E282E4DBF370859C58A6438BA4C3BC02 /* ConstraintMaker.swift */, - 934B334C0600030B89197A60A6DBA675 /* ConstraintMakerEditable.swift */, - 0217D4E44FD6D154FA86624AA141EA0F /* ConstraintMakerExtendable.swift */, - 01FD9852175271ADCA1150DE380023C4 /* ConstraintMakerFinalizable.swift */, - CD75853B729C60DCBFBCAFD14F7C1AD2 /* ConstraintMakerPriortizable.swift */, - F617C72E2FD384977701BFBDD1E9FEDF /* ConstraintMakerRelatable.swift */, - 215F4A1A28905320E0ADB77A7787C9A5 /* ConstraintMultiplierTarget.swift */, - 79415C4C5B2D92AAAFA0E7C01814EB70 /* ConstraintOffsetTarget.swift */, - 2E0BD13787623254480353B4BDA81F84 /* ConstraintPriority.swift */, - 449904D2F47AF0F10B2900948BAED969 /* ConstraintPriorityTarget.swift */, - 2A2CCF4B0FDDD6AFECE7B89C04ED1BC1 /* ConstraintRelatableTarget.swift */, - 2A3B55314B211B6C48BA67549D43E648 /* ConstraintRelation.swift */, - 9835856025CD11E340D3151D91023A02 /* ConstraintView.swift */, - 82B4E664058041A39A467472B49D0C11 /* ConstraintView+Extensions.swift */, - 7D743022554B904DB53D6D96B5FE07DE /* ConstraintViewDSL.swift */, - 10AD5C92C89277A1340FFDC2E6A7A366 /* Debugging.swift */, - EFC3391A4077A38A410CB2627D53B321 /* LayoutConstraint.swift */, - 347258D7DA6785927BD639C7C9D2F71B /* LayoutConstraintItem.swift */, - F1AE9BB049C5EE2D232F3131DA9FA3AA /* Typealiases.swift */, - 19ED65590817E36BDEDD34B9B0AC9C90 /* UILayoutSupport+Extensions.swift */, - C9AA94FD958EA8108E35B82548127B31 /* Support Files */, + 0B0CC5EC9362CEA08BE90F2E7C1B255F /* CFNetwork.framework */, + 5C1A1DFAD7B1CF36B6B0ECA2E204F49E /* Foundation.framework */, + 98A295464AAFAEA2CFDFC1DDF82CB4F6 /* QuartzCore.framework */, + 8034F172A40F594F703C825A1A5111AD /* UIKit.framework */, ); - name = SnapKit; - path = SnapKit; + name = iOS; + sourceTree = ""; + }; + 0B977A6BAD6F91A93715C64E289DFBF7 /* MarqueeLabel */ = { + isa = PBXGroup; + children = ( + 3ABF6902831972177036147ECE4CBBC9 /* MarqueeLabel.swift */, + B1C8E1C0EE88114E548CA2CCAFBC4BC3 /* Support Files */, + ); + path = MarqueeLabel; sourceTree = ""; }; 1C97683CD65CDB9202E0260976E4C814 /* Development Pods */ = { @@ -626,6 +492,45 @@ name = "Development Pods"; sourceTree = ""; }; + 1F35566593ABCA5FB2E9BFADE2727B35 /* Alamofire */ = { + isa = PBXGroup; + children = ( + 004611CCBC80B2CA56C6332A34A7572F /* AFError.swift */, + C147AE9895A70067E1E947FE38E6765C /* AFResult.swift */, + FCD1538074F7FDA9A4C4441E048A681E /* Alamofire.swift */, + 34F2BBD93DB8E31308CB7FFDA9E439DE /* AlamofireExtended.swift */, + DF50390352C0AC48349B817861F6206D /* CachedResponseHandler.swift */, + 87B25B4C74539EC55678005AAC0EBE6B /* DispatchQueue+Alamofire.swift */, + 053CACA91F2E751BFAD8722331559429 /* EventMonitor.swift */, + A460B75FFEB80630A1623154DE748597 /* HTTPHeaders.swift */, + 08C41B926D6B76D888B2B5239CC0E403 /* HTTPMethod.swift */, + F0991BC521C4942AFB7D867C3229A6C7 /* MultipartFormData.swift */, + 504AFD1E039AE867356420B7C0C901AE /* MultipartUpload.swift */, + 1728953ACC9C0718E397DCF055C058E4 /* NetworkReachabilityManager.swift */, + CE6CE49F232C2965FC8ED5EEDE0C9AB6 /* Notifications.swift */, + 73EE703765293DD90041D329EBEB2CF1 /* OperationQueue+Alamofire.swift */, + 4D57C435AFC6D6A2C0414A90DE35E807 /* ParameterEncoder.swift */, + 5DD85328FAA744087DE8172FB2929E95 /* ParameterEncoding.swift */, + 1B0071976763A642EAAFA226B3170B2F /* Protector.swift */, + 2F9C762E1170660BCF5158E17B1D99F7 /* RedirectHandler.swift */, + D5108FE68F99DA272BA99E7D5239A48F /* Request.swift */, + 24ED80356652F7DBB5EBAB5E448F5AA6 /* RequestInterceptor.swift */, + C10F2C81523673581050F158C6D1691B /* RequestTaskMap.swift */, + 65D6DDA179FD4D65C1F64C7C8BC6F949 /* Response.swift */, + FD7606470BA8DEF2E411F008ECEA1F46 /* ResponseSerialization.swift */, + D4E9E0CB2C5FFD1DACC42E19AA5077AD /* RetryPolicy.swift */, + AF1AA84406EBB5E3866FEC809F5AD161 /* ServerTrustEvaluation.swift */, + 194E88402915B03DEFF66DD825385422 /* Session.swift */, + 08B29434B60C2153F9CB8D18D3378D64 /* SessionDelegate.swift */, + 25CC63271DAB30A19EC738FD14C062D7 /* URLConvertible+URLRequestConvertible.swift */, + 0F99929244F997A21EAC8303B4E93094 /* URLRequest+Alamofire.swift */, + 82BFF4D561F3AF63B807BCAAC63926CD /* URLSessionConfiguration+Alamofire.swift */, + F793A0808A70024D4C7FC2288EF1E956 /* Validation.swift */, + 694715C54E1F0ADFA8A189D1BD48B251 /* Support Files */, + ); + path = Alamofire; + sourceTree = ""; + }; 1F46FE41138D7DF7D9BF41629CE4B326 /* Pods-Tests */ = { isa = PBXGroup; children = ( @@ -643,36 +548,6 @@ path = "Target Support Files/Pods-Tests"; sourceTree = ""; }; - 1FB2AD5BBD6672EA83792E71EB45C483 /* Products */ = { - isa = PBXGroup; - children = ( - FB48A323817DDC176F26C7CE69B1D321 /* Alamofire.framework */, - 6D43F34CD034BD9E2E4DC744BC3049F6 /* AlamofireObjectMapper.framework */, - 5EFEE49862562AB8CC8C63777F2E3927 /* AlamoRecord.framework */, - D72E61BF80B186C8BE4A7F40101A7BEE /* KeyboardSpy.framework */, - 662459E0A08EEAF3DCEE71CE5CCCF467 /* MarqueeLabel.framework */, - 6E33519A554C64941339EA8FF7F2FA75 /* NotificationBannerSwift.framework */, - 1D061C00D10861FBDB915A8F3B181010 /* ObjectMapper.framework */, - 3495B5AAB601B330E05479622A787A21 /* Pods_AlamoRecord_Example.framework */, - 2B6F64C80705075B15098110C34AAB5C /* Pods_Tests.framework */, - E6CF029317CB422EDD8F5CE63EE27367 /* SnapKit.framework */, - ); - name = Products; - sourceTree = ""; - }; - 27480EFD91005385C1EEB40CFD4B6973 /* KeyboardSpy */ = { - isa = PBXGroup; - children = ( - 3D60FA77F919260DA1DCB14B39FE2723 /* KeyboardSpy.swift */, - 7EB07032E89A248B14916C89DDB22ECD /* KeyboardSpyAgent.swift */, - ADD50A84B921BBE457CBCF258725924C /* KeyboardSpyEvent.swift */, - 8B5F3712C37711504C196B96782E90F8 /* KeyboardSpyInfo.swift */, - 5F38B073DDE0AE2D717390C26C91C597 /* Support Files */, - ); - name = KeyboardSpy; - path = KeyboardSpy; - sourceTree = ""; - }; 2AA68FE2A881A481F5959CFD688123AF /* Targets Support Files */ = { isa = PBXGroup; children = ( @@ -682,132 +557,118 @@ name = "Targets Support Files"; sourceTree = ""; }; - 3626EA94AD02BC4BFC71F6CD3F6C395A /* ObjectMapper */ = { - isa = PBXGroup; - children = ( - 604CB73BB684B1F25C88E9569C7726AE /* CodableTransform.swift */, - 834EBA9325A3892E960FB4D4D8E6EFF5 /* CustomDateFormatTransform.swift */, - 0519FD2FE223D95E52D3D1C2ABD1760E /* DataTransform.swift */, - C0C8618C93771E9A1AA2EDBE48610178 /* DateFormatterTransform.swift */, - 42CB33DD49381C039CB689ED77B97858 /* DateTransform.swift */, - 53E25871E7E7C63F40D17552F3FBBF1B /* DictionaryTransform.swift */, - 120E6520780E7D6BAE90F463496F4B1D /* EnumOperators.swift */, - FA52B3307CF62B01DF8E9DFB2867F19E /* EnumTransform.swift */, - 878B8CDDDB7926F2F8A086B522184741 /* FromJSON.swift */, - 8C44B4FFFE68FB353B418C1D1F3AA286 /* HexColorTransform.swift */, - D4625CFB5ACA5BED57DE31FA8792AB3B /* ImmutableMappable.swift */, - 35F5DF9E484E7CE93CF13A6BC13CAAF2 /* IntegerOperators.swift */, - B752F09AF6041F71FD1FB78C94B801D0 /* ISO8601DateTransform.swift */, - 12BD10D79C2941FD5FD486410D0E967C /* Map.swift */, - 248D024518D93C44D684C704E3DF3551 /* MapError.swift */, - 1D4000709A234FE95C6100354C477D9C /* Mappable.swift */, - 7BDD7C4C5E90E9D5251990602B523979 /* Mapper.swift */, - 85B520A451A17AE070F501795A29701B /* NSDecimalNumberTransform.swift */, - 7D45D5CA2893A723C5794147D5D7C234 /* Operators.swift */, - C635984B8203FAA3A909B63E32665EB3 /* ToJSON.swift */, - 0ABD412A2CE4610A79D769C19A679B54 /* TransformOf.swift */, - 7CE34DCFFE8DFC5406F8A0085D9796CC /* TransformOperators.swift */, - 889BE315DB67139197F28DE8EE3EA85E /* TransformType.swift */, - AD7F209A66EA00AAF392E29CB39BD904 /* URLTransform.swift */, - 7019E5049E1FA47EA739A2B871A0BFF1 /* Support Files */, - ); - name = ObjectMapper; - path = ObjectMapper; - sourceTree = ""; - }; - 3D200C7B89A56096B87F1E1FCADD0252 /* AlamofireObjectMapper */ = { + 2C2CC4F9AC29BC7C0D2B17B593F71730 /* KeyboardSpy */ = { isa = PBXGroup; children = ( - 19B9CC806A2B102540A8998EFF9BB69F /* AlamofireObjectMapper.swift */, - 818E2055C2E5E43B176FD87B7CA19F11 /* Support Files */, + A20E275A0C2C8BE1F72C5AB5A3DF2E01 /* KeyboardSpy.swift */, + 3926B1C95CFAFA1E703331173F4CF3E6 /* KeyboardSpyAgent.swift */, + A08376A79D718A23EFEA405F28F2C8CD /* KeyboardSpyEvent.swift */, + 424992F538A848EBE1A36CFA06BEA98A /* KeyboardSpyInfo.swift */, + C1D3759AB2C1502BCC7F8E6BBF57AA86 /* Support Files */, ); - name = AlamofireObjectMapper; - path = AlamofireObjectMapper; + path = KeyboardSpy; sourceTree = ""; }; 462F63ED4626EF23C162491641DBDDE7 /* AlamoRecord */ = { isa = PBXGroup; children = ( + 5C25BD0522A9EFF50074320C /* AlamoRecordDecoder.swift */, D557EB749A1A3921A51C7E1D4DA5918F /* AlamoRecordError.swift */, E51119BAD1E76F2E29C7A19160D43C96 /* AlamoRecordObject.swift */, FC8E2B4D3AD57569286DD16552BD0C83 /* AlamoRecordURL.swift */, 5DF64894ACEA05955EB6E75AC8FC4782 /* Configuration.swift */, DD884B1BA395376837A41FB973CFB1CC /* ErrorParser.swift */, F07FD18089A35DE6118D46AB7E6F7F18 /* Logger.swift */, + 77E5A9629765F45843C45E74FBE2F8A5 /* Pod */, B1F921D7DE3CF3D1E50CBBDEED6B8E56 /* RequestManager.swift */, 000B3CE708AC831445FC177F077E7017 /* RequestObserver.swift */, AF1A077B0BDBCE1A817FE9245E2C1F52 /* StatusCodeObserver.swift */, - 77E5A9629765F45843C45E74FBE2F8A5 /* Pod */, 8B78522602C6E2A899D538B4719B8DB4 /* Support Files */, ); name = AlamoRecord; path = ../..; sourceTree = ""; }; - 502BDC696D6370B1EB9E3223F6C57D11 /* MarqueeLabel */ = { + 4BFCA7EEB0AC3D6A5FB246FAB2E32DE7 /* Support Files */ = { isa = PBXGroup; children = ( - 9A3AB196CC8CDB0DEB8E55829816F036 /* MarqueeLabel.swift */, - 70911AA3F602389344BDA5E02A1686EE /* Support Files */, - ); - name = MarqueeLabel; - path = MarqueeLabel; - sourceTree = ""; - }; - 57A3DA5A91C9ECF6FDB978BD3F306E8F /* Support Files */ = { - isa = PBXGroup; - children = ( - 092CA9EA42D8532373F954DECB940CB9 /* Alamofire.modulemap */, - FD31C6FE8C49CAF7CC0FA4775732786A /* Alamofire.xcconfig */, - AF65D5D1A361F18FCC13B0A56F7B2E99 /* Alamofire-dummy.m */, - CDC2B743F1C36E432376A6C20D530136 /* Alamofire-Info.plist */, - FF93A36F4AE7FA8EADFAAD2852AF4397 /* Alamofire-prefix.pch */, - 8BD87D48DDA20716B8343C140F9007E5 /* Alamofire-umbrella.h */, + 786FBA069EEFCE1F3FD8A21B9BFBF242 /* NotificationBannerSwift.modulemap */, + F2BE65A336256FD262C92432BB3CE442 /* NotificationBannerSwift.xcconfig */, + 8ED6CC6028EDA486E4998BB7EBAF4052 /* NotificationBannerSwift-dummy.m */, + 00E678BDDA678E307E9CCFD5A9E60013 /* NotificationBannerSwift-Info.plist */, + 0263821A0DEEA2F45D3D6746E5011D0C /* NotificationBannerSwift-prefix.pch */, + 396D47EB931C6DD614374085781269F0 /* NotificationBannerSwift-umbrella.h */, ); name = "Support Files"; - path = "../Target Support Files/Alamofire"; + path = "../Target Support Files/NotificationBannerSwift"; sourceTree = ""; }; - 5F38B073DDE0AE2D717390C26C91C597 /* Support Files */ = { + 55D352224B400C5961C5EAC84C5FC1CC /* SnapKit */ = { isa = PBXGroup; children = ( - C1F7685CFAF06D9BC9256D74B3FA9792 /* KeyboardSpy.modulemap */, - C94AC8995BF8FABEC313CBE55177B4D7 /* KeyboardSpy.xcconfig */, - 40F3B470948ED264367161413642731F /* KeyboardSpy-dummy.m */, - 9BF227F917DE19C09FB301EEF8E5D934 /* KeyboardSpy-Info.plist */, - 7664F92AED1D37E8A7816914EF45B6B2 /* KeyboardSpy-prefix.pch */, - A56D622E916F305372A8469BBE973080 /* KeyboardSpy-umbrella.h */, + 16CF02F87A36E46ECDD43D8DD58F3B7F /* Constraint.swift */, + 2E413280AE0E8ADED713332CD2DDD658 /* ConstraintAttributes.swift */, + 2A08E4AC23A6E9CAF23CDE3F5764F162 /* ConstraintConfig.swift */, + 6AA10BE1E9262BCBD3FBF8CA0E5DC9E1 /* ConstraintConstantTarget.swift */, + 93BA652A42056B71DA77D37706DADC11 /* ConstraintDescription.swift */, + A19CD45AF8C46A0A720D21F69FDF6BCB /* ConstraintDSL.swift */, + 74C884E2E496CE031A23390B8BF5FC29 /* ConstraintInsets.swift */, + 09D8D92F0294BA4AD00EDE414BB598FD /* ConstraintInsetTarget.swift */, + 14A366C85D07348A356D5F0A794ACFB5 /* ConstraintItem.swift */, + 2773A9829ECED212ED35EA23520318B9 /* ConstraintLayoutGuide.swift */, + B60CC2504B346CFF500A070D328F8227 /* ConstraintLayoutGuide+Extensions.swift */, + 4D8008F9E47E8C19C60843442C6F816C /* ConstraintLayoutGuideDSL.swift */, + BEEA5EACD093B45B8278EECB70A32907 /* ConstraintLayoutSupport.swift */, + 1EEC2E3441BA4E4D9233CB984CC4B6EB /* ConstraintLayoutSupportDSL.swift */, + DBE9236D0F7491CB6DB9998F1BD8B3E4 /* ConstraintMaker.swift */, + 18B58AEA863EFDD10C3D94B55E5BF9E2 /* ConstraintMakerEditable.swift */, + 67CA5B78FEC6356D234976FECF5E2F15 /* ConstraintMakerExtendable.swift */, + 3D8CC7ECCC21AE66487E086A4F165628 /* ConstraintMakerFinalizable.swift */, + DFEAD6F7A97F87822ED3027B2C0C5943 /* ConstraintMakerPriortizable.swift */, + 0B4B657FF97F9EF9CB2C5CDD8A544229 /* ConstraintMakerRelatable.swift */, + 14C3DBF105A194B9ECAFCB685F5F5EE2 /* ConstraintMultiplierTarget.swift */, + FDCED1B6F3A0CDB234906438635F1C04 /* ConstraintOffsetTarget.swift */, + 6B07266FCD2E1FC334EAF5B0E90BF699 /* ConstraintPriority.swift */, + 8866E76B360C1E410BDE12212A34D608 /* ConstraintPriorityTarget.swift */, + B56580985349C472B7F212E3A19D9037 /* ConstraintRelatableTarget.swift */, + 7E435E79679D782C7FF34B720ADE2E7D /* ConstraintRelation.swift */, + 0056561A2CAB37A70D162D1C7AAB1C14 /* ConstraintView.swift */, + B204DFACB00A11293713845A654AFDFF /* ConstraintView+Extensions.swift */, + DBD0960156B56BC727589993C13DBEC3 /* ConstraintViewDSL.swift */, + ACF8081EEEE76AAD4F0C7EC76A4AAE65 /* Debugging.swift */, + F628D9D43D46FDB435702F512C8803CC /* LayoutConstraint.swift */, + C593B5B4795FC32FE77C9494DC1AFDF2 /* LayoutConstraintItem.swift */, + BD2B7C97D3DE9ACBA2861B0B5E5FE1A6 /* Typealiases.swift */, + 609C148640B607967069037F0257FF87 /* UILayoutSupport+Extensions.swift */, + D2D9785284B96C231AC37D60A07E7AC1 /* Support Files */, ); - name = "Support Files"; - path = "../Target Support Files/KeyboardSpy"; + path = SnapKit; sourceTree = ""; }; - 7019E5049E1FA47EA739A2B871A0BFF1 /* Support Files */ = { + 694715C54E1F0ADFA8A189D1BD48B251 /* Support Files */ = { isa = PBXGroup; children = ( - 7D53630CFB1C793A2CB6966A167FAD10 /* ObjectMapper.modulemap */, - B2C87FA79F9C1BB4A8C248B1A128F017 /* ObjectMapper.xcconfig */, - 7ABE886E4AED9D9563F58D8D809528F0 /* ObjectMapper-dummy.m */, - 13B91EBE185BA444F02F9AD8B0D1A76B /* ObjectMapper-Info.plist */, - F5811A20A9551928A25CF0235A9906C6 /* ObjectMapper-prefix.pch */, - B8EFBCA05FE1ED8D779987AF49E50ECC /* ObjectMapper-umbrella.h */, + 3521E6E22044330574C3FA74960768D1 /* Alamofire.modulemap */, + 07D462748235C19C5DF4E6C8091CCC27 /* Alamofire.xcconfig */, + FC7CA066C5B4E667A5FD1641C791E2D1 /* Alamofire-dummy.m */, + EBF5371F2AC6A7D5466CD4BCB3C7A571 /* Alamofire-Info.plist */, + 98B71AD8CE912E2273C852CEB8D09B1B /* Alamofire-prefix.pch */, + DECD749DD0BBC7E30B1FFA94E9953D65 /* Alamofire-umbrella.h */, ); name = "Support Files"; - path = "../Target Support Files/ObjectMapper"; + path = "../Target Support Files/Alamofire"; sourceTree = ""; }; - 70911AA3F602389344BDA5E02A1686EE /* Support Files */ = { + 6E2F19EE6335E949F96DAA8D2507342F /* Pods */ = { isa = PBXGroup; children = ( - ADDAC50344091227B60EEAC680FD7A87 /* MarqueeLabel.modulemap */, - 2895B9338AF8DA1BB8F8DD956E59CB8E /* MarqueeLabel.xcconfig */, - 9D29A87D83FC11AA2BDEA81C29032568 /* MarqueeLabel-dummy.m */, - C64E9817C9292918A417FE823434AC66 /* MarqueeLabel-Info.plist */, - 5F3BE9D858C33D41F1C8CDCFCE3CE681 /* MarqueeLabel-prefix.pch */, - BD47D8174DE77276132CC0E7A948C50D /* MarqueeLabel-umbrella.h */, + 1F35566593ABCA5FB2E9BFADE2727B35 /* Alamofire */, + 2C2CC4F9AC29BC7C0D2B17B593F71730 /* KeyboardSpy */, + 0B977A6BAD6F91A93715C64E289DFBF7 /* MarqueeLabel */, + 795D5280D0C4EADC44F269F87711F993 /* NotificationBannerSwift */, + 55D352224B400C5961C5EAC84C5FC1CC /* SnapKit */, ); - name = "Support Files"; - path = "../Target Support Files/MarqueeLabel"; + name = Pods; sourceTree = ""; }; 77E5A9629765F45843C45E74FBE2F8A5 /* Pod */ = { @@ -820,32 +681,24 @@ name = Pod; sourceTree = ""; }; - 818E2055C2E5E43B176FD87B7CA19F11 /* Support Files */ = { + 795D5280D0C4EADC44F269F87711F993 /* NotificationBannerSwift */ = { isa = PBXGroup; children = ( - 0CF9A985DB050A33602C3F0DCA323481 /* AlamofireObjectMapper.modulemap */, - 8C9B3E136A42756FBCC4B82696B92A28 /* AlamofireObjectMapper.xcconfig */, - 4A09B1B0A8C8715314A862FC4166D810 /* AlamofireObjectMapper-dummy.m */, - 4C379AD9ECE6A3D5AED48F1BB535157A /* AlamofireObjectMapper-Info.plist */, - 08EF89F7422A45E4B0E5F5A7826B7963 /* AlamofireObjectMapper-prefix.pch */, - 413AA55CD5838B72D4B36F93C9D4E6CB /* AlamofireObjectMapper-umbrella.h */, + DD5F14B4C61B0E45B4EA0709991EE207 /* BannerColors.swift */, + 05792DD7292FA5B48C12E866AA917F25 /* BannerHapticGenerator.swift */, + 41D4089821FCA1936350003561A200FC /* BannerPositionFrame.swift */, + F53CBCED9B997C0E6EA9B4F1670141B6 /* BannerStyle.swift */, + 48128FA83E630C1AAF5EFA6CBE6808C5 /* BaseNotificationBanner.swift */, + 5E47A7A6302D8EF64879E0CC0931B13B /* FloatGrowingNotificationBanner.swift */, + A90B7AAA69FC35875CF5FF5BDBC18939 /* GrowingNotificationBanner.swift */, + 6C6D2227CCEF728754FA917323657AF8 /* NotificationBanner.swift */, + 2A5BFAF622177BEB6FDA7EF32B2380BC /* NotificationBannerQueue.swift */, + B2E99AEA748448495DDBA0170EAF2062 /* NotificationBannerUtilities.swift */, + 9059F1FD35488CAC45F8D01AD9023A2F /* StatusBarNotificationBanner.swift */, + E7198C32DC947419CB7C2E75C3EA3A65 /* String+heightForConstrainedWidth.swift */, + 4BFCA7EEB0AC3D6A5FB246FAB2E32DE7 /* Support Files */, ); - name = "Support Files"; - path = "../Target Support Files/AlamofireObjectMapper"; - sourceTree = ""; - }; - 8AA868054DE5B6AE15FF033DC647AD30 /* Support Files */ = { - isa = PBXGroup; - children = ( - 423602EDC9CDB524D3333D6E59A0E77D /* NotificationBannerSwift.modulemap */, - A152EBCE7776345A6978BF7E57DBEF00 /* NotificationBannerSwift.xcconfig */, - B888E9C9B01157570AF470F8F7F6FE9E /* NotificationBannerSwift-dummy.m */, - 2730EB1D6511E6AF0CB94D8C3BED1733 /* NotificationBannerSwift-Info.plist */, - 1D7453DABA1673B5BD3A14F1D5343093 /* NotificationBannerSwift-prefix.pch */, - 73D9C1055852F66228AB9326A79C080A /* NotificationBannerSwift-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/NotificationBannerSwift"; + path = NotificationBannerSwift; sourceTree = ""; }; 8B78522602C6E2A899D538B4719B8DB4 /* Support Files */ = { @@ -862,14 +715,32 @@ path = "Example/Pods/Target Support Files/AlamoRecord"; sourceTree = ""; }; - 9B415A054176F8F47F7D3F04031E8AA8 /* iOS */ = { + B1C8E1C0EE88114E548CA2CCAFBC4BC3 /* Support Files */ = { isa = PBXGroup; children = ( - 2CF2C9259439425C3489D4F5B38F22A8 /* Foundation.framework */, - 1D380DFD0564A547FC5E66CC2CF9BFAE /* QuartzCore.framework */, - 2BFA1879B516ACCA6863CEB33CE6D912 /* UIKit.framework */, + 344269F51893250EB845FF1E971FC9E9 /* MarqueeLabel.modulemap */, + 12C5C9D79C82067B6E34C4F656F9A243 /* MarqueeLabel.xcconfig */, + 522C37FDB9C31E8C74FFC3ECFEBEA366 /* MarqueeLabel-dummy.m */, + FF0D9B540B5408590D4FB5828E9C614C /* MarqueeLabel-Info.plist */, + 576CA603B81900C3CA26B274120B010B /* MarqueeLabel-prefix.pch */, + A8124A3370E07C0B3434D3F9E9FC8E53 /* MarqueeLabel-umbrella.h */, ); - name = iOS; + name = "Support Files"; + path = "../Target Support Files/MarqueeLabel"; + sourceTree = ""; + }; + C1D3759AB2C1502BCC7F8E6BBF57AA86 /* Support Files */ = { + isa = PBXGroup; + children = ( + A6700AF2AF475672AE51A3B827BF8BBC /* KeyboardSpy.modulemap */, + 0090D04D23AD59223CA6ABE2B1815B57 /* KeyboardSpy.xcconfig */, + 58CAD67C11D4BE3082C0836E2E4991AF /* KeyboardSpy-dummy.m */, + 09A4204C5F2BE7E966EEBA7C5756403C /* KeyboardSpy-Info.plist */, + D1CAFE01B8FE036C9C3D7B4D24823E03 /* KeyboardSpy-prefix.pch */, + EA692E121C536F3A533B162086769302 /* KeyboardSpy-umbrella.h */, + ); + name = "Support Files"; + path = "../Target Support Files/KeyboardSpy"; sourceTree = ""; }; C7F4BA43949E9F1FCC1C0EB083A17CDF /* Pods-AlamoRecord_Example */ = { @@ -889,117 +760,63 @@ path = "Target Support Files/Pods-AlamoRecord_Example"; sourceTree = ""; }; - C9AA94FD958EA8108E35B82548127B31 /* Support Files */ = { - isa = PBXGroup; - children = ( - 39C9C70D1CDE64F25058FC3C936E5833 /* SnapKit.modulemap */, - DD113B4E3CD8AFA80C8629CD7B77A41A /* SnapKit.xcconfig */, - 502FA0459DB306676EA5C3AC16180CEC /* SnapKit-dummy.m */, - C8353D18C1213689D7CCE859A5F68AD1 /* SnapKit-Info.plist */, - EE62ACF3611869B5E31F54B3DC5E34B6 /* SnapKit-prefix.pch */, - 5AC247E17A2026CA741ECD52FB64934B /* SnapKit-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/SnapKit"; - sourceTree = ""; - }; CF1408CF629C7361332E53B88F7BD30C = { isa = PBXGroup; children = ( 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, 1C97683CD65CDB9202E0260976E4C814 /* Development Pods */, - D8289906489F9F56594642E0E6225F40 /* Frameworks */, - D338915FD54CBBB622FEFC3770BF6EEA /* Pods */, - 1FB2AD5BBD6672EA83792E71EB45C483 /* Products */, + 050DF23815919A63EAFDE0EB65A3BD8D /* Frameworks */, + 6E2F19EE6335E949F96DAA8D2507342F /* Pods */, + DB014E81FCFEC94DE9D45707201FE4E7 /* Products */, 2AA68FE2A881A481F5959CFD688123AF /* Targets Support Files */, ); sourceTree = ""; }; - D338915FD54CBBB622FEFC3770BF6EEA /* Pods */ = { - isa = PBXGroup; - children = ( - D751B7CB0EE9B60E6E50C6E650026C12 /* Alamofire */, - 3D200C7B89A56096B87F1E1FCADD0252 /* AlamofireObjectMapper */, - 27480EFD91005385C1EEB40CFD4B6973 /* KeyboardSpy */, - 502BDC696D6370B1EB9E3223F6C57D11 /* MarqueeLabel */, - 00C9BED76DFA11B4F5244E560FE96991 /* NotificationBannerSwift */, - 3626EA94AD02BC4BFC71F6CD3F6C395A /* ObjectMapper */, - 03712D5253744A20658DB9A5C16F0E2C /* SnapKit */, - ); - name = Pods; - sourceTree = ""; - }; - D751B7CB0EE9B60E6E50C6E650026C12 /* Alamofire */ = { + D2D9785284B96C231AC37D60A07E7AC1 /* Support Files */ = { isa = PBXGroup; children = ( - CF16D951E2E0F7C5432D492AA3B26FCA /* AFError.swift */, - FF4095683BE4B1801975A55A61E5B7F0 /* Alamofire.swift */, - C06E24A668380282906EC2ECD2644E1A /* DispatchQueue+Alamofire.swift */, - B19ADE34DFB1592D54754675C372696F /* MultipartFormData.swift */, - 67F8332AA591F533B8673805D8BC2BE4 /* NetworkReachabilityManager.swift */, - 54F2AAD28B4E8678FA824C9C88B42268 /* Notifications.swift */, - B36DCA6D3FEC23F74CA24DFA55397071 /* ParameterEncoding.swift */, - A7D18E457963DABA37CD5D647FAE7C36 /* Request.swift */, - 69FC850F7C80DDAB589A4B8A5DF9DC9B /* Response.swift */, - 0C232CE1D829CB367E4CC353D1B55649 /* ResponseSerialization.swift */, - 8FD9498CD966C40ACE474014B5FA8827 /* Result.swift */, - F0A9E80D43C77A5DCA464A3A588E53F6 /* ServerTrustPolicy.swift */, - EA085235155CEF376BABD3F403DAF7AB /* SessionDelegate.swift */, - 215BA8533A0B8E711D2ED5D6CAEB4976 /* SessionManager.swift */, - 57809E061BA8111EDBEB220FC9A7D48B /* TaskDelegate.swift */, - B32975EC2DA5CDFF49C6DE8068A3AADC /* Timeline.swift */, - 67BF0D5DAA70A1AD94EB205FAE70B317 /* Validation.swift */, - 57A3DA5A91C9ECF6FDB978BD3F306E8F /* Support Files */, + FDFFC322ED2730F340C04F545B2E7769 /* SnapKit.modulemap */, + 83DD1DF437DC0769D32BF216F86DC851 /* SnapKit.xcconfig */, + 77ED7240D64B124AE1D8F28CCE7DF194 /* SnapKit-dummy.m */, + 72DD7D1C39A05EC0CBFC0C020A24F3FC /* SnapKit-Info.plist */, + FD71416AFB2DA01404DD9FB79BBBBDA3 /* SnapKit-prefix.pch */, + 6546EB52BBCCC8095ED60BDB9711BF51 /* SnapKit-umbrella.h */, ); - name = Alamofire; - path = Alamofire; + name = "Support Files"; + path = "../Target Support Files/SnapKit"; sourceTree = ""; }; - D8289906489F9F56594642E0E6225F40 /* Frameworks */ = { + DB014E81FCFEC94DE9D45707201FE4E7 /* Products */ = { isa = PBXGroup; children = ( - E2ED549F2DC83D7271F7248E4203429D /* Alamofire.framework */, - DBB9F96850DA4C60CBBBE8F92C4AB2D4 /* AlamofireObjectMapper.framework */, - 709570AF6AF07CD37295DE6BEBFEC138 /* MarqueeLabel.framework */, - 03F596D751854D9A88DEECC4DB3B25EE /* ObjectMapper.framework */, - DCF610A7F46279C67770D6B6283819CE /* SnapKit.framework */, - 9B415A054176F8F47F7D3F04031E8AA8 /* iOS */, + 0297F679206FD3720700DD9A5C094393 /* Alamofire.framework */, + 64A29AB26F295C677AEC43D9396B9B46 /* AlamoRecord.framework */, + 4011BB46DB18D1F63C97B3C579424106 /* KeyboardSpy.framework */, + B5F881285A2243308D85D285D9BF8A06 /* MarqueeLabel.framework */, + B7FB2260878E45887F6138A1D0948E5A /* NotificationBannerSwift.framework */, + 1F0AF9114B6850A5B612F333CBF8C764 /* Pods_AlamoRecord_Example.framework */, + 56C9AC36B053C92A05C5CAB0CDD75753 /* Pods_Tests.framework */, + B4E5FF1681F3BD9398E3EE7CF6E70D84 /* SnapKit.framework */, ); - name = Frameworks; + name = Products; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ - 23D70D9651451F43E7E8CC1A87B4B7E9 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - B6F6E4CC26451E91B59FAE0F6841DC1F /* Alamofire-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3D3A326070D8B7CAD84F15F026EC9E83 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 91F3F7D589783AE987010E227E834E5F /* Pods-Tests-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 5D46D6F2A5DE702F37F9F1CB37A84E5B /* Headers */ = { + 2BB747F82C1AD57A31D148C62E5C4081 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - A5A98B80EC8040F404F7343DCA04899E /* Pods-AlamoRecord_Example-umbrella.h in Headers */, + 2A8C8063FC1F201FCA0B5E0B577D4FC3 /* Pods-Tests-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - 69D5C17A42F0DEBA97F93493F069DBB8 /* Headers */ = { + 518107B7342BD407EC0FC2E797998FC3 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 7F424C046646FE578B5BAA8AE3D30B37 /* ObjectMapper-umbrella.h in Headers */, + D48F2B431C58B7C7D915E1C73F4603BA /* AlamoRecord-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1027,27 +844,27 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - B40D5E0A97C7755E05BA2443E5EA848F /* Headers */ = { + B20947CD9499C7D6F58E0880A5343F2A /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - CA4352B50BE1D4CD042CFE6FCDBC6E1C /* AlamoRecord-umbrella.h in Headers */, + C151F1B3F8274837EFF34C8D2E9D5BB3 /* Alamofire-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - C06C7EE22DF493D71ECAD634B8720CAD /* Headers */ = { + C836545319A64A65DD1E06A904FA4553 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - B26DBECE911AB60775C6BE6FC6F7B5FE /* AlamofireObjectMapper-umbrella.h in Headers */, + 8ED7180B604220170DC67B3ED0B70BEE /* KeyboardSpy-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; - C836545319A64A65DD1E06A904FA4553 /* Headers */ = { + FE1F599635376592204095E02BED194A /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - 8ED7180B604220170DC67B3ED0B70BEE /* KeyboardSpy-umbrella.h in Headers */, + 7770A0F6A39A762E6C8B7FF01C9E24F5 /* Pods-AlamoRecord_Example-umbrella.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1071,43 +888,26 @@ ); name = NotificationBannerSwift; productName = NotificationBannerSwift; - productReference = 6E33519A554C64941339EA8FF7F2FA75 /* NotificationBannerSwift.framework */; - productType = "com.apple.product-type.framework"; - }; - 0882708950626A3ECBCB6A065347330B /* ObjectMapper */ = { - isa = PBXNativeTarget; - buildConfigurationList = DC92ECEC653C3FB6B1248AA77F2EFE1F /* Build configuration list for PBXNativeTarget "ObjectMapper" */; - buildPhases = ( - 69D5C17A42F0DEBA97F93493F069DBB8 /* Headers */, - 55CDF698FDF1DB9C61AC91D3D2A8054E /* Sources */, - CF7B8B80CA837517DB32A5426DAEF79D /* Frameworks */, - E8CF32A8416A059F80976C71919B1CC2 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ObjectMapper; - productName = ObjectMapper; - productReference = 1D061C00D10861FBDB915A8F3B181010 /* ObjectMapper.framework */; + productReference = B7FB2260878E45887F6138A1D0948E5A /* NotificationBannerSwift.framework */; productType = "com.apple.product-type.framework"; }; - 3383968E74B5371B20BB519B170DC7FD /* Alamofire */ = { + 098B42A464D8136D2AF9CA5F88494F05 /* AlamoRecord */ = { isa = PBXNativeTarget; - buildConfigurationList = E87124444A44B7DB55208E7FEC21D331 /* Build configuration list for PBXNativeTarget "Alamofire" */; + buildConfigurationList = 0181E1A90598D4EB60B0A82096A4BE45 /* Build configuration list for PBXNativeTarget "AlamoRecord" */; buildPhases = ( - 23D70D9651451F43E7E8CC1A87B4B7E9 /* Headers */, - D5AA45D825A16470CF437028AA29D88C /* Sources */, - F1626ADC3A7EC435D2722B3173355D36 /* Frameworks */, - 28FF73341543B6F0A7DF3C20CFFEA0AA /* Resources */, + 518107B7342BD407EC0FC2E797998FC3 /* Headers */, + 6EE8111966192EF19BF9F8E106128EC1 /* Sources */, + BA826BDD7E34CCD06F20A1B9F5D693B1 /* Frameworks */, + 95912364F55150DCFE4E9AE31E8DB137 /* Resources */, ); buildRules = ( ); dependencies = ( + 5E5A223DF4AD70D73AE375B7FAC10154 /* PBXTargetDependency */, ); - name = Alamofire; - productName = Alamofire; - productReference = FB48A323817DDC176F26C7CE69B1D321 /* Alamofire.framework */; + name = AlamoRecord; + productName = AlamoRecord; + productReference = 64A29AB26F295C677AEC43D9396B9B46 /* AlamoRecord.framework */; productType = "com.apple.product-type.framework"; }; 40ADC2569ACCEFAB702FA16ADF849D69 /* SnapKit */ = { @@ -1125,27 +925,25 @@ ); name = SnapKit; productName = SnapKit; - productReference = E6CF029317CB422EDD8F5CE63EE27367 /* SnapKit.framework */; + productReference = B4E5FF1681F3BD9398E3EE7CF6E70D84 /* SnapKit.framework */; productType = "com.apple.product-type.framework"; }; - 743E4A349913BA26BF7AEE81D0D0DC34 /* AlamofireObjectMapper */ = { + 5455B208045065E5218D2C58C300B938 /* Alamofire */ = { isa = PBXNativeTarget; - buildConfigurationList = D5B09037E2CFCEEB926424362BEE6E38 /* Build configuration list for PBXNativeTarget "AlamofireObjectMapper" */; + buildConfigurationList = 43C1DD79754737EFBBA4EBDEF6191917 /* Build configuration list for PBXNativeTarget "Alamofire" */; buildPhases = ( - C06C7EE22DF493D71ECAD634B8720CAD /* Headers */, - 36673E2B01E54538B98507C8F271E5FE /* Sources */, - 45ED8B159A97749309D4BE4C9C29C665 /* Frameworks */, - 2509AD9B738598E845F816F9D7113C6F /* Resources */, + B20947CD9499C7D6F58E0880A5343F2A /* Headers */, + 7A8D8D0D235435787F3ED7628D085462 /* Sources */, + F0385CFD0F08A68A00EEABF0118CB3EA /* Frameworks */, + 899A7AA5C962E65D6EBFD19AC7E7F17A /* Resources */, ); buildRules = ( ); dependencies = ( - 3155D3CEB59D4A6B616692A447046BAF /* PBXTargetDependency */, - DA9C863ED9905AD7ACD4A26C10D28515 /* PBXTargetDependency */, ); - name = AlamofireObjectMapper; - productName = AlamofireObjectMapper; - productReference = 6D43F34CD034BD9E2E4DC744BC3049F6 /* AlamofireObjectMapper.framework */; + name = Alamofire; + productName = Alamofire; + productReference = 0297F679206FD3720700DD9A5C094393 /* Alamofire.framework */; productType = "com.apple.product-type.framework"; }; 7BD97CF7F99456542B92924626C189AE /* KeyboardSpy */ = { @@ -1163,7 +961,7 @@ ); name = KeyboardSpy; productName = KeyboardSpy; - productReference = D72E61BF80B186C8BE4A7F40101A7BEE /* KeyboardSpy.framework */; + productReference = 4011BB46DB18D1F63C97B3C579424106 /* KeyboardSpy.framework */; productType = "com.apple.product-type.framework"; }; 93560C05B87988775E43AA3CEBFCA82A /* MarqueeLabel */ = { @@ -1181,74 +979,51 @@ ); name = MarqueeLabel; productName = MarqueeLabel; - productReference = 662459E0A08EEAF3DCEE71CE5CCCF467 /* MarqueeLabel.framework */; - productType = "com.apple.product-type.framework"; - }; - 9C50279DE91B505A1A5F1D215DB85312 /* Pods-Tests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 903CBE7373774824A180D3DAD6BBFE69 /* Build configuration list for PBXNativeTarget "Pods-Tests" */; - buildPhases = ( - 3D3A326070D8B7CAD84F15F026EC9E83 /* Headers */, - F9B934321ED53DAB4C49165EFE0FA7A8 /* Sources */, - 856F5790A9C2FC8BD2C98A0EE25C8872 /* Frameworks */, - 718252F2BF143B5401EF6ABF93276D12 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 4BFA3996E1C5A2494C3143E397824776 /* PBXTargetDependency */, - 96AB1DD3D71C629164E38E0A33C9912F /* PBXTargetDependency */, - 0288690CDD9AF24562F6BE69D5CC06BA /* PBXTargetDependency */, - 4FCB3123B306C1A95AA752E63544B762 /* PBXTargetDependency */, - ); - name = "Pods-Tests"; - productName = "Pods-Tests"; - productReference = 2B6F64C80705075B15098110C34AAB5C /* Pods_Tests.framework */; + productReference = B5F881285A2243308D85D285D9BF8A06 /* MarqueeLabel.framework */; productType = "com.apple.product-type.framework"; }; - A01060550B1AD83BEC2748BACABE5B9E /* Pods-AlamoRecord_Example */ = { + F140EAC492ACB3822C8841924D5BCBF9 /* Pods-AlamoRecord_Example */ = { isa = PBXNativeTarget; - buildConfigurationList = 9DC2D5428448C650963AAE7878423D29 /* Build configuration list for PBXNativeTarget "Pods-AlamoRecord_Example" */; + buildConfigurationList = 70FE1FE1EF74C9E1FD561D1A30301B72 /* Build configuration list for PBXNativeTarget "Pods-AlamoRecord_Example" */; buildPhases = ( - 5D46D6F2A5DE702F37F9F1CB37A84E5B /* Headers */, - EB915CE922199BF4E587E8DD9A1944A1 /* Sources */, - 21A635C26464218398A2F442365F57CB /* Frameworks */, - 329466BAEDD3C4ADC258BD1094257515 /* Resources */, + FE1F599635376592204095E02BED194A /* Headers */, + 2129C9256EF08C15258F27E2859AB3A0 /* Sources */, + 6B440CF3AF1B2AA0DD36901672E18641 /* Frameworks */, + FB1F638C232D5636ACE23C11A2E7F661 /* Resources */, ); buildRules = ( ); dependencies = ( - AD4B8E8FEE8C7C70E86DB013C2904668 /* PBXTargetDependency */, - 5FE0A9D5EE07ED82A101FEA5D16756CA /* PBXTargetDependency */, - 14E09D4755E562EAB30377025B83D57F /* PBXTargetDependency */, - 51C75CF61991E4AC0E564C1665E3120B /* PBXTargetDependency */, - BF37296798C99C212787669FEC93FDD4 /* PBXTargetDependency */, - AC963BF3A8EDE4F84A95132D8D681813 /* PBXTargetDependency */, - D6AFC2995A130C240765099FD278BA88 /* PBXTargetDependency */, - DE69D910330F95FA06ED7A6C9B050028 /* PBXTargetDependency */, + C6B64E8E75291321A0A7989F5AC9C513 /* PBXTargetDependency */, + 7B084B4B406C0CE508AE3F795901145F /* PBXTargetDependency */, + CCE49B2A7F0CF4ED87F5BC2FCE45A5BC /* PBXTargetDependency */, + F4C2F723296D27F0CF26B54041C4C4C6 /* PBXTargetDependency */, + 92258FCF9450A03826193857EC5B8182 /* PBXTargetDependency */, + 852F098DB25B89B36DE856B1B6F9CBBB /* PBXTargetDependency */, ); name = "Pods-AlamoRecord_Example"; productName = "Pods-AlamoRecord_Example"; - productReference = 3495B5AAB601B330E05479622A787A21 /* Pods_AlamoRecord_Example.framework */; + productReference = 1F0AF9114B6850A5B612F333CBF8C764 /* Pods_AlamoRecord_Example.framework */; productType = "com.apple.product-type.framework"; }; - C96DAD7E39A2D336B0233A69073F19DF /* AlamoRecord */ = { + F73461D1F68AB11777B9A731BBE27B27 /* Pods-Tests */ = { isa = PBXNativeTarget; - buildConfigurationList = AC399DBE3D7144A97179979004B7AE4C /* Build configuration list for PBXNativeTarget "AlamoRecord" */; + buildConfigurationList = 4168848EBB48517A8802807F536D0576 /* Build configuration list for PBXNativeTarget "Pods-Tests" */; buildPhases = ( - B40D5E0A97C7755E05BA2443E5EA848F /* Headers */, - C241597C5D8DA885E15231A06AEDAF4A /* Sources */, - 00C302CDB1E8ED410A3576841000BB89 /* Frameworks */, - 2574CF620C3F02E3ADF5D5281BFB5E80 /* Resources */, + 2BB747F82C1AD57A31D148C62E5C4081 /* Headers */, + AD6C215C2B4E6977C2541B3ACBF38EE0 /* Sources */, + BF98892EDF450FC2F4F44C5F7AF33584 /* Frameworks */, + 88D246FFB46F3F2B17B16C12D325F844 /* Resources */, ); buildRules = ( ); dependencies = ( - 4E8F283C0912F790AB90874CB8D6C893 /* PBXTargetDependency */, + 262B90320E18463AFC7666299C8E0B34 /* PBXTargetDependency */, + 3E2BEDA5DC896CE10F4F0CFC107FB456 /* PBXTargetDependency */, ); - name = AlamoRecord; - productName = AlamoRecord; - productReference = 5EFEE49862562AB8CC8C63777F2E3927 /* AlamoRecord.framework */; + name = "Pods-Tests"; + productName = "Pods-Tests"; + productReference = 56C9AC36B053C92A05C5CAB0CDD75753 /* Pods_Tests.framework */; productType = "com.apple.product-type.framework"; }; /* End PBXNativeTarget section */ @@ -1265,22 +1040,21 @@ developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( + English, en, ); mainGroup = CF1408CF629C7361332E53B88F7BD30C; - productRefGroup = 1FB2AD5BBD6672EA83792E71EB45C483 /* Products */; + productRefGroup = DB014E81FCFEC94DE9D45707201FE4E7 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( - 3383968E74B5371B20BB519B170DC7FD /* Alamofire */, - 743E4A349913BA26BF7AEE81D0D0DC34 /* AlamofireObjectMapper */, - C96DAD7E39A2D336B0233A69073F19DF /* AlamoRecord */, + 5455B208045065E5218D2C58C300B938 /* Alamofire */, + 098B42A464D8136D2AF9CA5F88494F05 /* AlamoRecord */, 7BD97CF7F99456542B92924626C189AE /* KeyboardSpy */, 93560C05B87988775E43AA3CEBFCA82A /* MarqueeLabel */, 05FF60AFEB7D11852C2197FC7231A986 /* NotificationBannerSwift */, - 0882708950626A3ECBCB6A065347330B /* ObjectMapper */, - A01060550B1AD83BEC2748BACABE5B9E /* Pods-AlamoRecord_Example */, - 9C50279DE91B505A1A5F1D215DB85312 /* Pods-Tests */, + F140EAC492ACB3822C8841924D5BCBF9 /* Pods-AlamoRecord_Example */, + F73461D1F68AB11777B9A731BBE27B27 /* Pods-Tests */, 40ADC2569ACCEFAB702FA16ADF849D69 /* SnapKit */, ); }; @@ -1301,56 +1075,42 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 2509AD9B738598E845F816F9D7113C6F /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 2574CF620C3F02E3ADF5D5281BFB5E80 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 28FF73341543B6F0A7DF3C20CFFEA0AA /* Resources */ = { + 4CB457970B1142B49E72D11EF42A04F6 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 329466BAEDD3C4ADC258BD1094257515 /* Resources */ = { + 88D246FFB46F3F2B17B16C12D325F844 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 4CB457970B1142B49E72D11EF42A04F6 /* Resources */ = { + 899A7AA5C962E65D6EBFD19AC7E7F17A /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - 718252F2BF143B5401EF6ABF93276D12 /* Resources */ = { + 95912364F55150DCFE4E9AE31E8DB137 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - E8CF32A8416A059F80976C71919B1CC2 /* Resources */ = { + F71B9AFD6F41235D8CA3750952DCB489 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; - F71B9AFD6F41235D8CA3750952DCB489 /* Resources */ = { + FB1F638C232D5636ACE23C11A2E7F661 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( @@ -1360,12 +1120,11 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - 36673E2B01E54538B98507C8F271E5FE /* Sources */ = { + 2129C9256EF08C15258F27E2859AB3A0 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 2E5D0257EA23FF768A14A3A4BBAFDF81 /* AlamofireObjectMapper-dummy.m in Sources */, - BFE99DF0D5D49A93F430809099212374 /* AlamofireObjectMapper.swift in Sources */, + A8A568C85E8DA720DCD4AC3FD1F737F9 /* Pods-AlamoRecord_Example-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1398,38 +1157,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 55CDF698FDF1DB9C61AC91D3D2A8054E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 92CCCBD96B5F5D72AA0B53D1BE28B3E3 /* CodableTransform.swift in Sources */, - 6B6F69F37AAD16D071110F09CDB75ED7 /* CustomDateFormatTransform.swift in Sources */, - E238ECE58D1AF1FCF69950893C49D779 /* DataTransform.swift in Sources */, - 6FC2ADC124763EAFAB7D61ADF999A7A0 /* DateFormatterTransform.swift in Sources */, - CD36A84C0278E53667C6D327BA0A30C1 /* DateTransform.swift in Sources */, - 68014529230EDFDFD7724AC15E13D040 /* DictionaryTransform.swift in Sources */, - 478AAF7EA0166849EF449F07A6ADFD81 /* EnumOperators.swift in Sources */, - 9E5D5307045ACAB8BF8B00D9EC1E1FB5 /* EnumTransform.swift in Sources */, - 6A1D16C78B32AD0993396A6852C71C24 /* FromJSON.swift in Sources */, - 5709F35927410DCDA55DAB801A78D269 /* HexColorTransform.swift in Sources */, - 18F9908A2D8E6C39FC8D5C1A3643CAFC /* ImmutableMappable.swift in Sources */, - 74E569542E9D2017B93F8CC845F24279 /* IntegerOperators.swift in Sources */, - BB46766B47C42F0E3443528D3B3CD5EC /* ISO8601DateTransform.swift in Sources */, - 1E0DC649FBD5FA1F86F475FFEF6A20F2 /* Map.swift in Sources */, - 83563CCFC4B57D52A80ADFDB1C230A18 /* MapError.swift in Sources */, - 1B2CD16C2E2412DD05858D636E3EA7E4 /* Mappable.swift in Sources */, - AA0AB9037F22C4EA9B3E712A0FE43F2E /* Mapper.swift in Sources */, - 88A4088D8C257A8BE746CF24C0A1744E /* NSDecimalNumberTransform.swift in Sources */, - 468DB129E24F8911C86272113D7E39A5 /* ObjectMapper-dummy.m in Sources */, - 11D765699D13EE4F7841BE90CCDB9665 /* Operators.swift in Sources */, - 7E2EE91BAAC0B7D8F87A5D5CA36A1CD8 /* ToJSON.swift in Sources */, - 128AC72A989601909F66C3AD1432C4FF /* TransformOf.swift in Sources */, - 44CE3D3E22CCACC25495483A36369083 /* TransformOperators.swift in Sources */, - 0D247B7FD6BED62EBAF48C603546DA07 /* TransformType.swift in Sources */, - 273CB7A7349BDB62173F968C76110477 /* URLTransform.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 567F011F471F83A4B4BE0FF39877AF4C /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -1484,108 +1211,85 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - C241597C5D8DA885E15231A06AEDAF4A /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8BCA376227BE1036BAAFECFA17168D12 /* AlamoRecord-dummy.m in Sources */, - D5C01B53FB609BA73E5DE4C9CCFBAA60 /* AlamoRecordError.swift in Sources */, - A9951E52505B7BCF234447B3FF2BFD4E /* AlamoRecordObject.swift in Sources */, - 9F84A9A143208A92A0E18634F79A9760 /* AlamoRecordURL.swift in Sources */, - 7BB395EF9D22A22878D12CC5F48D672D /* Configuration.swift in Sources */, - 5CEC69E2962550BE91F896D479DE14F9 /* ErrorParser.swift in Sources */, - 0FA6F9EC9EB5F24D5A0F3EC6EB9BDCE5 /* Logger.swift in Sources */, - D9A82B7E7A06E0C9FC9AEA559A284C59 /* RequestManager.swift in Sources */, - E032556821E68D1E28F2C419673CEE74 /* RequestObserver.swift in Sources */, - 7D4D4839D07AB54F5CA28644E5E79627 /* StatusCodeObserver.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - D5AA45D825A16470CF437028AA29D88C /* Sources */ = { + 6EE8111966192EF19BF9F8E106128EC1 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8C82A0DC43F539E8961EE089DA2F55E2 /* AFError.swift in Sources */, - 5B3C54D6CA47E67D0173D4998D5DA84D /* Alamofire-dummy.m in Sources */, - 09369883A939A86D0CF866C9B1EB8949 /* Alamofire.swift in Sources */, - F1B43076C5E4AA3100AF90E970127D82 /* DispatchQueue+Alamofire.swift in Sources */, - 8286D921D81F7BA1AEDB7185194EDC9A /* MultipartFormData.swift in Sources */, - 980501A2BF77B6BD654CB772CA83F666 /* NetworkReachabilityManager.swift in Sources */, - 8585189D0D8BF1302138ACCA1D8D8A41 /* Notifications.swift in Sources */, - 5257F96980C8CE0C6ADA232B77F7E90F /* ParameterEncoding.swift in Sources */, - 2D466CE6D91A39E651FA6AF708A2A801 /* Request.swift in Sources */, - 93B86E7677061308E5D602D4AE89BAF2 /* Response.swift in Sources */, - D0A28826916584B0ED2DD4F43C1146D8 /* ResponseSerialization.swift in Sources */, - 816D8F658A00AB47546F72A655192183 /* Result.swift in Sources */, - BFDD253057221EAD2A53C62928952315 /* ServerTrustPolicy.swift in Sources */, - 240B9397F73CCBDC537707F9BC7A4511 /* SessionDelegate.swift in Sources */, - 4131149580995BD1D66C6221F487A3C3 /* SessionManager.swift in Sources */, - 7365FD63A89D0F66C595256355900917 /* TaskDelegate.swift in Sources */, - D654F916111BBECF57D0502292D2461A /* Timeline.swift in Sources */, - 3103F0EB03335F8873ED5F3FF65032F0 /* Validation.swift in Sources */, + 65F9482829E46B30BDEE8B5090A51777 /* AlamoRecord-dummy.m in Sources */, + F90CCE0F5C56A32525CCD0CFA63AD497 /* AlamoRecordError.swift in Sources */, + 36D5F871078F7FEC0EDF01FF9709E69B /* AlamoRecordObject.swift in Sources */, + 5C25BD0622A9EFF50074320C /* AlamoRecordDecoder.swift in Sources */, + 5B29BB548683F730FAFC03374C5169D9 /* AlamoRecordURL.swift in Sources */, + EF9492998EB117C194B6B2BF013BF6C3 /* Configuration.swift in Sources */, + 2EA94D2AE23D0AC4E4FC62741B99FA43 /* ErrorParser.swift in Sources */, + DE0892BCA7F7841B3CD02AECAFBFB7C1 /* Logger.swift in Sources */, + 637FDC0C3BE62D55482CE613023DB3D0 /* RequestManager.swift in Sources */, + A507F1125986B30B7BAC14F4123017E9 /* RequestObserver.swift in Sources */, + 3CC3D0938A90AA4B51A9D8DDC9747AAB /* StatusCodeObserver.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - EB915CE922199BF4E587E8DD9A1944A1 /* Sources */ = { + 7A8D8D0D235435787F3ED7628D085462 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 6D520D65677B87148A8CDC37DD13E820 /* Pods-AlamoRecord_Example-dummy.m in Sources */, + 23EB8B918358CDCB6D706260FC86DFC3 /* AFError.swift in Sources */, + 5AE63CB0AA6A6DC105546845ED0ED9B1 /* AFResult.swift in Sources */, + 32A85E3C69C4559570F707C9ABFB6703 /* Alamofire-dummy.m in Sources */, + 5E0B3AF5D479EDF7F942FD7D9968B7E0 /* Alamofire.swift in Sources */, + D22A7D8D22D158465443F083893197DE /* AlamofireExtended.swift in Sources */, + CCE1C86D007D45C4305645CE18DFB768 /* CachedResponseHandler.swift in Sources */, + 4F103671FF7EA9545B6F5A5FF8353342 /* DispatchQueue+Alamofire.swift in Sources */, + 82DC01AE7CF12FD4F8CF928B86DD4BB3 /* EventMonitor.swift in Sources */, + 01907C3A3A223653627706943E5895D0 /* HTTPHeaders.swift in Sources */, + F65A6EFAB81B22FBCD89497954C5AE2E /* HTTPMethod.swift in Sources */, + F524712400FFDCDFBD66BB224A930F45 /* MultipartFormData.swift in Sources */, + 1D6AE6A3D8A7FA6EF92115C54F890005 /* MultipartUpload.swift in Sources */, + C7BDD5ABEA0A1ACC93BA5DD9F0C0C1ED /* NetworkReachabilityManager.swift in Sources */, + DC1984523B87F391C23731D751CB5ABA /* Notifications.swift in Sources */, + F425944D372B3A18AFDCE91C2771FA6F /* OperationQueue+Alamofire.swift in Sources */, + 35FE5051FB07D565FFCB80244B058781 /* ParameterEncoder.swift in Sources */, + 5853C42A153F9AB0AD190F0753EFEEA3 /* ParameterEncoding.swift in Sources */, + C51051F25CCA591B4656421E7C045136 /* Protector.swift in Sources */, + 27D0949C74708133B627E26C9FCF3D8D /* RedirectHandler.swift in Sources */, + 5A6C1D01381312B8767F41323A0184A9 /* Request.swift in Sources */, + 5B6F87C78BC3CE0BC26B2A04FB4BC6FD /* RequestInterceptor.swift in Sources */, + B5B18BDAFFF85C31368E40950F0EEB1F /* RequestTaskMap.swift in Sources */, + 7EBD112DDEBE9E67BA288AC55EC8D687 /* Response.swift in Sources */, + E03A7E7468B35881D4B6295FF1A9A200 /* ResponseSerialization.swift in Sources */, + 19179A8F8D87C14E7BA6E9C4BCC55597 /* RetryPolicy.swift in Sources */, + D044B3E2426BCE71E87E331C5573FB0B /* ServerTrustEvaluation.swift in Sources */, + F8C5AA3174C8EB8768F7E0AC22D2460B /* Session.swift in Sources */, + 4FBC5A490611446DFBCC87B962B652B8 /* SessionDelegate.swift in Sources */, + A00C32320D2AAEC9039307A430CBCB1F /* URLConvertible+URLRequestConvertible.swift in Sources */, + 08755CA56AE42CD2CD3E216445C1FC45 /* URLRequest+Alamofire.swift in Sources */, + 9B60C9CBC40ECB22D74D2C4BBC3BCE20 /* URLSessionConfiguration+Alamofire.swift in Sources */, + 027EC92D039E77EAB5AFEDFBBBB34D3D /* Validation.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - F9B934321ED53DAB4C49165EFE0FA7A8 /* Sources */ = { + AD6C215C2B4E6977C2541B3ACBF38EE0 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - B776E5CD55DECFD9A8C70AA90C2740F0 /* Pods-Tests-dummy.m in Sources */, + 3711F5371EF1265C4391EF9FF7DB7CF7 /* Pods-Tests-dummy.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - 0288690CDD9AF24562F6BE69D5CC06BA /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = AlamofireObjectMapper; - target = 743E4A349913BA26BF7AEE81D0D0DC34 /* AlamofireObjectMapper */; - targetProxy = 5A1D23338ED041CA3697CCFE957C0182 /* PBXContainerItemProxy */; - }; - 14E09D4755E562EAB30377025B83D57F /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = AlamofireObjectMapper; - target = 743E4A349913BA26BF7AEE81D0D0DC34 /* AlamofireObjectMapper */; - targetProxy = 8FCABDDEF260E260D6F2A9A1BBFB5F16 /* PBXContainerItemProxy */; - }; - 3155D3CEB59D4A6B616692A447046BAF /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Alamofire; - target = 3383968E74B5371B20BB519B170DC7FD /* Alamofire */; - targetProxy = 9F95E621710F4B7EBD56B83C134F6AD5 /* PBXContainerItemProxy */; - }; - 4BFA3996E1C5A2494C3143E397824776 /* PBXTargetDependency */ = { + 262B90320E18463AFC7666299C8E0B34 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = AlamoRecord; - target = C96DAD7E39A2D336B0233A69073F19DF /* AlamoRecord */; - targetProxy = 6E4A57BB98DF2E96F09A02D6FCF8E328 /* PBXContainerItemProxy */; - }; - 4E8F283C0912F790AB90874CB8D6C893 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = AlamofireObjectMapper; - target = 743E4A349913BA26BF7AEE81D0D0DC34 /* AlamofireObjectMapper */; - targetProxy = 955348F5776F6CED84E6E385CB499F89 /* PBXContainerItemProxy */; - }; - 4FCB3123B306C1A95AA752E63544B762 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = ObjectMapper; - target = 0882708950626A3ECBCB6A065347330B /* ObjectMapper */; - targetProxy = AA8E631247685B6214916112686EE9CA /* PBXContainerItemProxy */; + target = 098B42A464D8136D2AF9CA5F88494F05 /* AlamoRecord */; + targetProxy = EB32560DCE3EF621F9F2B4ADA44F2574 /* PBXContainerItemProxy */; }; - 51C75CF61991E4AC0E564C1665E3120B /* PBXTargetDependency */ = { + 3E2BEDA5DC896CE10F4F0CFC107FB456 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = KeyboardSpy; - target = 7BD97CF7F99456542B92924626C189AE /* KeyboardSpy */; - targetProxy = 3AC76E94D03FB4F156558629F12EAEDA /* PBXContainerItemProxy */; + name = Alamofire; + target = 5455B208045065E5218D2C58C300B938 /* Alamofire */; + targetProxy = D715A63632471B0A927BF9667D21F646 /* PBXContainerItemProxy */; }; 5AA588F2618FF45AEBE6B37A90271F1B /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -1593,29 +1297,29 @@ target = 93560C05B87988775E43AA3CEBFCA82A /* MarqueeLabel */; targetProxy = D9EF13C4AE1BB4F440AAE30D55BBF678 /* PBXContainerItemProxy */; }; - 5FE0A9D5EE07ED82A101FEA5D16756CA /* PBXTargetDependency */ = { + 5E5A223DF4AD70D73AE375B7FAC10154 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = Alamofire; - target = 3383968E74B5371B20BB519B170DC7FD /* Alamofire */; - targetProxy = 4E4EDA87036908ADFEBC517939B0C502 /* PBXContainerItemProxy */; + target = 5455B208045065E5218D2C58C300B938 /* Alamofire */; + targetProxy = FF0DCFF2711D5AD9B1FE2F61F41456D8 /* PBXContainerItemProxy */; }; - 96AB1DD3D71C629164E38E0A33C9912F /* PBXTargetDependency */ = { + 7B084B4B406C0CE508AE3F795901145F /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = Alamofire; - target = 3383968E74B5371B20BB519B170DC7FD /* Alamofire */; - targetProxy = 69CE40A19DE8003D90BD6C7FA270FDCF /* PBXContainerItemProxy */; + target = 5455B208045065E5218D2C58C300B938 /* Alamofire */; + targetProxy = 0A73E48A3EE59CA2C9AE8177A40AEEC1 /* PBXContainerItemProxy */; }; - AC963BF3A8EDE4F84A95132D8D681813 /* PBXTargetDependency */ = { + 852F098DB25B89B36DE856B1B6F9CBBB /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = NotificationBannerSwift; - target = 05FF60AFEB7D11852C2197FC7231A986 /* NotificationBannerSwift */; - targetProxy = 7406314BF67149382A044F7CBAF62FE1 /* PBXContainerItemProxy */; + name = SnapKit; + target = 40ADC2569ACCEFAB702FA16ADF849D69 /* SnapKit */; + targetProxy = 7EBE6902BBBCF6D4AA45B71FEFBC7E5C /* PBXContainerItemProxy */; }; - AD4B8E8FEE8C7C70E86DB013C2904668 /* PBXTargetDependency */ = { + 92258FCF9450A03826193857EC5B8182 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = AlamoRecord; - target = C96DAD7E39A2D336B0233A69073F19DF /* AlamoRecord */; - targetProxy = 72BE027F0407C0A5CC1A346FB2509229 /* PBXContainerItemProxy */; + name = NotificationBannerSwift; + target = 05FF60AFEB7D11852C2197FC7231A986 /* NotificationBannerSwift */; + targetProxy = E9DF2DCABDC278E9AB9AEB7B68ABEEB0 /* PBXContainerItemProxy */; }; BC2909CF24EED6E70DEE3BE989E6F633 /* PBXTargetDependency */ = { isa = PBXTargetDependency; @@ -1623,36 +1327,30 @@ target = 40ADC2569ACCEFAB702FA16ADF849D69 /* SnapKit */; targetProxy = 6681896758E71C4BD73B5D2C27292729 /* PBXContainerItemProxy */; }; - BF37296798C99C212787669FEC93FDD4 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = MarqueeLabel; - target = 93560C05B87988775E43AA3CEBFCA82A /* MarqueeLabel */; - targetProxy = 8F4D60820A98B72636961F0A23BF3916 /* PBXContainerItemProxy */; - }; - D6AFC2995A130C240765099FD278BA88 /* PBXTargetDependency */ = { + C6B64E8E75291321A0A7989F5AC9C513 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = ObjectMapper; - target = 0882708950626A3ECBCB6A065347330B /* ObjectMapper */; - targetProxy = 803F81A9ED00474E12D041CAD20A1020 /* PBXContainerItemProxy */; + name = AlamoRecord; + target = 098B42A464D8136D2AF9CA5F88494F05 /* AlamoRecord */; + targetProxy = F26446072A67EB950F55FFAB578F4306 /* PBXContainerItemProxy */; }; - DA9C863ED9905AD7ACD4A26C10D28515 /* PBXTargetDependency */ = { + CCE49B2A7F0CF4ED87F5BC2FCE45A5BC /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = ObjectMapper; - target = 0882708950626A3ECBCB6A065347330B /* ObjectMapper */; - targetProxy = E63485A32F51F54076553D54B3F94444 /* PBXContainerItemProxy */; + name = KeyboardSpy; + target = 7BD97CF7F99456542B92924626C189AE /* KeyboardSpy */; + targetProxy = A0BAA68975C00BEE256D706506DFB18D /* PBXContainerItemProxy */; }; - DE69D910330F95FA06ED7A6C9B050028 /* PBXTargetDependency */ = { + F4C2F723296D27F0CF26B54041C4C4C6 /* PBXTargetDependency */ = { isa = PBXTargetDependency; - name = SnapKit; - target = 40ADC2569ACCEFAB702FA16ADF849D69 /* SnapKit */; - targetProxy = 460A02A78994A29719FDA2F782C84F31 /* PBXContainerItemProxy */; + name = MarqueeLabel; + target = 93560C05B87988775E43AA3CEBFCA82A /* MarqueeLabel */; + targetProxy = 86852F781E7F46AE918E0D455B3C197B /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin XCBuildConfiguration section */ 08DFF3C04CCF2803CC474F980EE1E9FF /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2895B9338AF8DA1BB8F8DD956E59CB8E /* MarqueeLabel.xcconfig */; + baseConfigurationReference = 12C5C9D79C82067B6E34C4F656F9A243 /* MarqueeLabel.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -1681,10 +1379,12 @@ }; name = Debug; }; - 1D256AFAD8F18BF1F1E48B504377A4B7 /* Release */ = { + 1567FC348A96DF6B3C41F59829754ED0 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = B2C87FA79F9C1BB4A8C248B1A128F017 /* ObjectMapper.xcconfig */; + baseConfigurationReference = AA70BC4DC4521412986C8932E7F5DF5D /* Pods-Tests.release.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -1694,18 +1394,19 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/ObjectMapper/ObjectMapper-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/ObjectMapper/ObjectMapper-Info.plist"; + INFOPLIST_FILE = "Target Support Files/Pods-Tests/Pods-Tests-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/ObjectMapper/ObjectMapper.modulemap"; - PRODUCT_MODULE_NAME = ObjectMapper; - PRODUCT_NAME = ObjectMapper; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-Tests/Pods-Tests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -1713,9 +1414,78 @@ }; name = Release; }; + 25E0BF32624779B770189760671D3299 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9DE5A69C4AEB8742E1DB715FA729587B /* Pods-AlamoRecord_Example.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 263FA2B7D9D2A1C44C9781451ECE7F22 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 0D5B54C64783A5A52E6D24C3049B15A3 /* Pods-AlamoRecord_Example.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; 26A90C7A5B64A061093D4C7306DB4344 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DD113B4E3CD8AFA80C8629CD7B77A41A /* SnapKit.xcconfig */; + baseConfigurationReference = 83DD1DF437DC0769D32BF216F86DC851 /* SnapKit.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; @@ -1745,6 +1515,40 @@ }; name = Debug; }; + 2DDA5066FFB2EFC12AD1DED3AD627573 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D8469B6F0CFD4043F6CE6EA468AC2287 /* Pods-Tests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; + CLANG_ENABLE_OBJC_WEAK = NO; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + CURRENT_PROJECT_VERSION = 1; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "Target Support Files/Pods-Tests/Pods-Tests-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MACH_O_TYPE = staticlib; + MODULEMAP_FILE = "Target Support Files/Pods-Tests/Pods-Tests.modulemap"; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; 3048B0C5C704DFFF688DA57F5380ED58 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { @@ -1798,80 +1602,16 @@ MTL_FAST_MATH = YES; PRODUCT_NAME = "$(TARGET_NAME)"; STRIP_INSTALLED_PRODUCT = NO; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_VERSION = 4.2; SYMROOT = "${SRCROOT}/../build"; }; name = Release; }; - 533220A7363132F85843031FA4F2AAAB /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FD31C6FE8C49CAF7CC0FA4775732786A /* Alamofire.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Alamofire/Alamofire-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; - PRODUCT_MODULE_NAME = Alamofire; - PRODUCT_NAME = Alamofire; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 53F579EB33F69E2357E748B5E9CF12D5 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = B2C87FA79F9C1BB4A8C248B1A128F017 /* ObjectMapper.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/ObjectMapper/ObjectMapper-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/ObjectMapper/ObjectMapper-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/ObjectMapper/ObjectMapper.modulemap"; - PRODUCT_MODULE_NAME = ObjectMapper; - PRODUCT_NAME = ObjectMapper; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.2; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 58727E2A298861EF438A1427D6419D5C /* Debug */ = { + 4EAB55DB9C286713C84FBE9EA2DC7026 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 0D5B54C64783A5A52E6D24C3049B15A3 /* Pods-AlamoRecord_Example.debug.xcconfig */; + baseConfigurationReference = 119A9CFD5491E8C6D2DA96A442F2003D /* AlamoRecord.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -1882,24 +1622,24 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/AlamoRecord/AlamoRecord-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/AlamoRecord/AlamoRecord-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + MODULEMAP_FILE = "Target Support Files/AlamoRecord/AlamoRecord.modulemap"; + PRODUCT_MODULE_NAME = AlamoRecord; + PRODUCT_NAME = AlamoRecord; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Debug; + name = Release; }; 5B0C8287D755FD95091CF35D87FB8B2D /* Debug */ = { isa = XCBuildConfiguration; @@ -1965,7 +1705,7 @@ }; name = Debug; }; - 6AA198AA771AC8BD6C56E255D70EF7F4 /* Release */ = { + 5D9BDAFF265F15F7861F797612916F97 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 119A9CFD5491E8C6D2DA96A442F2003D /* AlamoRecord.xcconfig */; buildSettings = { @@ -1992,50 +1732,14 @@ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 6CD85192FBE3965A82B2BFD865DC8877 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 9DE5A69C4AEB8742E1DB715FA729587B /* Pods-AlamoRecord_Example.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Release; + name = Debug; }; 77D2A53B4B85B8DA83F493D01B6F24D8 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2895B9338AF8DA1BB8F8DD956E59CB8E /* MarqueeLabel.xcconfig */; + baseConfigurationReference = 12C5C9D79C82067B6E34C4F656F9A243 /* MarqueeLabel.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -2065,10 +1769,11 @@ }; name = Release; }; - 926B6FD441D3FA115CD5FEA621112FE9 /* Debug */ = { + 87FCC2B9F5E6F9D87414A5E3DBD10F04 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 8C9B3E136A42756FBCC4B82696B92A28 /* AlamofireObjectMapper.xcconfig */; + baseConfigurationReference = 07D462748235C19C5DF4E6C8091CCC27 /* Alamofire.xcconfig */; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; @@ -2078,27 +1783,28 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Alamofire/Alamofire-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper.modulemap"; - PRODUCT_MODULE_NAME = AlamofireObjectMapper; - PRODUCT_NAME = AlamofireObjectMapper; + MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; + PRODUCT_MODULE_NAME = Alamofire; + PRODUCT_NAME = Alamofire; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; - name = Debug; + name = Release; }; 9406E329FC5B5B740E71A50993CC5232 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C94AC8995BF8FABEC313CBE55177B4D7 /* KeyboardSpy.xcconfig */; + baseConfigurationReference = 0090D04D23AD59223CA6ABE2B1815B57 /* KeyboardSpy.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -2128,43 +1834,10 @@ }; name = Release; }; - 9838C58BD1AA67DBD29475983CB12D4A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = FD31C6FE8C49CAF7CC0FA4775732786A /* Alamofire.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Alamofire/Alamofire-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; - PRODUCT_MODULE_NAME = Alamofire; - PRODUCT_NAME = Alamofire; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - C453E76937228DEF26E8648539A025EB /* Debug */ = { + CA41242DB20B5302EB5D45C245AD83DF /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = D8469B6F0CFD4043F6CE6EA468AC2287 /* Pods-Tests.debug.xcconfig */; + baseConfigurationReference = F2BE65A336256FD262C92432BB3CE442 /* NotificationBannerSwift.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -2175,28 +1848,27 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-Tests/Pods-Tests-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/NotificationBannerSwift/NotificationBannerSwift-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/NotificationBannerSwift/NotificationBannerSwift-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Tests/Pods-Tests.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + MODULEMAP_FILE = "Target Support Files/NotificationBannerSwift/NotificationBannerSwift.modulemap"; + PRODUCT_MODULE_NAME = NotificationBannerSwift; + PRODUCT_NAME = NotificationBannerSwift; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; name = Debug; }; - CA41242DB20B5302EB5D45C245AD83DF /* Debug */ = { + CA63F964AE990838F944EE64CCC409E7 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A152EBCE7776345A6978BF7E57DBEF00 /* NotificationBannerSwift.xcconfig */; + baseConfigurationReference = 07D462748235C19C5DF4E6C8091CCC27 /* Alamofire.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; @@ -2208,14 +1880,14 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/NotificationBannerSwift/NotificationBannerSwift-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/NotificationBannerSwift/NotificationBannerSwift-Info.plist"; + GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; + INFOPLIST_FILE = "Target Support Files/Alamofire/Alamofire-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/NotificationBannerSwift/NotificationBannerSwift.modulemap"; - PRODUCT_MODULE_NAME = NotificationBannerSwift; - PRODUCT_NAME = NotificationBannerSwift; + MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; + PRODUCT_MODULE_NAME = Alamofire; + PRODUCT_NAME = Alamofire; SDKROOT = iphoneos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; @@ -2228,7 +1900,7 @@ }; CD160F56D5243B4962CCF4055A65851A /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = DD113B4E3CD8AFA80C8629CD7B77A41A /* SnapKit.xcconfig */; + baseConfigurationReference = 83DD1DF437DC0769D32BF216F86DC851 /* SnapKit.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; @@ -2261,7 +1933,7 @@ }; DEF0947E20D3E9800CB003BB0923F79E /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C94AC8995BF8FABEC313CBE55177B4D7 /* KeyboardSpy.xcconfig */; + baseConfigurationReference = 0090D04D23AD59223CA6ABE2B1815B57 /* KeyboardSpy.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = ""; "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; @@ -2290,76 +1962,9 @@ }; name = Debug; }; - E955821622DDE29528650CC9DCEC8C5F /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 8C9B3E136A42756FBCC4B82696B92A28 /* AlamofireObjectMapper.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper.modulemap"; - PRODUCT_MODULE_NAME = AlamofireObjectMapper; - PRODUCT_NAME = AlamofireObjectMapper; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 4.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - EC24697E70FC62DADA08E1F894432B08 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = AA70BC4DC4521412986C8932E7F5DF5D /* Pods-Tests.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-Tests/Pods-Tests-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Tests/Pods-Tests.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; F543CDC98F06CC1A12956035BD468992 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = A152EBCE7776345A6978BF7E57DBEF00 /* NotificationBannerSwift.xcconfig */; + baseConfigurationReference = F2BE65A336256FD262C92432BB3CE442 /* NotificationBannerSwift.xcconfig */; buildSettings = { CLANG_ENABLE_OBJC_WEAK = NO; CODE_SIGN_IDENTITY = ""; @@ -2390,41 +1995,18 @@ }; name = Release; }; - FDD813E6233BCB1729BD4BF72EE7D87C /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 119A9CFD5491E8C6D2DA96A442F2003D /* AlamoRecord.xcconfig */; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/AlamoRecord/AlamoRecord-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/AlamoRecord/AlamoRecord-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/AlamoRecord/AlamoRecord.modulemap"; - PRODUCT_MODULE_NAME = AlamoRecord; - PRODUCT_NAME = AlamoRecord; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ + 0181E1A90598D4EB60B0A82096A4BE45 /* Build configuration list for PBXNativeTarget "AlamoRecord" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5D9BDAFF265F15F7861F797612916F97 /* Debug */, + 4EAB55DB9C286713C84FBE9EA2DC7026 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 050D74E4FA7EF26C1A4619E0A8DD9120 /* Build configuration list for PBXNativeTarget "SnapKit" */ = { isa = XCConfigurationList; buildConfigurations = ( @@ -2434,38 +2016,38 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { + 4168848EBB48517A8802807F536D0576 /* Build configuration list for PBXNativeTarget "Pods-Tests" */ = { isa = XCConfigurationList; buildConfigurations = ( - 5B0C8287D755FD95091CF35D87FB8B2D /* Debug */, - 3048B0C5C704DFFF688DA57F5380ED58 /* Release */, + 2DDA5066FFB2EFC12AD1DED3AD627573 /* Debug */, + 1567FC348A96DF6B3C41F59829754ED0 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 903CBE7373774824A180D3DAD6BBFE69 /* Build configuration list for PBXNativeTarget "Pods-Tests" */ = { + 43C1DD79754737EFBBA4EBDEF6191917 /* Build configuration list for PBXNativeTarget "Alamofire" */ = { isa = XCConfigurationList; buildConfigurations = ( - C453E76937228DEF26E8648539A025EB /* Debug */, - EC24697E70FC62DADA08E1F894432B08 /* Release */, + CA63F964AE990838F944EE64CCC409E7 /* Debug */, + 87FCC2B9F5E6F9D87414A5E3DBD10F04 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 9DC2D5428448C650963AAE7878423D29 /* Build configuration list for PBXNativeTarget "Pods-AlamoRecord_Example" */ = { + 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { isa = XCConfigurationList; buildConfigurations = ( - 58727E2A298861EF438A1427D6419D5C /* Debug */, - 6CD85192FBE3965A82B2BFD865DC8877 /* Release */, + 5B0C8287D755FD95091CF35D87FB8B2D /* Debug */, + 3048B0C5C704DFFF688DA57F5380ED58 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - AC399DBE3D7144A97179979004B7AE4C /* Build configuration list for PBXNativeTarget "AlamoRecord" */ = { + 70FE1FE1EF74C9E1FD561D1A30301B72 /* Build configuration list for PBXNativeTarget "Pods-AlamoRecord_Example" */ = { isa = XCConfigurationList; buildConfigurations = ( - FDD813E6233BCB1729BD4BF72EE7D87C /* Debug */, - 6AA198AA771AC8BD6C56E255D70EF7F4 /* Release */, + 263FA2B7D9D2A1C44C9781451ECE7F22 /* Debug */, + 25E0BF32624779B770189760671D3299 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; @@ -2488,33 +2070,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - D5B09037E2CFCEEB926424362BEE6E38 /* Build configuration list for PBXNativeTarget "AlamofireObjectMapper" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 926B6FD441D3FA115CD5FEA621112FE9 /* Debug */, - E955821622DDE29528650CC9DCEC8C5F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - DC92ECEC653C3FB6B1248AA77F2EFE1F /* Build configuration list for PBXNativeTarget "ObjectMapper" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 53F579EB33F69E2357E748B5E9CF12D5 /* Debug */, - 1D256AFAD8F18BF1F1E48B504377A4B7 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - E87124444A44B7DB55208E7FEC21D331 /* Build configuration list for PBXNativeTarget "Alamofire" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 533220A7363132F85843031FA4F2AAAB /* Debug */, - 9838C58BD1AA67DBD29475983CB12D4A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; F102FDC096F21CAEBA1EC472535AD766 /* Build configuration list for PBXNativeTarget "KeyboardSpy" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Example/Pods/Target Support Files/AlamoRecord/AlamoRecord-Info.plist b/Example/Pods/Target Support Files/AlamoRecord/AlamoRecord-Info.plist index 7b6b52a..0a12077 100644 --- a/Example/Pods/Target Support Files/AlamoRecord/AlamoRecord-Info.plist +++ b/Example/Pods/Target Support Files/AlamoRecord/AlamoRecord-Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 1.4.0 + 2.0.0 CFBundleSignature ???? CFBundleVersion diff --git a/Example/Pods/Target Support Files/AlamoRecord/AlamoRecord.xcconfig b/Example/Pods/Target Support Files/AlamoRecord/AlamoRecord.xcconfig index 78f2fc1..01c66d1 100644 --- a/Example/Pods/Target Support Files/AlamoRecord/AlamoRecord.xcconfig +++ b/Example/Pods/Target Support Files/AlamoRecord/AlamoRecord.xcconfig @@ -1,5 +1,5 @@ CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings PODS_BUILD_DIR = ${BUILD_DIR} diff --git a/Example/Pods/Target Support Files/Alamofire/Alamofire-Info.plist b/Example/Pods/Target Support Files/Alamofire/Alamofire-Info.plist index b287f84..e2771ff 100644 --- a/Example/Pods/Target Support Files/Alamofire/Alamofire-Info.plist +++ b/Example/Pods/Target Support Files/Alamofire/Alamofire-Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.8.2 + 5.0.0 CFBundleSignature ???? CFBundleVersion diff --git a/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig b/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig index 76d4abb..367c867 100644 --- a/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +++ b/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig @@ -1,5 +1,6 @@ CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Alamofire GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-Info.plist b/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-Info.plist deleted file mode 100644 index 073e064..0000000 --- a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 5.1.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-dummy.m b/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-dummy.m deleted file mode 100644 index 0a65788..0000000 --- a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_AlamofireObjectMapper : NSObject -@end -@implementation PodsDummy_AlamofireObjectMapper -@end diff --git a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-prefix.pch b/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-prefix.pch deleted file mode 100644 index beb2a24..0000000 --- a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-prefix.pch +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - diff --git a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-umbrella.h b/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-umbrella.h deleted file mode 100644 index 39f5a35..0000000 --- a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper-umbrella.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - - -FOUNDATION_EXPORT double AlamofireObjectMapperVersionNumber; -FOUNDATION_EXPORT const unsigned char AlamofireObjectMapperVersionString[]; - diff --git a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper.modulemap b/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper.modulemap deleted file mode 100644 index b4ff79f..0000000 --- a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module AlamofireObjectMapper { - umbrella header "AlamofireObjectMapper-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper.xcconfig b/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper.xcconfig deleted file mode 100644 index 2037c80..0000000 --- a/Example/Pods/Target Support Files/AlamofireObjectMapper/AlamofireObjectMapper.xcconfig +++ /dev/null @@ -1,10 +0,0 @@ -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/AlamofireObjectMapper -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES diff --git a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-Info.plist b/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-Info.plist deleted file mode 100644 index 152c333..0000000 --- a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 3.4.2 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-dummy.m b/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-dummy.m deleted file mode 100644 index 7033cce..0000000 --- a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_ObjectMapper : NSObject -@end -@implementation PodsDummy_ObjectMapper -@end diff --git a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-prefix.pch b/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-prefix.pch deleted file mode 100644 index beb2a24..0000000 --- a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-prefix.pch +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - diff --git a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-umbrella.h b/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-umbrella.h deleted file mode 100644 index e993e40..0000000 --- a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper-umbrella.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - - -FOUNDATION_EXPORT double ObjectMapperVersionNumber; -FOUNDATION_EXPORT const unsigned char ObjectMapperVersionString[]; - diff --git a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper.modulemap b/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper.modulemap deleted file mode 100644 index 539c248..0000000 --- a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module ObjectMapper { - umbrella header "ObjectMapper-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper.xcconfig b/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper.xcconfig deleted file mode 100644 index b37d3f0..0000000 --- a/Example/Pods/Target Support Files/ObjectMapper/ObjectMapper.xcconfig +++ /dev/null @@ -1,9 +0,0 @@ -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -suppress-warnings -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/ObjectMapper -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES diff --git a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-acknowledgements.markdown b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-acknowledgements.markdown index 3244cd8..392a1a9 100644 --- a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-acknowledgements.markdown +++ b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-acknowledgements.markdown @@ -26,7 +26,7 @@ THE SOFTWARE. ## Alamofire -Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -47,32 +47,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -## AlamofireObjectMapper - -The MIT License (MIT) - -Copyright (c) 2015 Tristan Himmelman - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - ## KeyboardSpy Copyright (c) 2017 Daltron @@ -136,18 +110,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -## ObjectMapper - -The MIT License (MIT) -Copyright (c) 2014 Hearst - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - ## SnapKit Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit diff --git a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-acknowledgements.plist b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-acknowledgements.plist index e539f1b..bd9d91c 100644 --- a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-acknowledgements.plist +++ b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-acknowledgements.plist @@ -43,7 +43,7 @@ THE SOFTWARE. FooterText - Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) + Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -70,38 +70,6 @@ THE SOFTWARE. Type PSGroupSpecifier - - FooterText - The MIT License (MIT) - -Copyright (c) 2015 Tristan Himmelman - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - License - MIT - Title - AlamofireObjectMapper - Type - PSGroupSpecifier - FooterText Copyright (c) 2017 Daltron <daltonhint4@gmail.com> @@ -183,24 +151,6 @@ THE SOFTWARE. Type PSGroupSpecifier - - FooterText - The MIT License (MIT) -Copyright (c) 2014 Hearst - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - License - MIT - Title - ObjectMapper - Type - PSGroupSpecifier - FooterText Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit diff --git a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-frameworks.sh b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-frameworks.sh index e7fdd99..cd552b0 100755 --- a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-frameworks.sh +++ b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example-frameworks.sh @@ -155,21 +155,17 @@ strip_invalid_archs() { if [[ "$CONFIGURATION" == "Debug" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/AlamoRecord/AlamoRecord.framework" install_framework "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework" - install_framework "${BUILT_PRODUCTS_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework" install_framework "${BUILT_PRODUCTS_DIR}/KeyboardSpy/KeyboardSpy.framework" install_framework "${BUILT_PRODUCTS_DIR}/MarqueeLabel/MarqueeLabel.framework" install_framework "${BUILT_PRODUCTS_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework" - install_framework "${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework" install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework" fi if [[ "$CONFIGURATION" == "Release" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/AlamoRecord/AlamoRecord.framework" install_framework "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework" - install_framework "${BUILT_PRODUCTS_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework" install_framework "${BUILT_PRODUCTS_DIR}/KeyboardSpy/KeyboardSpy.framework" install_framework "${BUILT_PRODUCTS_DIR}/MarqueeLabel/MarqueeLabel.framework" install_framework "${BUILT_PRODUCTS_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework" - install_framework "${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework" install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework" fi if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then diff --git a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.debug.xcconfig b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.debug.xcconfig index ed36d5f..a894f3a 100644 --- a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.debug.xcconfig +++ b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.debug.xcconfig @@ -1,10 +1,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy" "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel" "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy" "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel" "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy/KeyboardSpy.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel/MarqueeLabel.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy/KeyboardSpy.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel/MarqueeLabel.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy/KeyboardSpy.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel/MarqueeLabel.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" -OTHER_LDFLAGS = $(inherited) -framework "AlamoRecord" -framework "Alamofire" -framework "AlamofireObjectMapper" -framework "KeyboardSpy" -framework "MarqueeLabel" -framework "NotificationBannerSwift" -framework "ObjectMapper" -framework "QuartzCore" -framework "SnapKit" -framework "UIKit" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy/KeyboardSpy.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel/MarqueeLabel.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" +OTHER_LDFLAGS = $(inherited) -framework "AlamoRecord" -framework "Alamofire" -framework "CFNetwork" -framework "KeyboardSpy" -framework "MarqueeLabel" -framework "NotificationBannerSwift" -framework "QuartzCore" -framework "SnapKit" -framework "UIKit" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.release.xcconfig b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.release.xcconfig index ed36d5f..a894f3a 100644 --- a/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.release.xcconfig +++ b/Example/Pods/Target Support Files/Pods-AlamoRecord_Example/Pods-AlamoRecord_Example.release.xcconfig @@ -1,10 +1,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy" "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel" "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy" "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel" "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy/KeyboardSpy.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel/MarqueeLabel.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy/KeyboardSpy.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel/MarqueeLabel.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy/KeyboardSpy.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel/MarqueeLabel.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" -OTHER_LDFLAGS = $(inherited) -framework "AlamoRecord" -framework "Alamofire" -framework "AlamofireObjectMapper" -framework "KeyboardSpy" -framework "MarqueeLabel" -framework "NotificationBannerSwift" -framework "ObjectMapper" -framework "QuartzCore" -framework "SnapKit" -framework "UIKit" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy/KeyboardSpy.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel/MarqueeLabel.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift/NotificationBannerSwift.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/KeyboardSpy" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/MarqueeLabel" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/NotificationBannerSwift" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" +OTHER_LDFLAGS = $(inherited) -framework "AlamoRecord" -framework "Alamofire" -framework "CFNetwork" -framework "KeyboardSpy" -framework "MarqueeLabel" -framework "NotificationBannerSwift" -framework "QuartzCore" -framework "SnapKit" -framework "UIKit" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.markdown b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.markdown index 86c68e9..f78dd3b 100644 --- a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.markdown +++ b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.markdown @@ -26,7 +26,7 @@ THE SOFTWARE. ## Alamofire -Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) +Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -46,42 +46,4 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -## AlamofireObjectMapper - -The MIT License (MIT) - -Copyright (c) 2015 Tristan Himmelman - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - -## ObjectMapper - -The MIT License (MIT) -Copyright (c) 2014 Hearst - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - Generated by CocoaPods - https://cocoapods.org diff --git a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.plist b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.plist index 09e6528..46d1e2c 100644 --- a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.plist +++ b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.plist @@ -43,7 +43,7 @@ THE SOFTWARE. FooterText - Copyright (c) 2014 Alamofire Software Foundation (http://alamofire.org/) + Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -70,56 +70,6 @@ THE SOFTWARE. Type PSGroupSpecifier - - FooterText - The MIT License (MIT) - -Copyright (c) 2015 Tristan Himmelman - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - - License - MIT - Title - AlamofireObjectMapper - Type - PSGroupSpecifier - - - FooterText - The MIT License (MIT) -Copyright (c) 2014 Hearst - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - License - MIT - Title - ObjectMapper - Type - PSGroupSpecifier - FooterText Generated by CocoaPods - https://cocoapods.org diff --git a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh index 58264bc..5ce93d1 100755 --- a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh +++ b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh @@ -155,14 +155,10 @@ strip_invalid_archs() { if [[ "$CONFIGURATION" == "Debug" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/AlamoRecord/AlamoRecord.framework" install_framework "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework" - install_framework "${BUILT_PRODUCTS_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework" - install_framework "${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework" fi if [[ "$CONFIGURATION" == "Release" ]]; then install_framework "${BUILT_PRODUCTS_DIR}/AlamoRecord/AlamoRecord.framework" install_framework "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework" - install_framework "${BUILT_PRODUCTS_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework" - install_framework "${BUILT_PRODUCTS_DIR}/ObjectMapper/ObjectMapper.framework" fi if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then wait diff --git a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig index eee4ec4..981240f 100644 --- a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig +++ b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig @@ -1,10 +1,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" -OTHER_LDFLAGS = $(inherited) -framework "AlamoRecord" -framework "Alamofire" -framework "AlamofireObjectMapper" -framework "ObjectMapper" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" +OTHER_LDFLAGS = $(inherited) -framework "AlamoRecord" -framework "Alamofire" -framework "CFNetwork" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig index eee4ec4..981240f 100644 --- a/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig +++ b/Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig @@ -1,10 +1,10 @@ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" +HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper/AlamofireObjectMapper.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper/ObjectMapper.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamofireObjectMapper" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/ObjectMapper" -OTHER_LDFLAGS = $(inherited) -framework "AlamoRecord" -framework "Alamofire" -framework "AlamofireObjectMapper" -framework "ObjectMapper" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord/AlamoRecord.framework/Headers" -isystem "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/AlamoRecord" -iframework "${PODS_CONFIGURATION_BUILD_DIR}/Alamofire" +OTHER_LDFLAGS = $(inherited) -framework "AlamoRecord" -framework "Alamofire" -framework "CFNetwork" OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS PODS_BUILD_DIR = ${BUILD_DIR} PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) diff --git a/Example/Tests/AlamoRecordTests.swift b/Example/Tests/AlamoRecordTests.swift index 237b2fb..481ac53 100644 --- a/Example/Tests/AlamoRecordTests.swift +++ b/Example/Tests/AlamoRecordTests.swift @@ -13,24 +13,14 @@ class AlamoRecordTests: XCTestCase { internal var validationExpectation: XCTestExpectation? - override func setUp() { - super.setUp() - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - super.tearDown() - } - func testThatCreateHelperWorks() { initializeExpectation() - let parameters: [String : String] = ["userId": "4", - "title" : "AlamoRecord Title", + let parameters: [String : String] = ["title" : "AlamoRecord Title", "body": "AlamoRecord Body"] Post.create(parameters: parameters, success: { (post: Post) in self.validationExpectation?.fulfill() - XCTAssertEqual([parameters["userId"]!, parameters["title"]!, parameters["body"]!], - ["\(post.userId!)", post.title, post.body]) + XCTAssertEqual([parameters["title"]!, parameters["body"]!], + [post.title, post.body]) }) { (error) in self.validationExpectation?.fulfill() XCTFail(error.description) @@ -43,12 +33,11 @@ class AlamoRecordTests: XCTestCase { initializeExpectation() Post.find(id: 1, success: { (post: Post) in self.validationExpectation?.fulfill() - let userId: String = "1" let id: String = "1" let title: String = "sunt aut facere repellat provident occaecati excepturi optio reprehenderit" let body: String = "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto" - XCTAssertEqual([userId, id, title, body], - ["\(post.userId!)", "\(post.id!)", post.title, post.body]) + XCTAssertEqual([id, title, body], + ["\(post.id)", post.title, post.body]) }) { (error) in self.validationExpectation?.fulfill() XCTFail(error.description) @@ -59,10 +48,12 @@ class AlamoRecordTests: XCTestCase { func testThatUpdateHelperWorksOnClass() { initializeExpectation() - let parameters: [String : String] = ["title" : "AlamoRecord Title Updated"] + let parameters: [String : String] = ["title" : "AlamoRecord Title Updated", + "body": "AlamoRecord Body Updated"] Post.update(id: 1, parameters: parameters, success: { (post: Post) in self.validationExpectation?.fulfill() - XCTAssertEqual(parameters["title"]!, post.title) + XCTAssertEqual(parameters["title"], post.title) + XCTAssertEqual(parameters["body"], post.body) }) { (error) in self.validationExpectation?.fulfill() XCTFail(error.description) @@ -73,12 +64,14 @@ class AlamoRecordTests: XCTestCase { func testThatUpdateHelperWorksOnInstance() { initializeExpectation() - let parameters: [String : String] = ["title" : "AlamoRecord Title Updated"] + let parameters: [String : String] = ["title" : "AlamoRecord Title Updated", + "body": "AlamoRecord Body Updated"] Post.find(id: 1, success: { (post: Post) in post.update(parameters: parameters, success: { (updatedPost: Post) in self.validationExpectation?.fulfill() - XCTAssertEqual(parameters["title"]!, updatedPost.title) + XCTAssertEqual(parameters["title"], updatedPost.title) + XCTAssertEqual(parameters["body"], updatedPost.body) }, failure: { (error) in self.validationExpectation?.fulfill() XCTFail(error.description) diff --git a/Example/Tests/ApplicationError.swift b/Example/Tests/ApplicationError.swift index 94c75d7..3e2033d 100644 --- a/Example/Tests/ApplicationError.swift +++ b/Example/Tests/ApplicationError.swift @@ -7,27 +7,10 @@ // import AlamoRecord -import ObjectMapper class ApplicationError: AlamoRecordError { - - required init(nsError: NSError) { - super.init(nsError: nsError) - } - - required public init?(map: Map) { - super.init(map: map) - } - - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - } - - public required init() { - fatalError("init() has not been implemented") - } - override func mapping(map: Map) { - super.mapping(map: map) + required init(from decoder: Decoder) throws { + <#code#> } } diff --git a/Example/Tests/Post.swift b/Example/Tests/Post.swift index 7d65bba..e8b3b27 100644 --- a/Example/Tests/Post.swift +++ b/Example/Tests/Post.swift @@ -7,9 +7,18 @@ // import AlamoRecord -import ObjectMapper class Post: AlamoRecordObject { + + let title: String + let body: String + + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + title = try container.decode(String.self, forKey: .title) + body = try container.decode(String.self, forKey: .body) + try super.init(from: decoder) + } override class var requestManager: ApplicationRequestManager { return ApplicationRequestManager.default @@ -19,23 +28,15 @@ class Post: AlamoRecordObject { return "post" } - private(set) var userId: Int! - private(set) var title: String! - private(set) var body: String! - - required init?(map: Map) { - super.init(map: map) - } - - override func mapping(map: Map) { - super.mapping(map: map) - userId <- map["userId"] - title <- map["title"] - body <- map["body"] - } - func getComments(success: @escaping (([Comment]) -> Void), failure: @escaping ((ApplicationError) -> Void)) { - let url = ApplicationURL(url: "\(Post.pluralRoot)/\(id!)/\(Comment.pluralRoot)") + let url = ApplicationURL(url: "\(Post.pluralRoot)/\(id)/\(Comment.pluralRoot)") requestManager.mapObjects(.get, url: url, success: success, failure: failure) } + + private enum CodingKeys: String, CodingKey { + case userId + case title + case body + } + } diff --git a/README.md b/README.md index ab5a1cb..189b5ad 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Written in Swift 5 -AlamoRecord is a powerful yet simple framework that eliminates the often complex networking layer that exists between your networking framework and your application. AlamoRecord uses the power of [AlamoFire](https://github.com/Alamofire/Alamofire), [AlamofireObjectMapper](https://github.com/tristanhimmelman/AlamofireObjectMapper) and the concepts behind the [ActiveRecord](http://guides.rubyonrails.org/active_record_basics.html) pattern to create a networking layer that makes interacting with your API easier than ever. +AlamoRecord is a powerful yet simple framework that eliminates the often complex networking layer that exists between your networking framework and your application. AlamoRecord uses the power of [Alamofire](https://github.com/Alamofire/Alamofire) and the concepts behind the [ActiveRecord](http://guides.rubyonrails.org/active_record_basics.html) pattern to create a networking layer that makes interacting with your API easier than ever. ## Requirements @@ -87,22 +87,14 @@ Our class structure would then look very similar to this: ```swift class ApplicationError: AlamoRecordError { - private(set) var statusCode: Int? - private(set) var message: String? - - required init(nsError: NSError) { - super.init(nsError: nsError) - } + let statusCode: Int? + let message: String? - required public init?(map: Map) { - super.init(map: map) + private enum CodingKeys: String, CodingKey { + case statusCode = "status_code" + case message } - override func mapping(map: Map) { - super.mapping(map: map) - statusCode <- map["status_code"] - message <- map["message"] - } } ``` @@ -134,32 +126,30 @@ The final step is to create data objects inheriting from `AlamoRecordObject` tha ```swift // IDType should be of type String or Int class Post: AlamoRecordObject { + + let userId: Int + let title: String + let body: String - override class var requestManager: RequestManager { - return ApplicationRequestManager + required init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + title = try container.decode(String.self, forKey: .title) + body = try container.decode(String.self, forKey: .body) + try super.init(from: decoder) } override class var root: String { return "post" } - - private(set) var userId: Int! - private(set) var title: String! - private(set) var body: String! - - required init?(map: Map) { - super.init(map: map) - } - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) + override class var requestManager: RequestManager { + return ApplicationRequestManager } - override func mapping(map: Map) { - super.mapping(map: map) - userId <- map["userId"] - title <- map["title"] - body <- map["body"] + private enum CodingKeys: String, CodingKey { + case userId + case title + case body } } @@ -192,7 +182,7 @@ If our `Post` object was encapsulated in an object like this: we would only simply need to override the `keyPath` in the class declaration: ```swift -open override class var keyPath: String? { +override class var keyPath: String? { return "post" } ```