diff --git a/.gitignore b/.gitignore index e7b722d..c238bd0 100644 --- a/.gitignore +++ b/.gitignore @@ -26,8 +26,8 @@ Carthage # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control -# +# # Note: if you ignore the Pods directory, make sure to uncomment # `pod install` in .travis.yml # -# Pods/ +Pods/ diff --git a/.travis.yml b/.travis.yml index 988506e..8a267ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,13 +2,13 @@ # * http://www.objc.io/issue-6/travis-ci.html # * https://github.com/supermarin/xcpretty#usage -osx_image: xcode8 +osx_image: xcode9 language: objective-c # cache: cocoapods # podfile: Example/Podfile before_install: - gem install cocoapods --pre # Since Travis is not always on latest version -# - pod install --project-directory=Example +- pod install --project-directory=Example script: - set -o pipefail && xcodebuild test -workspace Example/Reqres.xcworkspace -scheme Reqres-Example -destination 'platform=iOS Simulator,name=iPhone 6,OS=10.0' ONLY_ACTIVE_ARCH=NO | xcpretty - pod lib lint diff --git a/Example/Podfile b/Example/Podfile index dde5c7f..4182036 100644 --- a/Example/Podfile +++ b/Example/Podfile @@ -1,4 +1,5 @@ use_frameworks! +inhibit_all_warnings! target 'Reqres_Example' do pod 'Reqres', :path => '../' @@ -6,16 +7,6 @@ target 'Reqres_Example' do target 'Reqres_Tests' do inherit! :search_paths - - pod 'Quick', '~> 0.10' - pod 'Nimble', '~> 5.0' - end -end -post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['SWIFT_VERSION'] = '3.0' - end end end diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 9f9c911..1f44b64 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -1,13 +1,9 @@ PODS: - Alamofire (4.0.1) - - Nimble (5.0.0) - - Quick (0.10.0) - - Reqres (1.2.0) + - Reqres (2.1) DEPENDENCIES: - Alamofire - - Nimble (~> 5.0) - - Quick (~> 0.10) - Reqres (from `../`) EXTERNAL SOURCES: @@ -16,10 +12,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Alamofire: 7682d43245de14874acd142ec137b144aa1dd335 - Nimble: 56fc9f5020effa2206de22c3dd910f4fb011b92f - Quick: 5d290df1c69d5ee2f0729956dcf0fd9a30447eaa - Reqres: 1f2b4310bbdbb8b4bf72d8ad4e35b58aee6a2181 + Reqres: d1a133f7279ac79d2d63280b61f09d2435523623 -PODFILE CHECKSUM: 9d807594251db4fbaf40232aaa50dd502a0b95a2 +PODFILE CHECKSUM: 18cd2941943b3c32aee6180a8306721f67439143 -COCOAPODS: 1.1.0.rc.2 +COCOAPODS: 1.3.1 diff --git a/Example/Pods/Alamofire/LICENSE b/Example/Pods/Alamofire/LICENSE deleted file mode 100644 index 4cfbf72..0000000 --- a/Example/Pods/Alamofire/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -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. diff --git a/Example/Pods/Alamofire/README.md b/Example/Pods/Alamofire/README.md deleted file mode 100644 index bfaed03..0000000 --- a/Example/Pods/Alamofire/README.md +++ /dev/null @@ -1,1744 +0,0 @@ -![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/assets/alamofire.png) - -[![Build Status](https://travis-ci.org/Alamofire/Alamofire.svg?branch=master)](https://travis-ci.org/Alamofire/Alamofire) -[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg)](https://img.shields.io/cocoapods/v/Alamofire.svg) -[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) -[![Platform](https://img.shields.io/cocoapods/p/Alamofire.svg?style=flat)](http://cocoadocs.org/docsets/Alamofire) -[![Twitter](https://img.shields.io/badge/twitter-@AlamofireSF-blue.svg?style=flat)](http://twitter.com/AlamofireSF) - -Alamofire is an HTTP networking library written in Swift. - -- [Features](#features) -- [Component Libraries](#component-libraries) -- [Requirements](#requirements) -- [Migration Guides](#migration-guides) -- [Communication](#communication) -- [Installation](#installation) -- [Usage](#usage) - - **Intro -** [Making a Request](#making-a-request), [Response Handling](#response-handling), [Response Validation](#response-validation), [Response Caching](#response-caching) - - **HTTP -** [HTTP Methods](#http-methods), [Parameter Encoding](#parameter-encoding), [HTTP Headers](#http-headers), [Authentication](#authentication) - - **Large Data -** [Downloading Data to a File](#downloading-data-to-a-file), [Uploading Data to a Server](#uploading-data-to-a-server) - - **Tools -** [Statistical Metrics](#statistical-metrics), [cURL Command Output](#curl-command-output) -- [Advanced Usage](#advanced-usage) - - **URL Session -** [Session Manager](#session-manager), [Session Delegate](#session-delegate), [Request](#request) - - **Routing -** [Routing Requests](#routing-requests), [Adapting and Retrying Requests](#adapting-and-retrying-requests) - - **Model Objects -** [Custom Response Serialization](#custom-response-serialization) - - **Connection -** [Security](#security), [Network Reachability](#network-reachability) -- [Open Radars](#open-radars) -- [FAQ](#faq) -- [Credits](#credits) -- [Donations](#donations) -- [License](#license) - -## Features - -- [x] Chainable Request / Response Methods -- [x] URL / JSON / plist Parameter Encoding -- [x] Upload File / Data / Stream / MultipartFormData -- [x] Download File using Request or Resume Data -- [x] Authentication with URLCredential -- [x] HTTP Response Validation -- [x] Upload and Download Progress Closures with Progress -- [x] cURL Command Output -- [x] Dynamically Adapt and Retry Requests -- [x] TLS Certificate and Public Key Pinning -- [x] Network Reachability -- [x] Comprehensive Unit and Integration Test Coverage -- [x] [Complete Documentation](http://cocoadocs.org/docsets/Alamofire) - -## Component Libraries - -In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation) to bring additional functionality to the Alamofire ecosystem. - -- [AlamofireImage](https://github.com/Alamofire/AlamofireImage) - An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache and a priority-based image downloading system. -- [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator) - Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire. - -## Requirements - -- iOS 9.0+ / macOS 10.11+ / tvOS 9.0+ / watchOS 2.0+ -- Xcode 8.0+ -- Swift 3.0+ - -## Migration Guides - -- [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**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/alamofire). (Tag 'alamofire') -- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/alamofire). -- If you **found a bug**, open an issue. -- If you **have a feature request**, open an issue. -- If you **want to contribute**, submit a pull request. - -## Installation - -### CocoaPods - -[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: - -```bash -$ gem install cocoapods -``` - -> CocoaPods 1.1.0+ is required to build Alamofire 4.0.0+. - -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.0' -end -``` - -Then, run the following command: - -```bash -$ pod install -``` - -### 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](http://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`: - -```ogdl -github "Alamofire/Alamofire" ~> 4.0 -``` - -Run `carthage update` to build the framework and drag the built `Alamofire.framework` into your Xcode project. - -### Manually - -If you prefer not to use either of the aforementioned dependency managers, you can integrate Alamofire into your project manually. - -#### Embedded Framework - -- Open up Terminal, `cd` into your top-level project directory, and run the following command "if" your project is not initialized as a git repository: - -```bash -$ git init -``` - -- Add Alamofire as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following command: - -```bash -$ git submodule add https://github.com/Alamofire/Alamofire.git -``` - -- Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application's Xcode project. - - > It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter. - -- Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target. -- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar. -- In the tab bar at the top of that window, open the "General" panel. -- Click on the `+` button under the "Embedded Binaries" section. -- You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder. - - > 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. - - > 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`. - -- And that's it! - -> The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device. - ---- - -## Usage - -### Making a Request - -```swift -import Alamofire - -Alamofire.request("https://httpbin.org/get") -``` - -### Response Handling - -Handling the `Response` of a `Request` made in Alamofire involves chaining a response handler onto the `Request`. - -```swift -Alamofire.request("https://httpbin.org/get").responseJSON { response in - print(response.request) // original URL request - print(response.response) // HTTP URL response - print(response.data) // server data - print(response.result) // result of response serialization - - if let JSON = response.result.value { - print("JSON: \(JSON)") - } -} -``` - -In the above example, the `responseJSON` handler is appended to the `Request` to be executed once the `Request` is complete. Rather than blocking execution to wait for a response from the server, a [callback](http://en.wikipedia.org/wiki/Callback_%28computer_programming%29) in the form of a closure is specified to handle the response once it's received. The result of a request is only available inside the scope of a response closure. Any execution contingent on the response or data received from the server must be done within a response closure. - -> Networking in Alamofire is done _asynchronously_. Asynchronous programming may be a source of frustration to programmers unfamiliar with the concept, but there are [very good reasons](https://developer.apple.com/library/ios/qa/qa1693/_index.html) for doing it this way. - -Alamofire contains five different response handlers by default including: - -```swift -// Response Handler - Unserialized Response -func response( - queue: DispatchQueue?, - completionHandler: @escaping (DefaultDownloadResponse) -> Void) - -> Self - -// Response Data Handler - Serialized into Data -func responseData( - queue: DispatchQueue?, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - -// Response String Handler - Serialized into String -func responseString( - queue: DispatchQueue?, - encoding: String.Encoding?, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - -// Response JSON Handler - Serialized into Any -func responseJSON( - queue: DispatchQueue?, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - -// Response PropertyList (plist) Handler - Serialized into Any -func responsePropertyList( - queue: DispatchQueue?, - completionHandler: @escaping (DataResponse) -> Void)) - -> Self -``` - -None of the response handlers perform any validation of the `HTTPURLResponse` it gets back from the server. - -> For example, response status codes in the `400..<499` and `500..<599` ranges do NOT automatically trigger an `Error`. Alamofire uses [Response Validation](#response-validation) method chaining to achieve this. - -#### Response Handler - -The `response` handler does NOT evaluate any of the response data. It merely forwards on all information directly from the URL session delegate. It is the Alamofire equivalent of using `cURL` to execute a `Request`. - -```swift -Alamofire.request("https://httpbin.org/get").response { response in - print("Request: \(response.request)") - print("Response: \(response.response)") - print("Error: \(response.data)") - - if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) { - print("Data: \(utf8Text)") - } -} -``` - -> We strongly encourage you to leverage the other response serializers taking advantage of `Response` and `Result` types. - -#### Response Data Handler - -The `responseData` handler uses the `responseDataSerializer` (the object that serializes the server data into some other type) to extract the `Data` returned by the server. If no errors occur and `Data` is returned, the response `Result` will be a `.success` and the `value` will be of type `Data`. - -```swift -Alamofire.request("https://httpbin.org/get").responseData { response in - debugPrint("All Response Info: \(response)") - - if let data = response.result.value, let utf8Text = String(data: data, encoding: .utf8) { - print("Data: \(utf8Text)") - } -} -``` - -#### Response String Handler - -The `responseString` handler uses the `responseStringSerializer` to convert the `Data` returned by the server into a `String` with the specified encoding. If no errors occur and the server data is successfully serialized into a `String`, the response `Result` will be a `.success` and the `value` will be of type `String`. - -```swift -Alamofire.request("https://httpbin.org/get").responseString { response in - print("Success: \(response.result.isSuccess)") - print("Response String: \(response.result.value)") -} -``` - -> If no encoding is specified, Alamofire will use the text encoding specified in the `HTTPURLResponse` from the server. If the text encoding cannot be determined by the server response, it defaults to `.isoLatin1`. - -#### Response JSON Handler - -The `responseJSON` handler uses the `responseJSONSerializer` to convert the `Data` returned by the server into an `Any` type using the specified `JSONSerialization.ReadingOptions`. If no errors occur and the server data is successfully serialized into a JSON object, the response `Result` will be a `.success` and the `value` will be of type `Any`. - -```swift -Alamofire.request("https://httpbin.org/get").responseJSON { response in - debugPrint(response) - - if let json = response.result.value { - print("JSON: \(json)") - } -} -``` - -> All JSON serialization is handled by the `JSONSerialization` API in the `Foundation` framework. - -#### Chained Response Handlers - -Response handlers can even be chained: - -```swift -Alamofire.request("https://httpbin.org/get") - .responseString { response in - print("Response String: \(response.result.value)") - } - .responseJSON { response in - print("Response JSON: \(response.result.value)") - } -``` - -> It is important to note that using multiple response handlers on the same `Request` requires the server data to be serialized multiple times. Once for each response handler. - -#### Response Handler Queue - -Response handlers by default are executed on the main dispatch queue. However, a custom dispatch queue can be provided instead. - -```swift -let utilityQueue = DispatchQueue.global(qos: .utility) - -Alamofire.request("https://httpbin.org/get").responseJSON(queue: utilityQueue) { response in - print("Executing response handler on utility queue") -} -``` - -### Response Validation - -By default, Alamofire treats any completed request to be successful, regardless of the content of the response. Calling `validate` before a response handler causes an error to be generated if the response had an unacceptable status code or MIME type. - -#### Manual Validation - -```swift -Alamofire.request("https://httpbin.org/get") - .validate(statusCode: 200..<300) - .validate(contentType: ["application/json"]) - .response { response in - switch response.result { - case .success: - print("Validation Successful") - case .failure(let error): - print(error) - } - } -``` - -#### Automatic Validation - -Automatically validates status code within `200...299` range, and that the `Content-Type` header of the response matches the `Accept` header of the request, if one is provided. - -```swift -Alamofire.request("https://httpbin.org/get").validate().responseJSON { response in - switch response.result { - case .success: - print("Validation Successful") - case .failure(let error): - print(error) - } -} -``` - -### Response Caching - -Response Caching is handled on the system framework level by [`URLCache`](https://developer.apple.com/reference/foundation/urlcache). It provides a composite in-memory and on-disk cache and lets you manipulate the sizes of both the in-memory and on-disk portions. - -> By default, Alamofire leverages the shared `URLCache`. In order to customize it, see the [Session Manager Configurations](#session-manager-configurations) section. - -### HTTP Methods - -The `HTTPMethod` enumeration lists the HTTP methods defined in [RFC 7231 §4.3](http://tools.ietf.org/html/rfc7231#section-4.3): - -```swift -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" -} -``` - -These values can be passed as the `method` argument to the `Alamofire.request` API: - -```swift -Alamofire.request("https://httpbin.org/get") // method defaults to `.get` - -Alamofire.request("https://httpbin.org/post", method: .post) -Alamofire.request("https://httpbin.org/put", method: .put) -Alamofire.request("https://httpbin.org/delete", method: .delete) -``` - -> The `Alamofire.request` method parameter defaults to `.get`. - -### Parameter Encoding - -Alamofire supports three types of parameter encoding including: `URL`, `JSON` and `PropertyList`. It can also support any custom encoding that conforms to the `ParameterEncoding` protocol. - -#### URL Encoding - -The `URLEncoding` type creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP body of the URL request. Whether the query string is set or appended to any existing URL query string or set as the HTTP body depends on the `Destination` of the encoding. The `Destination` enumeration has three cases: - -- `.methodDependent` - Applies encoded query string result to existing query string for `GET`, `HEAD` and `DELETE` requests and sets as the HTTP body for requests with any other HTTP method. -- `.queryString` - Sets or appends encoded query string result to existing query string. -- `.httpBody` - Sets encoded query string result as the HTTP body of the URL request. - -The `Content-Type` HTTP header field of an encoded request with HTTP body is set to `application/x-www-form-urlencoded; charset=utf-8`. Since there is no published specification for how to encode collection types, 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`). - -##### GET Request With URL-Encoded Parameters - -```swift -let parameters: Parameters = ["foo": "bar"] - -// All three of these calls are equivalent -Alamofire.request("https://httpbin.org/get", parameters: parameters) // encoding defaults to `URLEncoding.default` -Alamofire.request("https://httpbin.org/get", parameters: parameters, encoding: URLEncoding.default) -Alamofire.request("https://httpbin.org/get", parameters: parameters, encoding: URLEncoding(destination: .methodDependent)) - -// https://httpbin.org/get?foo=bar -``` - -##### POST Request With URL-Encoded Parameters - -```swift -let parameters: Parameters = [ - "foo": "bar", - "baz": ["a", 1], - "qux": [ - "x": 1, - "y": 2, - "z": 3 - ] -] - -// All three of these calls are equivalent -Alamofire.request("https://httpbin.org/post", parameters: parameters) -Alamofire.request("https://httpbin.org/post", parameters: parameters, encoding: URLEncoding.default) -Alamofire.request("https://httpbin.org/post", parameters: parameters, encoding: URLEncoding.httpBody) - -// HTTP body: foo=bar&baz[]=a&baz[]=1&qux[x]=1&qux[y]=2&qux[z]=3 -``` - -#### JSON Encoding - -The `JSONEncoding` type creates a JSON representation of the parameters object, which is set as the HTTP body of the request. The `Content-Type` HTTP header field of an encoded request is set to `application/json`. - -##### POST Request with JSON-Encoded Parameters - -```swift -let parameters: Parameters = [ - "foo": [1,2,3], - "bar": [ - "baz": "qux" - ] -] - -// Both calls are equivalent -Alamofire.request("https://httpbin.org/post", method: .post, parameters: parameters, encoding: JSONEncoding.default) -Alamofire.request("https://httpbin.org/post", method: .post, parameters: parameters, encoding: JSONEncoding(options: [])) - -// HTTP body: {"foo": [1, 2, 3], "bar": {"baz": "qux"}} -``` - -#### Property List Encoding - -The `PropertyListEncoding` 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`. - -#### Custom Encoding - -In the event that the provided `ParameterEncoding` types do not meet your needs, you can create your own custom encoding. Here's a quick example of how you could build a custom `JSONStringArrayEncoding` type to encode a JSON string array onto a `Request`. - -```swift -struct JSONStringArrayEncoding: ParameterEncoding { - private let array: [String] - - init(array: [String]) { - self.array = array - } - - func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest { - var urlRequest = urlRequest.urlRequest - - let data = try JSONSerialization.data(withJSONObject: array, options: []) - - if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { - urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") - } - - urlRequest.httpBody = data - - return urlRequest - } -} -``` - -#### Manual Parameter Encoding of a URLRequest - -The `ParameterEncoding` APIs can be used outside of making network requests. - -```swift -let url = URL(string: "https://httpbin.org/get")! -var urlRequest = URLRequest(url: url) - -let parameters: Parameters = ["foo": "bar"] -let encodedURLRequest = try URLEncoding.queryString.encode(urlRequest, with: parameters) -``` - -### HTTP Headers - -Adding a custom HTTP header to a `Request` is supported directly in the global `request` method. This makes it easy to attach HTTP headers to a `Request` that can be constantly changing. - -```swift -let headers: HTTPHeaders = [ - "Authorization": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==", - "Accept": "application/json" -] - -Alamofire.request("https://httpbin.org/headers", headers: headers).responseJSON { response in - debugPrint(response) -} -``` - -> For HTTP headers that do not change, it is recommended to set them on the `URLSessionConfiguration` so they are automatically applied to any `URLSessionTask` created by the underlying `URLSession`. For more information, see the [Session Manager Configurations](#session-manager-configurations) section. - -The default Alamofire `SessionManager` provides a default set of headers for every `Request`. These include: - -- `Accept-Encoding`, which defaults to `gzip;q=1.0, compress;q=0.5`, per [RFC 7230 §4.2.3](https://tools.ietf.org/html/rfc7230#section-4.2.3). -- `Accept-Language`, which defaults to up to the top 6 preferred languages on the system, formatted like `en;q=1.0`, per [RFC 7231 §5.3.5](https://tools.ietf.org/html/rfc7231#section-5.3.5). -- `User-Agent`, which contains versioning information about the current app. For example: `iOS Example/1.0 (com.alamofire.iOS-Example; build:1; iOS 10.0.0) Alamofire/4.0.0`, per [RFC 7231 §5.5.3](https://tools.ietf.org/html/rfc7231#section-5.5.3). - -If you need to customize these headers, a custom `URLSessionManagerConfiguration` should be created, the `defaultHTTPHeaders` property updated and the configuration applied to a new `SessionManager` instance. - -### Authentication - -Authentication is handled on the system framework level by [`URLCredential`](https://developer.apple.com/reference/foundation/nsurlcredential) and [`URLAuthenticationChallenge`](https://developer.apple.com/reference/foundation/urlauthenticationchallenge). - -**Supported Authentication Schemes** - -- [HTTP Basic](http://en.wikipedia.org/wiki/Basic_access_authentication) -- [HTTP Digest](http://en.wikipedia.org/wiki/Digest_access_authentication) -- [Kerberos](http://en.wikipedia.org/wiki/Kerberos_%28protocol%29) -- [NTLM](http://en.wikipedia.org/wiki/NT_LAN_Manager) - -#### HTTP Basic Authentication - -The `authenticate` method on a `Request` will automatically provide a `URLCredential` to a `URLAuthenticationChallenge` when appropriate: - -```swift -let user = "user" -let password = "password" - -Alamofire.request("https://httpbin.org/basic-auth/\(user)/\(password)") - .authenticate(user: user, password: password) - .responseJSON { response in - debugPrint(response) - } -``` - -Depending upon your server implementation, an `Authorization` header may also be appropriate: - -```swift -let user = "user" -let password = "password" - -var headers: HTTPHeaders = [:] - -if let authorizationHeader = Request.authorizationHeader(user: user, password: password) { - headers[authorizationHeader.key] = authorizationHeader.value -} - -Alamofire.request("https://httpbin.org/basic-auth/user/password", headers: headers) - .responseJSON { response in - debugPrint(response) - } -``` - -#### Authentication with URLCredential - -```swift -let user = "user" -let password = "password" - -let credential = URLCredential(user: user, password: password, persistence: .forSession) - -Alamofire.request("https://httpbin.org/basic-auth/\(user)/\(password)") - .authenticate(usingCredential: credential) - .responseJSON { response in - debugPrint(response) - } -``` - -> It is important to note that when using a `URLCredential` for authentication, the underlying `URLSession` will actually end up making two requests if a challenge is issued by the server. The first request will not include the credential which "may" trigger a challenge from the server. The challenge is then received by Alamofire, the credential is appended and the request is retried by the underlying `URLSession`. - -### Downloading Data to a File - -Requests made in Alamofire that fetch data from a server can download the data in-memory or on-disk. The `Alamofire.request` APIs used in all the examples so far always downloads the server data in-memory. This is great for smaller payloads because it's more efficient, but really bad for larger payloads because the download could run your entire application out-of-memory. Because of this, you can also use the `Alamofire.download` APIs to download the server data to a temporary file on-disk. - -```swift -Alamofire.download("https://httpbin.org/image/png").responseData { response in - if let data = response.result.value { - let image = UIImage(data: data) - } -} -``` - -> The `Alamofire.download` APIs should also be used if you need to download data while your app is in the background. For more information, please see the [Session Manager Configurations](#session-manager-configurations) section. - -#### Download File Destination - -You can also provide a `DownloadFileDestination` closure to move the file from the temporary directory to a final destination. Before the temporary file is actually moved to the `destinationURL`, the `DownloadOptions` specified in the closure will be executed. The two currently supported `DownloadOptions` are: - -- `.createIntermediateDirectories` - Creates intermediate directories for the destination URL if specified. -- `.removePreviousFile` - Removes a previous file from the destination URL if specified. - -```swift -let destination: DownloadRequest.DownloadFileDestination = { _, _ in - let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] - let fileURL = documentsURL.appendPathComponent("pig.png") - - return (fileURL, [.removePreviousFile, .createIntermediateDirectories]) -} - -Alamofire.download(urlString, to: destination).response { response in - print(response) - - if response.result.isSuccess, let imagePath = response.destinationURL?.path { - let image = UIImage(contentsOfFile: imagePath) - } -} -``` - -You can also use the suggested download destination API. - -```swift -let destination = DownloadRequest.suggestedDownloadDestination(directory: .documentDirectory) -Alamofire.download("https://httpbin.org/image/png", to: destination) -``` - -#### Download Progress - -Many times it can be helpful to report download progress to the user. Any `DownloadRequest` can report download progress using the `downloadProgress` API. - -```swift -Alamofire.download("https://httpbin.org/image/png") - .downloadProgress { progress in - print("Download Progress: \(progress.fractionCompleted)") - } - .responseData { response in - if let data = response.result.value { - let image = UIImage(data: data) - } - } -``` - -The `downloadProgress` API also takes a `queue` parameter which defines which `DispatchQueue` the download progress closure should be called on. - -```swift -let utilityQueue = DispatchQueue.global(qos: .utility) - -Alamofire.download("https://httpbin.org/image/png") - .downloadProgress(queue: utilityQueue) { progress in - print("Download Progress: \(progress.fractionCompleted)") - } - .responseData { response in - if let data = response.result.value { - let image = UIImage(data: data) - } - } -``` - -#### Resuming a Download - -If a `DownloadRequest` is cancelled or interrupted, the underlying URL session may generate resume data for the active `DownloadRequest`. If this happens, the resume data can be re-used to restart the `DownloadRequest` where it left off. The resume data can be accessed through the download response, then reused when trying to restart the request. - -```swift -class ImageRequestor { - private var resumeData: Data? - private var image: UIImage? - - func fetchImage(completion: (UIImage?) -> Void) { - guard image == nil else { completion(image) ; return } - - let destination: DownloadRequest.DownloadFileDestination = { _, _ in - let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] - let fileURL = documentsURL.appendPathComponent("pig.png") - - return (fileURL, [.removePreviousFile, .createIntermediateDirectories]) - } - - let request: DownloadRequest - - if let resumeData = resumeData { - request = Alamofire.download(resumingWith: resumeData) - } else { - request = Alamofire.download("https://httpbin.org/image/png") - } - - request.responseData { response in - switch response.result { - case .success(let data): - self.image = UIImage(data: data) - case .failure: - self.resumeData = response.resumeData - } - } - } -} -``` - -### Uploading Data to a Server - -When sending relatively small amounts of data to a server using JSON or URL encoded parameters, the `Alamofire.request` APIs are usually sufficient. If you need to send much larger amounts of data from a file URL or an `InputStream`, then the `Alamofire.upload` APIs are what you want to use. - -> The `Alamofire.upload` APIs should also be used if you need to upload data while your app is in the background. For more information, please see the [Session Manager Configurations](#session-manager-configurations) section. - -#### Uploading Data - -```swift -let imageData = UIPNGRepresentation(image)! - -Alamofire.upload(imageData, to: "https://httpbin.org/post").responseJSON { response in - debugPrint(response) -} -``` - -#### Uploading a File - -```swift -let fileURL = Bundle.main.url(forResource: "video", withExtension: "mov") - -Alamofire.upload(fileURL, to: "https://httpbin.org/post").responseJSON { response in - debugPrint(response) -} -``` - -#### Uploading Multipart Form Data - -```swift -Alamofire.upload( - multipartFormData: { multipartFormData in - multipartFormData.append(unicornImageURL, withName: "unicorn") - multipartFormData.append(rainbowImageURL, withName: "rainbow") - }, - to: "https://httpbin.org/post", - encodingCompletion: { encodingResult in - switch encodingResult { - case .success(let upload, _, _): - upload.responseJSON { response in - debugPrint(response) - } - case .failure(let encodingError): - print(encodingError) - } - } -) -``` - -#### Upload Progress - -While your user is waiting for their upload to complete, sometimes it can be handy to show the progress of the upload to the user. Any `UploadRequest` can report both upload progress and download progress of the response data using the `uploadProgress` and `downloadProgress` APIs. - -```swift -let fileURL = Bundle.main.url(forResource: "video", withExtension: "mov") - -Alamofire.upload(fileURL, to: "https://httpbin.org/post") - .uploadProgress { progress in // main queue by default - print("Upload Progress: \(progress.fractionCompleted)") - } - .downloadProgress { progress in // main queue by default - print("Download Progress: \(progress.fractionCompleted)") - } - .responseJSON { response in - debugPrint(response) - } -``` - -### Statistical Metrics - -#### Timeline - -Alamofire collects timings throughout the lifecycle of a `Request` and creates a `Timeline` object exposed as a property on all response types. - -```swift -Alamofire.request("https://httpbin.org/get").responseJSON { response in - print(response.timeline) -} -``` - -The above reports the following `Timeline` info: - -- `Latency`: 0.428 seconds -- `Request Duration`: 0.428 seconds -- `Serialization Duration`: 0.001 seconds -- `Total Duration`: 0.429 seconds - -#### URL Session Task Metrics - -In iOS and tvOS 10 and macOS 10.12, Apple introduced the new [URLSessionTaskMetrics](https://developer.apple.com/reference/foundation/urlsessiontaskmetrics) APIs. The task metrics encapsulate some fantastic statistical information about the request and response execution. The API is very similar to the `Timeline`, but provides many more statistics that Alamofire doesn't have access to compute. The metrics can be accessed through any response type. - -```swift -Alamofire.request("https://httpbin.org/get").responseJSON { response in - print(response.metrics) -} -``` - -It's important to note that these APIs are only available on iOS and tvOS 10 and macOS 10.12. Therefore, depending on your deployment target, you may need to use these inside availability checks: - -```swift -Alamofire.request("https://httpbin.org/get").responseJSON { response in - if #available(iOS 10.0. *) { - print(response.metrics) - } -} -``` - -### cURL Command Output - -Debugging platform issues can be frustrating. Thankfully, Alamofire `Request` objects conform to both the `CustomStringConvertible` and `CustomDebugStringConvertible` protocols to provide some VERY helpful debugging tools. - -#### CustomStringConvertible - -```swift -let request = Alamofire.request("https://httpbin.org/ip") - -print(request) -// GET https://httpbin.org/ip (200) -``` - -#### CustomDebugStringConvertible - -```swift -let request = Alamofire.request("https://httpbin.org/get", parameters: ["foo": "bar"]) -debugPrint(request) -``` - -Outputs: - -```bash -$ curl -i \ - -H "User-Agent: Alamofire/4.0.0" \ - -H "Accept-Encoding: gzip;q=1.0, compress;q=0.5" \ - -H "Accept-Language: en;q=1.0,fr;q=0.9,de;q=0.8,zh-Hans;q=0.7,zh-Hant;q=0.6,ja;q=0.5" \ - "https://httpbin.org/get?foo=bar" -``` - ---- - -## Advanced Usage - -Alamofire is built on `URLSession` and the Foundation URL Loading System. To make the most of this framework, it is recommended that you be familiar with the concepts and capabilities of the underlying networking stack. - -**Recommended Reading** - -- [URL Loading System Programming Guide](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html) -- [URLSession Class Reference](https://developer.apple.com/reference/foundation/nsurlsession) -- [URLCache Class Reference](https://developer.apple.com/reference/foundation/urlcache) -- [URLAuthenticationChallenge Class Reference](https://developer.apple.com/reference/foundation/urlauthenticationchallenge) - -### Session Manager - -Top-level convenience methods like `Alamofire.request` use a default instance of `Alamofire.SessionManager`, which is configured with the default `URLSessionConfiguration`. - -As such, the following two statements are equivalent: - -```swift -Alamofire.request("https://httpbin.org/get") -``` - -```swift -let sessionManager = Alamofire.SessionManager.default -sessionManager.request("https://httpbin.org/get") -``` - -Applications can create session managers for background and ephemeral sessions, as well as new managers that customize the default session configuration, such as for default headers (`httpAdditionalHeaders`) or timeout interval (`timeoutIntervalForRequest`). - -#### Creating a Session Manager with Default Configuration - -```swift -let configuration = URLSessionConfiguration.default -let sessionManager = Alamofire.SessionManager(configuration: configuration) -``` - -#### Creating a Session Manager with Background Configuration - -```swift -let configuration = URLSessionConfiguration.background(withIdentifier: "com.example.app.background") -let sessionManager = Alamofire.SessionManager(configuration: configuration) -``` - -#### Creating a Session Manager with Ephemeral Configuration - -```swift -let configuration = URLSessionConfiguration.ephemeral -let sessionManager = Alamofire.SessionManager(configuration: configuration) -``` - -#### Modifying the Session Configuration - -```swift -var defaultHeaders = Alamofire.SessionManager.default.defaultHTTPHeaders -defaultHeaders["DNT"] = "1 (Do Not Track Enabled)" - -let configuration = URLSessionConfiguration.default -configuration.httpAdditionalHeaders = defaultHeaders - -let sessionManager = Alamofire.SessionManager(configuration: configuration) -``` - -> This is **not** recommended for `Authorization` or `Content-Type` headers. Instead, use the `headers` parameter in the top-level `Alamofire.request` APIs, `URLRequestConvertible` and `ParameterEncoding`, respectively. - -### Session Delegate - -By default, an Alamofire `SessionManager` instance creates a `SessionDelegate` object to handle all the various types of delegate callbacks that are generated by the underlying `URLSession`. The implementations of each delegate method handle the most common use cases for these types of calls abstracting the complexity away from the top-level APIs. However, advanced users may find the need to override the default functionality for various reasons. - -#### Override Closures - -The first way to customize the `SessionDelegate` behavior is through the use of the override closures. Each closure gives you the ability to override the implementation of the matching `SessionDelegate` API, yet still use the default implementation for all other APIs. This makes it easy to customize subsets of the delegate functionality. Here are a few examples of some of the override closures available: - -```swift -/// Overrides default behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)`. -open var sessionDidReceiveChallenge: ((URLSession, URLAuthenticationChallenge) -> (URLSession.AuthChallengeDisposition, URLCredential?))? - -/// Overrides default behavior for URLSessionDelegate method `urlSessionDidFinishEvents(forBackgroundURLSession:)`. -open var sessionDidFinishEventsForBackgroundURLSession: ((URLSession) -> Void)? - -/// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)`. -open var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> URLRequest?)? - -/// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)`. -open var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)? -``` - -The following is a short example of how to use the `taskWillPerformHTTPRedirection` to avoid following redirects to any `apple.com` domains. - -```swift -let sessionManager = Alamofire.SessionManager(configuration: URLSessionConfiguration.default) -let delegate: Alamofire.SessionDelegate = sessionManager.delegate - -delegate.taskWillPerformHTTPRedirection = { session, task, response, request in - var finalRequest = request - - if - let originalRequest = task.originalRequest, - let urlString = originalRequest.url?.urlString, - urlString.contains("apple.com") - { - finalRequest = originalRequest - } - - return finalRequest -} -``` - -#### Subclassing - -Another way to override the default implementation of the `SessionDelegate` is to subclass it. Subclassing allows you completely customize the behavior of the API or to create a proxy for the API and still use the default implementation. Creating a proxy allows you to log events, emit notifications, provide pre and post hook implementations, etc. Here's a quick example of subclassing the `SessionDelegate` and logging a message when a redirect occurs. - -```swift -class LoggingSessionDelegate: SessionDelegate { - override func urlSession( - _ session: URLSession, - task: URLSessionTask, - willPerformHTTPRedirection response: HTTPURLResponse, - newRequest request: URLRequest, - completionHandler: @escaping (URLRequest?) -> Void) - { - print("URLSession will perform HTTP redirection to request: \(request)") - - super.urlSession( - session, - task: task, - willPerformHTTPRedirection: response, - newRequest: request, - completionHandler: completionHandler - ) - } -} -``` - -Generally speaking, either the default implementation or the override closures should provide the necessary functionality required. Subclassing should only be used as a last resort. - -> It is important to keep in mind that the `subdelegates` are initialized and destroyed in the default implementation. Be careful when subclassing to not introduce memory leaks. - -### Request - -The result of a `request`, `download`, `upload` or `stream` methods are a `DataRequest`, `DownloadRequest`, `UploadRequest` and `StreamRequest` which all inherit from `Request`. All `Request` instances are always created by an owning session manager, and never initialized directly. - -Each subclass has specialized methods such as `authenticate`, `validate`, `responseJSON` and `uploadProgress` that each return the caller instance in order to facilitate method chaining. - -Requests can be suspended, resumed and cancelled: - -- `suspend()`: Suspends the underlying task and dispatch queue. -- `resume()`: Resumes the underlying task and dispatch queue. If the owning manager does not have `startRequestsImmediately` set to `true`, the request must call `resume()` in order to start. -- `cancel()`: Cancels the underlying task, producing an error that is passed to any registered response handlers. - -### Routing Requests - -As apps grow in size, it's important to adopt common patterns as you build out your network stack. An important part of that design is how to route your requests. The Alamofire `URLConvertible` and `URLRequestConvertible` protocols along with the `Router` design pattern are here to help. - -#### URLConvertible - -Types adopting the `URLConvertible` protocol can be used to construct URLs, which are then used to construct URL requests internally. `String`, `URL`, and `URLComponents` conform to `URLConvertible` by default, allowing any of them to be passed as `url` parameters to the `request`, `upload`, and `download` methods: - -```swift -let urlString = "https://httpbin.org/post" -Alamofire.request(urlString, method: .post) - -let url = URL(string: urlString)! -Alamofire.request(url, method: .post) - -let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: true) -Alamofire.request(.post, URLComponents) -``` - -Applications interacting with web applications in a significant manner are encouraged to have custom types conform to `URLConvertible` as a convenient way to map domain-specific models to server resources. - -##### Type-Safe Routing - -```swift -extension User: URLConvertible { - static let baseURLString = "https://example.com" - - func asURL() throws -> URL { - let urlString = User.baseURLString + "/users/\(username)/" - return try urlString.asURL() - } -} -``` - -```swift -let user = User(username: "mattt") -Alamofire.request(user) // https://example.com/users/mattt -``` - -#### URLRequestConvertible - -Types adopting the `URLRequestConvertible` protocol can be used to construct URL requests. `URLRequest` conforms to `URLRequestConvertible` by default, allowing it to be passed into `request`, `upload`, and `download` methods directly (this is the recommended way to specify custom HTTP body for individual requests): - -```swift -let url = URL(string: "https://httpbin.org/post")! -var urlRequest = URLRequest(url: url) -urlRequest.httpMethod = "POST" - -let parameters = ["foo": "bar"] - -do { - urlRequest.httpBody = try JSONSerialization.data(withJSONObject: parameters, options: []) -} catch { - // No-op -} - -urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") - -Alamofire.request(urlRequest) -``` - -Applications interacting with web applications in a significant manner are encouraged to have custom types conform to `URLRequestConvertible` as a way to ensure consistency of requested endpoints. Such an approach can be used to abstract away server-side inconsistencies and provide type-safe routing, as well as manage authentication credentials and other state. - -##### API Parameter Abstraction - -```swift -enum Router: URLRequestConvertible { - case search(query: String, page: Int) - - static let baseURLString = "https://example.com" - static let perPage = 50 - - // MARK: URLRequestConvertible - - func asURLRequest() throws -> URLRequest { - let result: (path: String, parameters: Parameters) = { - switch self { - case let .search(query, page) where page > 0: - return ("/search", ["q": query, "offset": Router.perPage * page]) - case let .search(query, _): - return ("/search", ["q": query]) - } - }() - - let url = try Router.baseURLString.asURL() - let urlRequest = URLRequest(url: url.appendingPathComponent(result.path)) - - return try URLEncoding.default.encode(urlRequest, with: result.parameters) - } -} -``` - -```swift -Alamofire.request(Router.search(query: "foo bar", page: 1)) // ?q=foo%20bar&offset=50 -``` - -##### CRUD & Authorization - -```swift -import Alamofire - -enum Router: URLRequestConvertible { - case createUser(parameters: Parameters) - case readUser(username: String) - case updateUser(username: String, parameters: Parameters) - case destroyUser(username: String) - - static let baseURLString = "https://example.com" - - var method: HTTPMethod { - switch self { - case .createUser: - return .post - case .readUser: - return .get - case .updateUser: - return .put - case .destroyUser: - return .delete - } - } - - var path: String { - switch self { - case .createUser: - return "/users" - case .readUser(let username): - return "/users/\(username)" - case .updateUser(let username, _): - return "/users/\(username)" - case .destroyUser(let username): - return "/users/\(username)" - } - } - - // MARK: URLRequestConvertible - - func asURLRequest() throws -> URLRequest { - let url = try Router.baseURLString.asURL() - - var urlRequest = URLRequest(url: url.appendingPathComponent(path)) - urlRequest.httpMethod = method.rawValue - - switch self { - case .createUser(let parameters): - urlRequest = try URLEncoding.default.encode(urlRequest, with: parameters) - case .updateUser(_, let parameters): - urlRequest = try URLEncoding.default.encode(urlRequest, with: parameters) - default: - break - } - - return urlRequest - } -} -``` - -```swift -Alamofire.request(Router.readUser("mattt")) // GET /users/mattt -``` - -### Adapting and Retrying Requests - -Most web services these days are behind some sort of authentication system. One of the more common ones today is OAuth. This generally involves generating an access token authorizing your application or user to call the various supported web services. While creating these initial access tokens can be laborsome, it can be even more complicated when your access token expires and you need to fetch a new one. There are many thread-safety issues that need to be considered. - -The `RequestAdapter` and `RequestRetrier` protocols were created to make it much easier to create a thread-safe authentication system for a specific set of web services. - -#### RequestAdapter - -The `RequestAdapter` protocol allows each `Request` made on a `SessionManager` to be inspected and adapted before being created. One very specific way to use an adapter is to append an `Authorization` header to requests behind a certain type of authentication. - -```swift -class AccessTokenAdapter: RequestAdapter { - private let accessToken: String - - init(accessToken: String) { - self.accessToken = accessToken - } - - func adapt(_ urlRequest: URLRequest) throws -> URLRequest { - var urlRequest = urlRequest - - if urlRequest.urlString.hasPrefix("https://httpbin.org") { - urlRequest.setValue("Bearer " + accessToken, forHTTPHeaderField: "Authorization") - } - - return urlRequest - } -} -``` - -```swift -let sessionManager = SessionManager() -sessionManager.adapter = AccessTokenAdapter(accessToken: "1234") - -sessionManager.request("https://httpbin.org/get") -``` - -#### RequestRetrier - -The `RequestRetrier` protocol allows a `Request` that encountered an `Error` while being executed to be retried. When using both the `RequestAdapter` and `RequestRetrier` protocols together, you can create credential refresh systems for OAuth1, OAuth2, Basic Auth and even exponential backoff retry policies. The possibilities are endless. Here's an example of how you could implement a refresh flow for OAuth2 access tokens. - -> **DISCLAIMER:** This is **NOT** a global `OAuth2` solution. It is merely an example demonstrating how one could use the `RequestAdapter` in conjunction with the `RequestRetrier` to create a thread-safe refresh system. - -> To reiterate, **do NOT copy** this sample code and drop it into a production application. This is merely an example. Each authentication system must be tailored to a particular platform and authentication type. - -```swift -class OAuth2Handler: RequestAdapter, RequestRetrier { - private typealias RefreshCompletion = (_ succeeded: Bool, _ accessToken: String?, _ refreshToken: String?) -> Void - - private let sessionManager: SessionManager = { - let configuration = URLSessionConfiguration.default - configuration.httpAdditionalHeaders = SessionManager.defaultHTTPHeaders - - return SessionManager(configuration: configuration) - }() - - private let lock = NSLock() - - private var clientID: String - private var baseURLString: String - private var accessToken: String - private var refreshToken: String - - private var isRefreshing = false - private var requestsToRetry: [RequestRetryCompletion] = [] - - // MARK: - Initialization - - public init(clientID: String, baseURLString: String, accessToken: String, refreshToken: String) { - self.clientID = clientID - self.baseURLString = baseURLString - self.accessToken = accessToken - self.refreshToken = refreshToken - } - - // MARK: - RequestAdapter - - func adapt(_ urlRequest: URLRequest) throws -> URLRequest { - if let url = urlRequest.url, url.urlString.hasPrefix(baseURLString) { - var urlRequest = urlRequest - urlRequest.setValue("Bearer " + accessToken, forHTTPHeaderField: "Authorization") - return urlRequest - } - - return urlRequest - } - - // MARK: - RequestRetrier - - func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion) { - lock.lock() ; defer { lock.unlock() } - - if let response = request.task.response as? HTTPURLResponse, response.statusCode == 401 { - requestsToRetry.append(completion) - - if !isRefreshing { - refreshTokens { [weak self] succeeded, accessToken, refreshToken in - guard let strongSelf = self else { return } - - strongSelf.lock.lock() ; defer { strongSelf.lock.unlock() } - - if let accessToken = accessToken, let refreshToken = refreshToken { - strongSelf.accessToken = accessToken - strongSelf.refreshToken = refreshToken - } - - strongSelf.requestsToRetry.forEach { $0(succeeded, 0.0) } - strongSelf.requestsToRetry.removeAll() - } - } - } else { - completion(false, 0.0) - } - } - - // MARK: - Private - Refresh Tokens - - private func refreshTokens(completion: @escaping RefreshCompletion) { - guard !isRefreshing else { return } - - isRefreshing = true - - let urlString = "\(baseURLString)/oauth2/token" - - let parameters: [String: Any] = [ - "access_token": accessToken, - "refresh_token": refreshToken, - "client_id": clientID, - "grant_type": "refresh_token" - ] - - sessionManager.request(urlString, method: .post, parameters: parameters, encoding: JSONEncoding.default) - .responseJSON { [weak self] response in - guard let strongSelf = self else { return } - - if let json = response.result.value as? [String: String] { - completion(true, json["access_token"], json["refresh_token"]) - } else { - completion(false, nil, nil) - } - - strongSelf.isRefreshing = false - } - } -} -``` - -```swift -let baseURLString = "https://some.domain-behind-oauth2.com" - -let oauthHandler = OAuth2Handler( - clientID: "12345678", - baseURLString: baseURLString, - accessToken: "abcd1234", - refreshToken: "ef56789a" -) - -let sessionManager = SessionManager() -sessionManager.adapter = oauthHandler -sessionManager.retrier = oauthHandler - -let urlString = "\(baseURLString)/some/endpoint" - -sessionManager.request(urlString).validate().responseJSON { response in - debugPrint(response) -} -``` - -Once the `OAuth2Handler` is applied as both the `adapter` and `retrier` for the `SessionManager`, it will handle an invalid access token error by automatically refreshing the access token and retrying all failed requests in the same order they failed. - -> If you needed them to execute in the same order they were created, you could sort them by their task identifiers. - -The example above only checks for a `401` response code which is not nearly robust enough, but does demonstrate how one could check for an invalid access token error. In a production application, one would want to check the `realm` and most likely the `www-authenticate` header response although it depends on the OAuth2 implementation. - -Another important note is that this authentication system could be shared between multiple session managers. For example, you may need to use both a `default` and `ephemeral` session configuration for the same set of web services. The example above allows the same `oauthHandler` instance to be shared across multiple session managers to manage the single refresh flow. - -### Custom Response Serialization - -#### Handling Errors - -Before implementing custom response serializers or object serialization methods, it's important to consider how to handle any errors that may occur. There are two basic options: passing existing errors along unmodified, to be dealt with at response time; or, wrapping all errors in an `Error` type specific to your app. - -For example, here's a simple `BackendError` enum which will be used in later examples: - -```swift -enum BackendError: Error { - case network(error: Error) // Capture any underlying Error from the URLSession API - case dataSerialization(error: Error) - case jsonSerialization(error: Error) - case xmlSerialization(error: Error) - case objectSerialization(reason: String) -} -``` - -#### Creating a Custom Response Serializer - -Alamofire provides built-in response serialization for strings, JSON, and property lists, but others can be added in extensions on `Alamofire.DataRequest` and / or `Alamofire.DownloadRequest`. - -For example, here's how a response handler using [Ono](https://github.com/mattt/Ono) might be implemented: - -```swift -extension DataRequest { - static func xmlResponseSerializer() -> DataResponseSerializer { - return DataResponseSerializer { request, response, data, error in - // Pass through any underlying URLSession error to the .network case. - guard error == nil else { return .failure(BackendError.network(error: error!)) } - - // Use Alamofire's existing data serializer to extract the data, passing the error as nil, as it has - // already been handled. - let result = Request.serializeResponseData(response: response, data: data, error: nil) - - guard case let .success(validData) = result else { - return .failure(BackendError.dataSerialization(error: result.error! as! AFError)) - } - - do { - let xml = try ONOXMLDocument(data: validData) - return .success(xml) - } catch { - return .failure(BackendError.xmlSerialization(error: error)) - } - } - } - - @discardableResult - func responseXMLDocument( - queue: DispatchQueue? = nil, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DataRequest.xmlResponseSerializer(), - completionHandler: completionHandler - ) - } -} -``` - -#### Generic Response Object Serialization - -Generics can be used to provide automatic, type-safe response object serialization. - -```swift -protocol ResponseObjectSerializable { - init?(response: HTTPURLResponse, representation: Any) -} - -extension DataRequest { - func responseObject( - queue: DispatchQueue? = nil, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - { - let responseSerializer = DataResponseSerializer { request, response, data, error in - guard error == nil else { return .failure(BackendError.network(error: error!)) } - - let jsonResponseSerializer = DataRequest.jsonResponseSerializer(options: .allowFragments) - let result = jsonResponseSerializer.serializeResponse(request, response, data, nil) - - guard case let .success(jsonObject) = result else { - return .failure(BackendError.jsonSerialization(error: result.error!)) - } - - guard let response = response, let responseObject = T(response: response, representation: jsonObject) else { - return .failure(BackendError.objectSerialization(reason: "JSON could not be serialized: \(jsonObject)")) - } - - return .success(responseObject) - } - - return response(queue: queue, responseSerializer: responseSerializer, completionHandler: completionHandler) - } -} -``` - -```swift -struct User: ResponseObjectSerializable, CustomStringConvertible { - let username: String - let name: String - - var description: String { - return "User: { username: \(username), name: \(name) }" - } - - init?(response: HTTPURLResponse, representation: Any) { - guard - let username = response.url?.lastPathComponent, - let representation = representation as? [String: Any], - let name = representation["name"] as? String - else { return nil } - - self.username = username - self.name = name - } -} -``` - -```swift -Alamofire.request("https://example.com/users/mattt").responseObject { (response: DataResponse) in - debugPrint(response) - - if let user = response.result.value { - print("User: { username: \(user.username), name: \(user.name) }") - } -} -``` - -The same approach can also be used to handle endpoints that return a representation of a collection of objects: - -```swift -protocol ResponseCollectionSerializable { - static func collection(from response: HTTPURLResponse, withRepresentation representation: Any) -> [Self] -} - -extension ResponseCollectionSerializable where Self: ResponseObjectSerializable { - static func collection(from response: HTTPURLResponse, withRepresentation representation: Any) -> [Self] { - var collection: [Self] = [] - - if let representation = representation as? [[String: Any]] { - for itemRepresentation in representation { - if let item = Self(response: response, representation: itemRepresentation) { - collection.append(item) - } - } - } - - return collection - } -} -``` - -```swift -extension DataRequest { - @discardableResult - func responseCollection( - queue: DispatchQueue? = nil, - completionHandler: @escaping (DataResponse<[T]>) -> Void) -> Self - { - let responseSerializer = DataResponseSerializer<[T]> { request, response, data, error in - guard error == nil else { return .failure(BackendError.network(error: error!)) } - - let jsonSerializer = DataRequest.jsonResponseSerializer(options: .allowFragments) - let result = jsonSerializer.serializeResponse(request, response, data, nil) - - guard case let .success(jsonObject) = result else { - return .failure(BackendError.jsonSerialization(error: result.error!)) - } - - guard let response = response else { - let reason = "Response collection could not be serialized due to nil response." - return .failure(BackendError.objectSerialization(reason: reason)) - } - - return .success(T.collection(from: response, withRepresentation: jsonObject)) - } - - return response(responseSerializer: responseSerializer, completionHandler: completionHandler) - } -} -``` - -```swift -struct User: ResponseObjectSerializable, ResponseCollectionSerializable, CustomStringConvertible { - let username: String - let name: String - - var description: String { - return "User: { username: \(username), name: \(name) }" - } - - init?(response: HTTPURLResponse, representation: Any) { - guard - let username = response.url?.lastPathComponent, - let representation = representation as? [String: Any], - let name = representation["name"] as? String - else { return nil } - - self.username = username - self.name = name - } -} -``` - -```swift -Alamofire.request("https://example.com/users").responseCollection { (response: DataResponse<[User]>) in - debugPrint(response) - - if let users = response.result.value { - users.forEach { print("- \($0)") } - } -} -``` - -### Security - -Using a secure HTTPS connection when communicating with servers and web services is an important step in securing sensitive data. By default, Alamofire will evaluate the certificate chain provided by the server using Apple's built in validation provided by the Security framework. While this guarantees the certificate chain is valid, it does not prevent man-in-the-middle (MITM) attacks or other potential vulnerabilities. In order to mitigate MITM attacks, applications dealing with sensitive customer data or financial information should use certificate or public key pinning provided by the `ServerTrustPolicy`. - -#### ServerTrustPolicy - -The `ServerTrustPolicy` enumeration evaluates the server trust generally provided by an `URLAuthenticationChallenge` when connecting to a server over a secure HTTPS connection. - -```swift -let serverTrustPolicy = ServerTrustPolicy.pinCertificates( - certificates: ServerTrustPolicy.certificatesInBundle(), - validateCertificateChain: true, - validateHost: true -) -``` - -There are many different cases of server trust evaluation giving you complete control over the validation process: - -* `performDefaultEvaluation`: Uses the default server trust evaluation while allowing you to control whether to validate the host provided by the challenge. -* `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. -* `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. -* `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 thus giving you complete control over the validation process. Use with caution. - -#### Server Trust Policy Manager - -The `ServerTrustPolicyManager` is responsible for storing an internal mapping of server trust policies to a particular host. This allows Alamofire to evaluate each host against a different server trust policy. - -```swift -let serverTrustPolicies: [String: ServerTrustPolicy] = [ - "test.example.com": .pinCertificates( - certificates: ServerTrustPolicy.certificatesInBundle(), - validateCertificateChain: true, - validateHost: true - ), - "insecure.expired-apis.com": .disableEvaluation -] - -let sessionManager = SessionManager( - serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies) -) -``` - -> Make sure to keep a reference to the new `SessionManager` instance, otherwise your requests will all get cancelled when your `sessionManager` is deallocated. - -These server trust policies will result in the following behavior: - -- `test.example.com` will always use certificate pinning with certificate chain and host validation enabled thus requiring the following criteria to be met to allow the TLS handshake to succeed: - - Certificate chain MUST be valid. - - Certificate chain MUST include one of the pinned certificates. - - Challenge host MUST match the host in the certificate chain's leaf certificate. -- `insecure.expired-apis.com` will never evaluate the certificate chain and will always allow the TLS handshake to succeed. -- All other hosts will use the default evaluation provided by Apple. - -##### Subclassing Server Trust Policy Manager - -If you find yourself needing more flexible server trust policy matching behavior (i.e. wildcarded domains), then subclass the `ServerTrustPolicyManager` and override the `serverTrustPolicyForHost` method with your own custom implementation. - -```swift -class CustomServerTrustPolicyManager: ServerTrustPolicyManager { - override func serverTrustPolicy(forHost host: String) -> ServerTrustPolicy? { - var policy: ServerTrustPolicy? - - // Implement your custom domain matching behavior... - - return policy - } -} -``` - -#### Validating the Host - -The `.performDefaultEvaluation`, `.pinCertificates` and `.pinPublicKeys` server trust policies all take a `validateHost` parameter. Setting the value to `true` will cause the server trust evaluation to verify that hostname in the certificate matches the hostname of the challenge. If they do not match, evaluation will fail. A `validateHost` value of `false` will still evaluate the full certificate chain, but will not validate the hostname of the leaf certificate. - -> It is recommended that `validateHost` always be set to `true` in production environments. - -#### Validating the Certificate Chain - -Pinning certificates and public keys both have the option of validating the certificate chain using the `validateCertificateChain` parameter. By setting this value to `true`, the full certificate chain will be evaluated in addition to performing a byte equality check against the pinned certificates or public keys. A value of `false` will skip the certificate chain validation, but will still perform the byte equality check. - -There are several cases where it may make sense to disable certificate chain validation. The most common use cases for disabling validation are self-signed and expired certificates. The evaluation would always fail in both of these cases, but the byte equality check will still ensure you are receiving the certificate you expect from the server. - -> It is recommended that `validateCertificateChain` always be set to `true` in production environments. - -#### App Transport Security - -With the addition of App Transport Security (ATS) in iOS 9, it is possible that using a custom `ServerTrustPolicyManager` with several `ServerTrustPolicy` objects will have no effect. If you continuously see `CFNetwork SSLHandshake failed (-9806)` errors, you have probably run into this problem. Apple's ATS system overrides the entire challenge system unless you configure the ATS settings in your app's plist to disable enough of it to allow your app to evaluate the server trust. - -If you run into this problem (high probability with self-signed certificates), you can work around this issue by adding the following to your `Info.plist`. - -```xml - - NSAppTransportSecurity - - NSExceptionDomains - - example.com - - NSExceptionAllowsInsecureHTTPLoads - - NSExceptionRequiresForwardSecrecy - - NSIncludesSubdomains - - - NSTemporaryExceptionMinimumTLSVersion - TLSv1.2 - - - - -``` - -Whether you need to set the `NSExceptionRequiresForwardSecrecy` to `NO` depends on whether your TLS connection is using an allowed cipher suite. In certain cases, it will need to be set to `NO`. The `NSExceptionAllowsInsecureHTTPLoads` MUST be set to `YES` in order to allow the `SessionDelegate` to receive challenge callbacks. Once the challenge callbacks are being called, the `ServerTrustPolicyManager` will take over the server trust evaluation. You may also need to specify the `NSTemporaryExceptionMinimumTLSVersion` if you're trying to connect to a host that only supports TLS versions less than `1.2`. - -> It is recommended to always use valid certificates in production environments. - -### Network Reachability - -The `NetworkReachabilityManager` listens for reachability changes of hosts and addresses for both WWAN and WiFi network interfaces. - -```swift -let manager = NetworkReachabilityManager(host: "www.apple.com") - -manager?.listener = { status in - print("Network Status Changed: \(status)") -} - -manager?.startListening() -``` - -> Make sure to remember to retain the `manager` in the above example, or no status changes will be reported. - -There are some important things to remember when using network reachability to determine what to do next. - -- **Do NOT** use Reachability to determine if a network request should be sent. - - You should **ALWAYS** send it. -- When Reachability is restored, use the event to retry failed network requests. - - Even though the network requests may still fail, this is a good moment to retry them. -- The network reachability status can be useful for determining why a network request may have failed. - - If a network request fails, it is more useful to tell the user that the network request failed due to being offline rather than a more technical error, such as "request timed out." - -> It is recommended to check out [WWDC 2012 Session 706, "Networking Best Practices"](https://developer.apple.com/videos/play/wwdc2012-706/) for more info. - ---- - -## Open Radars - -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://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage -- `rdar://26870455` - Background URL Session Configurations do not work in the simulator -- `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest` - -## 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. - -### Security Disclosure - -If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker. - -## Donations - -The [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially register as a federal non-profit organization. Registering will allow us members to gain some legal protections and also allow us to put donations to use, tax free. Donating to the ASF will enable us to: - -- Pay our legal fees to register as a federal non-profit organization -- Pay our yearly legal fees to keep the non-profit in good status -- Pay for our mail servers to help us stay on top of all questions and security issues -- Potentially fund test servers to make it easier for us to test the edge cases -- Potentially fund developers to work on one of our projects full-time - -The community adoption of the ASF libraries has been amazing. We are greatly humbled by your enthusiasm around the projects, and want to continue to do everything we can to move the needle forward. With your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members. If you use any of our libraries for work, see if your employers would be interested in donating. Our initial goal is to raise $1000 to get all our legal ducks in a row and kickstart this campaign. Any amount you can donate today to help us reach our goal would be greatly appreciated. - -Click here to lend your support to: Alamofire Software Foundation and make a donation at pledgie.com ! - -## License - -Alamofire is released under the MIT license. See LICENSE for details. diff --git a/Example/Pods/Alamofire/Source/AFError.swift b/Example/Pods/Alamofire/Source/AFError.swift deleted file mode 100644 index 82e8a25..0000000 --- a/Example/Pods/Alamofire/Source/AFError.swift +++ /dev/null @@ -1,450 +0,0 @@ -// -// AFError.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 - -/// `AFError` is the error type returned by Alamofire. It encompasses a few different types of errors, each with -/// their own associated reasons. -/// -/// - 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. -/// - multipartEncodingFailed: Returned when some step in the multipart encoding process fails. -/// - responseValidationFailed: Returned when a `validate()` call fails. -/// - responseSerializationFailed: Returned when a response serializer encounters an error in the serialization 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) - } - - /// The underlying reason the multipart encoding error occurred. - /// - /// - bodyPartURLInvalid: The `fileURL` provided for reading an encodable body part isn't a - /// file URL. - /// - bodyPartFilenameInvalid: The filename of the `fileURL` provided has either an empty - /// `lastPathComponent` or `pathExtension. - /// - bodyPartFileNotReachable: The file at the `fileURL` provided was not reachable. - /// - bodyPartFileNotReachableWithError: Attempting to check the reachability of the `fileURL` provided threw - /// an error. - /// - bodyPartFileIsDirectory: The file at the `fileURL` provided is actually a directory. - /// - bodyPartFileSizeNotAvailable: The size of the file at the `fileURL` provided was not returned by - /// the system. - /// - bodyPartFileSizeQueryFailedWithError: The attempt to find the size of the file at the `fileURL` provided - /// threw an error. - /// - bodyPartInputStreamCreationFailed: An `InputStream` could not be created for the provided `fileURL`. - /// - outputStreamCreationFailed: An `OutputStream` could not be created when attempting to write the - /// encoded data to disk. - /// - outputStreamFileAlreadyExists: The encoded body data could not be writtent disk because a file - /// already exists at the provided `fileURL`. - /// - outputStreamURLInvalid: The `fileURL` provided for writing the encoded body data to disk is - /// not a file URL. - /// - outputStreamWriteFailed: The attempt to write the encoded body data to disk failed with an - /// underlying error. - /// - inputStreamReadFailed: The attempt to read an encoded body part `InputStream` failed with - /// underlying system error. - public enum MultipartEncodingFailureReason { - case bodyPartURLInvalid(url: URL) - case bodyPartFilenameInvalid(in: URL) - case bodyPartFileNotReachable(at: URL) - case bodyPartFileNotReachableWithError(atURL: URL, error: Error) - case bodyPartFileIsDirectory(at: URL) - case bodyPartFileSizeNotAvailable(at: URL) - case bodyPartFileSizeQueryFailedWithError(forURL: URL, error: Error) - case bodyPartInputStreamCreationFailed(for: URL) - - case outputStreamCreationFailed(for: URL) - case outputStreamFileAlreadyExists(at: URL) - case outputStreamURLInvalid(url: URL) - case outputStreamWriteFailed(error: Error) - - case inputStreamReadFailed(error: Error) - } - - /// The underlying reason the response validation error occurred. - /// - /// - dataFileNil: The data file containing the server response did not exist. - /// - dataFileReadFailed: The data file containing the server response could not be read. - /// - missingContentType: The response did not contain a `Content-Type` and the `acceptableContentTypes` - /// provided did not contain wildcard type. - /// - unacceptableContentType: The response `Content-Type` did not match any type in the provided - /// `acceptableContentTypes`. - /// - unacceptableStatusCode: The response status code was not acceptable. - public enum ResponseValidationFailureReason { - case dataFileNil - case dataFileReadFailed(at: URL) - case missingContentType(acceptableContentTypes: [String]) - case unacceptableContentType(acceptableContentTypes: [String], responseContentType: String) - case unacceptableStatusCode(code: Int) - } - - /// 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 - case inputDataNilOrZeroLength - case inputFileNil - case inputFileReadFailed(at: URL) - case stringSerializationFailed(encoding: String.Encoding) - case jsonSerializationFailed(error: Error) - case propertyListSerializationFailed(error: Error) - } - - case invalidURL(url: URLConvertible) - case parameterEncodingFailed(reason: ParameterEncodingFailureReason) - case multipartEncodingFailed(reason: MultipartEncodingFailureReason) - case responseValidationFailed(reason: ResponseValidationFailureReason) - case responseSerializationFailed(reason: ResponseSerializationFailureReason) -} - -// MARK: - Error Booleans - -extension AFError { - /// Returns whether the AFError is an invalid URL error. - 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 - /// 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. - 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`, - /// `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 - /// `underlyingError` properties will contain the associated values. - public var isResponseSerializationError: Bool { - if case .responseSerializationFailed = self { return true } - return false - } -} - -// MARK: - Convenience Properties - -extension AFError { - /// The `URLConvertible` associated with the error. - public var urlConvertible: URLConvertible? { - switch self { - case .invalidURL(let url): - return url - default: - return nil - } - } - - /// The `URL` associated with the error. - public var url: URL? { - switch self { - case .multipartEncodingFailed(let reason): - return reason.url - default: - return nil - } - } - - /// The `Error` returned by a system framework associated with a `.parameterEncodingFailed`, - /// `.multipartEncodingFailed` or `.responseSerializationFailed` error. - public var underlyingError: Error? { - switch self { - case .parameterEncodingFailed(let reason): - return reason.underlyingError - case .multipartEncodingFailed(let reason): - return reason.underlyingError - case .responseSerializationFailed(let reason): - return reason.underlyingError - default: - return nil - } - } - - /// 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 - } - } - - /// The response `Content-Type` of a `.responseValidationFailed` error. - public var responseContentType: String? { - switch self { - case .responseValidationFailed(let reason): - return reason.responseContentType - default: - return nil - } - } - - /// The response code of a `.responseValidationFailed` error. - public var responseCode: Int? { - switch self { - case .responseValidationFailed(let reason): - return reason.responseCode - default: - return nil - } - } - - /// 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 - } - } -} - -extension AFError.ParameterEncodingFailureReason { - var underlyingError: Error? { - switch self { - case .jsonEncodingFailed(let error), .propertyListEncodingFailed(let error): - return error - default: - return nil - } - } -} - -extension AFError.MultipartEncodingFailureReason { - var url: URL? { - switch self { - case .bodyPartURLInvalid(let url), .bodyPartFilenameInvalid(let url), .bodyPartFileNotReachable(let url), - .bodyPartFileIsDirectory(let url), .bodyPartFileSizeNotAvailable(let url), - .bodyPartInputStreamCreationFailed(let url), .outputStreamCreationFailed(let url), - .outputStreamFileAlreadyExists(let url), .outputStreamURLInvalid(let url), - .bodyPartFileNotReachableWithError(let url, _), .bodyPartFileSizeQueryFailedWithError(let url, _): - return url - default: - return nil - } - } - - var underlyingError: Error? { - switch self { - case .bodyPartFileNotReachableWithError(_, let error), .bodyPartFileSizeQueryFailedWithError(_, let error), - .outputStreamWriteFailed(let error), .inputStreamReadFailed(let error): - return error - default: - return nil - } - } -} - -extension AFError.ResponseValidationFailureReason { - var acceptableContentTypes: [String]? { - switch self { - case .missingContentType(let types), .unacceptableContentType(let types, _): - return types - default: - return nil - } - } - - var responseContentType: String? { - switch self { - case .unacceptableContentType(_, let responseType): - return responseType - default: - return nil - } - } - - var responseCode: Int? { - switch self { - case .unacceptableStatusCode(let code): - return code - default: - return nil - } - } -} - -extension AFError.ResponseSerializationFailureReason { - var failedStringEncoding: String.Encoding? { - switch self { - case .stringSerializationFailed(let encoding): - return encoding - default: - return nil - } - } - - var underlyingError: Error? { - switch self { - case .jsonSerializationFailed(let error), .propertyListSerializationFailed(let error): - return error - default: - return nil - } - } -} - -// MARK: - Error Descriptions - -extension AFError: LocalizedError { - public var errorDescription: String? { - switch self { - case .invalidURL(let url): - return "URL is not valid: \(url)" - case .parameterEncodingFailed(let reason): - return reason.localizedDescription - case .multipartEncodingFailed(let reason): - return reason.localizedDescription - case .responseValidationFailed(let reason): - return reason.localizedDescription - case .responseSerializationFailed(let reason): - return reason.localizedDescription - } - } -} - -extension AFError.ParameterEncodingFailureReason { - var localizedDescription: String { - switch self { - case .missingURL: - 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.MultipartEncodingFailureReason { - var localizedDescription: String { - switch self { - case .bodyPartURLInvalid(let url): - return "The URL provided is not a file URL: \(url)" - case .bodyPartFilenameInvalid(let url): - return "The URL provided does not have a valid filename: \(url)" - case .bodyPartFileNotReachable(let url): - return "The URL provided is not reachable: \(url)" - case .bodyPartFileNotReachableWithError(let url, let error): - return ( - "The system returned an error while checking the provided URL for " + - "reachability.\nURL: \(url)\nError: \(error)" - ) - case .bodyPartFileIsDirectory(let url): - return "The URL provided is a directory: \(url)" - case .bodyPartFileSizeNotAvailable(let url): - return "Could not fetch the file size from the provided URL: \(url)" - case .bodyPartFileSizeQueryFailedWithError(let url, let error): - return ( - "The system returned an error while attempting to fetch the file size from the " + - "provided URL.\nURL: \(url)\nError: \(error)" - ) - case .bodyPartInputStreamCreationFailed(let url): - return "Failed to create an InputStream for the provided URL: \(url)" - case .outputStreamCreationFailed(let url): - return "Failed to create an OutputStream for URL: \(url)" - case .outputStreamFileAlreadyExists(let url): - return "A file already exists at the provided URL: \(url)" - case .outputStreamURLInvalid(let url): - return "The provided OutputStream URL is invalid: \(url)" - case .outputStreamWriteFailed(let error): - return "OutputStream write failed with error: \(error)" - case .inputStreamReadFailed(let error): - return "InputStream read failed with error: \(error)" - } - } -} - -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: - return "Response could not be serialized, input file was nil." - case .inputFileReadFailed(let url): - return "Response could not be serialized, input file could not be read: \(url)." - case .stringSerializationFailed(let encoding): - 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)" - } - } -} - -extension AFError.ResponseValidationFailureReason { - var localizedDescription: String { - switch self { - case .dataFileNil: - return "Response could not be validated, data file was nil." - case .dataFileReadFailed(let url): - return "Response could not be validated, data file could not be read: \(url)." - case .missingContentType(let types): - return ( - "Response Content-Type was missing and acceptable content types " + - "(\(types.joined(separator: ","))) do not match \"*/*\"." - ) - case .unacceptableContentType(let acceptableTypes, let responseType): - return ( - "Response Content-Type \"\(responseType)\" does not match any acceptable types: " + - "\(acceptableTypes.joined(separator: ","))." - ) - case .unacceptableStatusCode(let code): - return "Response status code was unacceptable: \(code)." - } - } -} diff --git a/Example/Pods/Alamofire/Source/Alamofire.swift b/Example/Pods/Alamofire/Source/Alamofire.swift deleted file mode 100644 index 7566587..0000000 --- a/Example/Pods/Alamofire/Source/Alamofire.swift +++ /dev/null @@ -1,456 +0,0 @@ -// -// Alamofire.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 - -/// 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 -} - -extension String: URLConvertible { - /// Returns a URL if `self` represents a valid URL string that conforms to RFC 2396 or throws an `AFError`. - /// - /// - throws: An `AFError.invalidURL` if `self` is not a valid URL string. - /// - /// - 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 - } -} - -extension URL: URLConvertible { - /// Returns self. - public func asURL() throws -> URL { return self } -} - -extension URLComponents: URLConvertible { - /// Returns a URL if `url` is not nil, otherise throws an `Error`. - /// - /// - throws: An `AFError.invalidURL` if `url` is `nil`. - /// - /// - returns: A URL or throws an `AFError`. - 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 construct URL requests. -public protocol URLRequestConvertible { - /// Returns a URL request or throws if an `Error` was encountered. - /// - /// - throws: An `Error` if the underlying `URLRequest` is `nil`. - /// - /// - 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 } -} - -// MARK: - - -extension URLRequest { - /// Creates an instance with the specified `method`, `urlString` and `headers`. - /// - /// - parameter url: The URL. - /// - parameter method: The HTTP method. - /// - parameter headers: The HTTP headers. `nil` by default. - /// - /// - 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) - } - } - } - - func adapt(using adapter: RequestAdapter?) throws -> URLRequest { - guard let adapter = adapter else { return self } - return try adapter.adapt(self) - } -} - -// 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: 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. -/// -/// - 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) -} - -// MARK: 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 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: InputStream - -/// 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 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) -} - -// MARK: MultipartFormData - -/// 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 - ) -} - -/// 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 - ) -} - -#if !os(watchOS) - -// MARK: - Stream Request - -// MARK: Hostname and Port - -/// 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 -public func stream(withHostName hostName: String, port: Int) -> StreamRequest { - return SessionManager.default.stream(withHostName: hostName, port: port) -} - -// MARK: NetService - -/// 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 -public func stream(with netService: NetService) -> StreamRequest { - return SessionManager.default.stream(with: netService) -} - -#endif diff --git a/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift b/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift deleted file mode 100644 index 5019d0d..0000000 --- a/Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// DispatchQueue+Alamofire.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 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) - } - - func syncResult(_ closure: () -> T) -> T { - var result: T! - sync { result = closure() } - return result - } -} diff --git a/Example/Pods/Alamofire/Source/MultipartFormData.swift b/Example/Pods/Alamofire/Source/MultipartFormData.swift deleted file mode 100644 index 1ce4d19..0000000 --- a/Example/Pods/Alamofire/Source/MultipartFormData.swift +++ /dev/null @@ -1,581 +0,0 @@ -// -// MultipartFormData.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 - -#if os(iOS) || os(watchOS) || os(tvOS) -import MobileCoreServices -#elseif os(macOS) -import CoreServices -#endif - -/// Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode -/// multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead -/// to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the -/// data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for -/// larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset. -/// -/// For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well -/// and the w3 form documentation. -/// -/// - https://www.ietf.org/rfc/rfc2388.txt -/// - https://www.ietf.org/rfc/rfc2045.txt -/// - https://www.w3.org/TR/html401/interact/forms.html#h-17.13 -open class MultipartFormData { - - // MARK: - Helper Types - - struct EncodingCharacters { - static let crlf = "\r\n" - } - - struct BoundaryGenerator { - enum BoundaryType { - case initial, encapsulated, final - } - - static func randomBoundary() -> String { - return String(format: "alamofire.boundary.%08x%08x", arc4random(), arc4random()) - } - - static func boundaryData(forBoundaryType boundaryType: BoundaryType, boundary: String) -> Data { - let boundaryText: String - - switch boundaryType { - case .initial: - boundaryText = "--\(boundary)\(EncodingCharacters.crlf)" - case .encapsulated: - boundaryText = "\(EncodingCharacters.crlf)--\(boundary)\(EncodingCharacters.crlf)" - case .final: - boundaryText = "\(EncodingCharacters.crlf)--\(boundary)--\(EncodingCharacters.crlf)" - } - - return boundaryText.data(using: String.Encoding.utf8, allowLossyConversion: false)! - } - } - - class BodyPart { - let headers: HTTPHeaders - let bodyStream: InputStream - let bodyContentLength: UInt64 - var hasInitialBoundary = false - var hasFinalBoundary = false - - init(headers: HTTPHeaders, bodyStream: InputStream, bodyContentLength: UInt64) { - self.headers = headers - self.bodyStream = bodyStream - self.bodyContentLength = bodyContentLength - } - } - - // MARK: - Properties - - /// The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`. - open var contentType: String { return "multipart/form-data; boundary=\(boundary)" } - - /// The content length of all body parts used to generate the `multipart/form-data` not including the boundaries. - 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 let boundary: String - - private var bodyParts: [BodyPart] - private var bodyPartError: AFError? - private let streamBufferSize: Int - - // MARK: - Lifecycle - - /// Creates a multipart form data object. - /// - /// - returns: The multipart form data object. - public init() { - self.boundary = BoundaryGenerator.randomBoundary() - self.bodyParts = [] - - /// - /// The optimal read/write buffer size in bytes for input and output streams is 1024 (1KB). For more - /// information, please refer to the following article: - /// - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Streams/Articles/ReadingInputStreams.html - /// - - self.streamBufferSize = 1024 - } - - // 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: - /// - /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header) - /// - `Content-Type: #{mimeType}` (HTTP Header) - /// - Encoded file 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 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) { - let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType) - let stream = InputStream(data: data) - let length = UInt64(data.count) - - append(stream, withLength: length, headers: headers) - } - - /// Creates a body part from the file 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}; filename=#{generated filename}` (HTTP Header) - /// - `Content-Type: #{generated mimeType}` (HTTP Header) - /// - Encoded file data - /// - Multipart form boundary - /// - /// The filename in the `Content-Disposition` HTTP header is generated from the last path component of the - /// `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the - /// system associated MIME type. - /// - /// - parameter fileURL: The URL of the file whose content will be encoded into the multipart form data. - /// - parameter name: The name to associate with the file content in the `Content-Disposition` HTTP header. - public func append(_ fileURL: URL, withName name: String) { - let fileName = fileURL.lastPathComponent - let pathExtension = fileURL.pathExtension - - if !fileName.isEmpty && !pathExtension.isEmpty { - let mime = mimeType(forPathExtension: pathExtension) - append(fileURL, withName: name, fileName: fileName, mimeType: mime) - } else { - setBodyPartError(withReason: .bodyPartFilenameInvalid(in: fileURL)) - } - } - - /// Creates a body part from the file 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}; filename=#{filename} (HTTP Header) - /// - Content-Type: #{mimeType} (HTTP Header) - /// - Encoded file data - /// - Multipart form boundary - /// - /// - parameter fileURL: The URL of the file whose content will be encoded into the multipart form data. - /// - parameter name: The name to associate with the file content in the `Content-Disposition` HTTP header. - /// - parameter fileName: The filename to associate with the file content in the `Content-Disposition` HTTP header. - /// - parameter mimeType: The MIME type to associate with the file content in the `Content-Type` HTTP header. - public func append(_ fileURL: URL, withName name: String, fileName: String, mimeType: String) { - let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType) - - //============================================================ - // Check 1 - is file URL? - //============================================================ - - guard fileURL.isFileURL else { - setBodyPartError(withReason: .bodyPartURLInvalid(url: fileURL)) - return - } - - //============================================================ - // Check 2 - is file URL reachable? - //============================================================ - - do { - let isReachable = try fileURL.checkPromisedItemIsReachable() - guard isReachable else { - setBodyPartError(withReason: .bodyPartFileNotReachable(at: fileURL)) - return - } - } catch { - setBodyPartError(withReason: .bodyPartFileNotReachableWithError(atURL: fileURL, error: error)) - return - } - - //============================================================ - // Check 3 - is file URL a directory? - //============================================================ - - var isDirectory: ObjCBool = false - let path = fileURL.path - - guard FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue else - { - setBodyPartError(withReason: .bodyPartFileIsDirectory(at: fileURL)) - return - } - - //============================================================ - // Check 4 - can the file size be extracted? - //============================================================ - - let bodyContentLength: UInt64 - - do { - guard let fileSize = try FileManager.default.attributesOfItem(atPath: path)[.size] as? NSNumber else { - setBodyPartError(withReason: .bodyPartFileSizeNotAvailable(at: fileURL)) - return - } - - bodyContentLength = fileSize.uint64Value - } - catch { - setBodyPartError(withReason: .bodyPartFileSizeQueryFailedWithError(forURL: fileURL, error: error)) - return - } - - //============================================================ - // Check 5 - can a stream be created from file URL? - //============================================================ - - guard let stream = InputStream(url: fileURL) else { - setBodyPartError(withReason: .bodyPartInputStreamCreationFailed(for: fileURL)) - return - } - - append(stream, withLength: bodyContentLength, headers: headers) - } - - /// Creates a body part from the stream 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}; filename=#{filename}` (HTTP Header) - /// - `Content-Type: #{mimeType}` (HTTP Header) - /// - Encoded stream data - /// - Multipart form boundary - /// - /// - parameter stream: The input stream to encode in the multipart form data. - /// - parameter length: The content length of the stream. - /// - parameter name: The name to associate with the stream content in the `Content-Disposition` HTTP header. - /// - parameter fileName: The filename to associate with the stream content in the `Content-Disposition` HTTP header. - /// - parameter mimeType: The MIME type to associate with the stream content in the `Content-Type` HTTP header. - public func append( - _ stream: InputStream, - withLength length: UInt64, - name: String, - fileName: String, - mimeType: String) - { - let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType) - append(stream, withLength: length, headers: headers) - } - - /// Creates a body part with the headers, stream and length and appends it to the multipart form data object. - /// - /// The body part data will be encoded using the following format: - /// - /// - HTTP headers - /// - Encoded stream data - /// - Multipart form boundary - /// - /// - parameter stream: The input stream to encode in the multipart form data. - /// - parameter length: The content length of the stream. - /// - parameter headers: The HTTP headers for the body part. - public func append(_ stream: InputStream, withLength length: UInt64, headers: HTTPHeaders) { - let bodyPart = BodyPart(headers: headers, bodyStream: stream, bodyContentLength: length) - bodyParts.append(bodyPart) - } - - // MARK: - Data Encoding - - /// Encodes all the appended body parts into a single `Data` value. - /// - /// 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. - /// - /// - throws: An `AFError` if encoding encounters an error. - /// - /// - returns: The encoded `Data` if encoding is successful. - public func encode() throws -> Data { - if let bodyPartError = bodyPartError { - throw bodyPartError - } - - var encoded = Data() - - bodyParts.first?.hasInitialBoundary = true - bodyParts.last?.hasFinalBoundary = true - - for bodyPart in bodyParts { - let encodedData = try encode(bodyPart) - encoded.append(encodedData) - } - - return encoded - } - - /// Writes the appended body parts into the given file URL. - /// - /// This process is facilitated by reading and writing with input and output streams, respectively. Thus, - /// this approach is very memory efficient and should be used for large body part data. - /// - /// - parameter fileURL: The file URL to write the multipart form data into. - /// - /// - throws: An `AFError` if encoding encounters an error. - public func writeEncodedData(to fileURL: URL) throws { - if let bodyPartError = bodyPartError { - throw bodyPartError - } - - if FileManager.default.fileExists(atPath: fileURL.path) { - throw AFError.multipartEncodingFailed(reason: .outputStreamFileAlreadyExists(at: fileURL)) - } else if !fileURL.isFileURL { - throw AFError.multipartEncodingFailed(reason: .outputStreamURLInvalid(url: fileURL)) - } - - guard let outputStream = OutputStream(url: fileURL, append: false) else { - throw AFError.multipartEncodingFailed(reason: .outputStreamCreationFailed(for: fileURL)) - } - - outputStream.open() - defer { outputStream.close() } - - self.bodyParts.first?.hasInitialBoundary = true - self.bodyParts.last?.hasFinalBoundary = true - - for bodyPart in self.bodyParts { - try write(bodyPart, to: outputStream) - } - } - - // MARK: - Private - Body Part Encoding - - private func encode(_ bodyPart: BodyPart) throws -> Data { - var encoded = Data() - - let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData() - encoded.append(initialData) - - let headerData = encodeHeaders(for: bodyPart) - encoded.append(headerData) - - let bodyStreamData = try encodeBodyStream(for: bodyPart) - encoded.append(bodyStreamData) - - if bodyPart.hasFinalBoundary { - encoded.append(finalBoundaryData()) - } - - return encoded - } - - private func encodeHeaders(for bodyPart: BodyPart) -> Data { - var headerText = "" - - for (key, value) in bodyPart.headers { - headerText += "\(key): \(value)\(EncodingCharacters.crlf)" - } - headerText += EncodingCharacters.crlf - - return headerText.data(using: String.Encoding.utf8, allowLossyConversion: false)! - } - - private func encodeBodyStream(for bodyPart: BodyPart) throws -> Data { - let inputStream = bodyPart.bodyStream - inputStream.open() - defer { inputStream.close() } - - var encoded = Data() - - while inputStream.hasBytesAvailable { - var buffer = [UInt8](repeating: 0, count: streamBufferSize) - let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize) - - if let error = inputStream.streamError { - throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: error)) - } - - if bytesRead > 0 { - encoded.append(buffer, count: bytesRead) - } else { - break - } - } - - return encoded - } - - // MARK: - Private - Writing Body Part to Output Stream - - private func write(_ bodyPart: BodyPart, to outputStream: OutputStream) throws { - try writeInitialBoundaryData(for: bodyPart, to: outputStream) - try writeHeaderData(for: bodyPart, to: outputStream) - try writeBodyStream(for: bodyPart, to: outputStream) - try writeFinalBoundaryData(for: bodyPart, to: outputStream) - } - - private func writeInitialBoundaryData(for bodyPart: BodyPart, to outputStream: OutputStream) throws { - let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData() - return try write(initialData, to: outputStream) - } - - private func writeHeaderData(for bodyPart: BodyPart, to outputStream: OutputStream) throws { - let headerData = encodeHeaders(for: bodyPart) - return try write(headerData, to: outputStream) - } - - private func writeBodyStream(for bodyPart: BodyPart, to outputStream: OutputStream) throws { - let inputStream = bodyPart.bodyStream - - inputStream.open() - defer { inputStream.close() } - - while inputStream.hasBytesAvailable { - var buffer = [UInt8](repeating: 0, count: streamBufferSize) - let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize) - - if let streamError = inputStream.streamError { - throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: streamError)) - } - - if bytesRead > 0 { - if buffer.count != bytesRead { - buffer = Array(buffer[0.. 0, outputStream.hasSpaceAvailable { - let bytesWritten = outputStream.write(buffer, maxLength: bytesToWrite) - - if let error = outputStream.streamError { - throw AFError.multipartEncodingFailed(reason: .outputStreamWriteFailed(error: error)) - } - - bytesToWrite -= bytesWritten - - if bytesToWrite > 0 { - buffer = Array(buffer[bytesWritten.. String { - if - let id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as CFString, nil)?.takeRetainedValue(), - let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue() - { - return contentType as String - } - - return "application/octet-stream" - } - - // MARK: - Private - Content Headers - - private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> [String: String] { - 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 } - - return headers - } - - // MARK: - Private - Boundary Encoding - - private func initialBoundaryData() -> Data { - return BoundaryGenerator.boundaryData(forBoundaryType: .initial, boundary: boundary) - } - - private func encapsulatedBoundaryData() -> Data { - return BoundaryGenerator.boundaryData(forBoundaryType: .encapsulated, boundary: boundary) - } - - private func finalBoundaryData() -> Data { - return BoundaryGenerator.boundaryData(forBoundaryType: .final, boundary: boundary) - } - - // MARK: - Private - Errors - - private func setBodyPartError(withReason reason: AFError.MultipartEncodingFailureReason) { - guard bodyPartError == nil else { return } - bodyPartError = AFError.multipartEncodingFailed(reason: reason) - } -} diff --git a/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift b/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift deleted file mode 100644 index c06a60e..0000000 --- a/Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift +++ /dev/null @@ -1,240 +0,0 @@ -// -// NetworkReachabilityManager.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. -// - -#if !os(watchOS) - -import Foundation -import SystemConfiguration - -/// The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both WWAN and -/// WiFi network interfaces. -/// -/// Reachability can be used to determine background information about why a network operation failed, or to retry -/// network requests when a connection is established. It should not be used to prevent a user from initiating a network -/// request, as it's possible that an initial request may be required to establish reachability. -open class NetworkReachabilityManager { - /** - Defines the various states of network reachability. - - - Unknown: It is unknown whether the network is reachable. - - NotReachable: The network is not reachable. - - ReachableOnWWAN: The network is reachable over the WWAN connection. - - ReachableOnWiFi: The network is reachable over the WiFi connection. - */ - - - /// Defines the various states of network reachability. - /// - /// - unknown: It is unknown whether the network is reachable. - /// - notReachable: The network is not reachable. - /// - reachable: The network is reachable. - public enum NetworkReachabilityStatus { - case unknown - case notReachable - case reachable(ConnectionType) - } - - /// Defines the various connection types detected by reachability flags. - /// - /// - ethernetOrWiFi: The connection type is either over Ethernet or WiFi. - /// - wwan: The connection type is a WWAN connection. - public enum ConnectionType { - case ethernetOrWiFi - case wwan - } - - /// A closure executed when the network reachability status changes. The closure takes a single argument: the - /// network reachability status. - public typealias Listener = (NetworkReachabilityStatus) -> Void - - // MARK: - Properties - - /// Whether the network is currently reachable. - open var isReachable: Bool { return isReachableOnWWAN || isReachableOnEthernetOrWiFi } - - /// Whether the network is currently reachable over the WWAN interface. - open var isReachableOnWWAN: Bool { return networkReachabilityStatus == .reachable(.wwan) } - - /// Whether the network is currently reachable over Ethernet or WiFi interface. - open var isReachableOnEthernetOrWiFi: Bool { return networkReachabilityStatus == .reachable(.ethernetOrWiFi) } - - /// The current network reachability status. - open var networkReachabilityStatus: NetworkReachabilityStatus { - guard let flags = self.flags else { return .unknown } - return networkReachabilityStatusForFlags(flags) - } - - /// The dispatch queue to execute the `listener` closure on. - open var listenerQueue: DispatchQueue = DispatchQueue.main - - /// A closure executed when the network reachability status changes. - open var listener: Listener? - - private var flags: SCNetworkReachabilityFlags? { - var flags = SCNetworkReachabilityFlags() - - if SCNetworkReachabilityGetFlags(reachability, &flags) { - return flags - } - - return nil - } - - private let reachability: SCNetworkReachability - private var previousFlags: SCNetworkReachabilityFlags - - // MARK: - Initialization - - /// Creates a `NetworkReachabilityManager` instance with the specified host. - /// - /// - parameter host: The host used to evaluate network reachability. - /// - /// - returns: The new `NetworkReachabilityManager` instance. - public convenience init?(host: String) { - guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil } - self.init(reachability: reachability) - } - - /// Creates a `NetworkReachabilityManager` instance that monitors the address 0.0.0.0. - /// - /// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing - /// status of the device, both IPv4 and IPv6. - /// - /// - returns: The new `NetworkReachabilityManager` instance. - public convenience init?() { - var address = sockaddr_in() - address.sin_len = UInt8(MemoryLayout.size) - address.sin_family = sa_family_t(AF_INET) - - guard let reachability = withUnsafePointer(to: &address, { pointer in - return pointer.withMemoryRebound(to: sockaddr.self, capacity: MemoryLayout.size) { - return SCNetworkReachabilityCreateWithAddress(nil, $0) - } - }) else { return nil } - - self.init(reachability: reachability) - } - - private init(reachability: SCNetworkReachability) { - self.reachability = reachability - self.previousFlags = SCNetworkReachabilityFlags() - } - - deinit { - stopListening() - } - - // MARK: - Listening - - /// Starts listening for changes in network reachability status. - /// - /// - returns: `true` if listening was started successfully, `false` otherwise. - @discardableResult - open func startListening() -> Bool { - var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil) - context.info = Unmanaged.passUnretained(self).toOpaque() - - let callbackEnabled = SCNetworkReachabilitySetCallback( - reachability, - { (_, flags, info) in - let reachability = Unmanaged.fromOpaque(info!).takeUnretainedValue() - reachability.notifyListener(flags) - }, - &context - ) - - let queueEnabled = SCNetworkReachabilitySetDispatchQueue(reachability, listenerQueue) - - listenerQueue.async { - self.previousFlags = SCNetworkReachabilityFlags() - self.notifyListener(self.flags ?? SCNetworkReachabilityFlags()) - } - - return callbackEnabled && queueEnabled - } - - /// Stops listening for changes in network reachability status. - open func stopListening() { - SCNetworkReachabilitySetCallback(reachability, nil, nil) - SCNetworkReachabilitySetDispatchQueue(reachability, nil) - } - - // MARK: - Internal - Listener Notification - - func notifyListener(_ flags: SCNetworkReachabilityFlags) { - guard previousFlags != flags else { return } - previousFlags = flags - - listener?(networkReachabilityStatusForFlags(flags)) - } - - // MARK: - Internal - Network Reachability Status - - func networkReachabilityStatusForFlags(_ flags: SCNetworkReachabilityFlags) -> NetworkReachabilityStatus { - guard flags.contains(.reachable) else { return .notReachable } - - var networkStatus: NetworkReachabilityStatus = .notReachable - - if !flags.contains(.connectionRequired) { networkStatus = .reachable(.ethernetOrWiFi) } - - if flags.contains(.connectionOnDemand) || flags.contains(.connectionOnTraffic) { - if !flags.contains(.interventionRequired) { networkStatus = .reachable(.ethernetOrWiFi) } - } - - #if os(iOS) - if flags.contains(.isWWAN) { networkStatus = .reachable(.wwan) } - #endif - - return networkStatus - } -} - -// MARK: - - -extension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {} - -/// Returns whether the two network reachability status values are equal. -/// -/// - parameter lhs: The left-hand side value to compare. -/// - parameter rhs: The right-hand side value to compare. -/// -/// - returns: `true` if the two values are equal, `false` otherwise. -public func ==( - lhs: NetworkReachabilityManager.NetworkReachabilityStatus, - rhs: NetworkReachabilityManager.NetworkReachabilityStatus) - -> Bool -{ - switch (lhs, rhs) { - case (.unknown, .unknown): - return true - case (.notReachable, .notReachable): - return true - case let (.reachable(lhsConnectionType), .reachable(rhsConnectionType)): - return lhsConnectionType == rhsConnectionType - default: - return false - } -} - -#endif diff --git a/Example/Pods/Alamofire/Source/Notifications.swift b/Example/Pods/Alamofire/Source/Notifications.swift deleted file mode 100644 index 81f6e37..0000000 --- a/Example/Pods/Alamofire/Source/Notifications.swift +++ /dev/null @@ -1,52 +0,0 @@ -// -// Notifications.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 - -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") - - /// 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 cancelled. The notification `object` contains the cancelled `URLSessionTask`. - public static let DidCancel = Notification.Name(rawValue: "org.alamofire.notification.name.task.didCancel") - - /// 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") - } -} - -// MARK: - - -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" - } -} diff --git a/Example/Pods/Alamofire/Source/ParameterEncoding.swift b/Example/Pods/Alamofire/Source/ParameterEncoding.swift deleted file mode 100644 index 42b5b2d..0000000 --- a/Example/Pods/Alamofire/Source/ParameterEncoding.swift +++ /dev/null @@ -1,373 +0,0 @@ -// -// ParameterEncoding.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 - -/// 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] - -/// A type used to define how a set of parameters are applied to a `URLRequest`. -public protocol ParameterEncoding { - /// 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 `AFError.parameterEncodingFailed` error if encoding fails. - /// - /// - returns: The encoded request. - func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest -} - -// MARK: - - -/// Creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP -/// body of the URL request. Whether the query string is set or appended to any existing URL query string or set as -/// the HTTP body depends on the destination of the encoding. -/// -/// The `Content-Type` HTTP header field of an encoded request with HTTP body is set to -/// `application/x-www-form-urlencoded; charset=utf-8`. Since there is no published specification for how to encode -/// collection types, 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`). -public struct URLEncoding: ParameterEncoding { - - // MARK: Helper Types - - /// Defines whether the url-encoded query string is applied to the existing query string or HTTP body of the - /// resulting URL request. - /// - /// - methodDependent: Applies encoded query string result to existing query string for `GET`, `HEAD` and `DELETE` - /// requests and sets as the HTTP body for requests with any other HTTP method. - /// - queryString: Sets or appends encoded query string result to existing query string. - /// - httpBody: Sets encoded query string result as the HTTP body of the URL request. - public enum Destination { - case methodDependent, queryString, httpBody - } - - // MARK: Properties - - /// Returns a default `URLEncoding` instance. - 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) } - - /// Returns a `URLEncoding` instance with an `.httpBody` destination. - public static var httpBody: URLEncoding { return URLEncoding(destination: .httpBody) } - - /// The destination defining where the encoded query string is to be applied to the URL request. - public let destination: Destination - - // MARK: Initialization - - /// Creates a `URLEncoding` instance using the specified destination. - /// - /// - parameter destination: The destination defining where the encoded query string is to be applied. - /// - /// - returns: The new `URLEncoding` instance. - public init(destination: Destination = .methodDependent) { - self.destination = destination - } - - // 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 } - - if let method = HTTPMethod(rawValue: urlRequest.httpMethod ?? "GET"), encodesParametersInURL(with: method) { - guard let url = urlRequest.url else { - throw AFError.parameterEncodingFailed(reason: .missingURL) - } - - if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty { - let percentEncodedQuery = (urlComponents.percentEncodedQuery.map { $0 + "&" } ?? "") + query(parameters) - urlComponents.percentEncodedQuery = percentEncodedQuery - urlRequest.url = urlComponents.url - } - } else { - if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { - urlRequest.setValue("application/x-www-form-urlencoded; charset=utf-8", forHTTPHeaderField: "Content-Type") - } - - urlRequest.httpBody = query(parameters).data(using: .utf8, allowLossyConversion: false) - } - - return urlRequest - } - - /// Creates percent-escaped, URL encoded query string components from the given key-value pair using recursion. - /// - /// - parameter key: The key of the query component. - /// - parameter value: The value of the query component. - /// - /// - returns: The percent-escaped, URL encoded query string components. - public func queryComponents(fromKey key: String, value: Any) -> [(String, String)] { - var components: [(String, String)] = [] - - if let dictionary = value as? [String: Any] { - for (nestedKey, value) in dictionary { - components += queryComponents(fromKey: "\(key)[\(nestedKey)]", value: value) - } - } else if let array = value as? [Any] { - for value in array { - components += queryComponents(fromKey: "\(key)[]", value: value) - } - } else if let value = value as? NSNumber { - if value.isBool { - components.append((escape(key), escape((value.boolValue ? "1" : "0")))) - } else { - components.append((escape(key), escape("\(value)"))) - } - } else if let bool = value as? Bool { - components.append((escape(key), escape((bool ? "1" : "0")))) - } else { - components.append((escape(key), escape("\(value)"))) - } - - return components - } - - /// 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)") - - return string.addingPercentEncoding(withAllowedCharacters: allowedCharacterSet) ?? string - } - - private func query(_ parameters: [String: Any]) -> String { - var components: [(String, String)] = [] - - for key in parameters.keys.sorted(by: <) { - let value = parameters[key]! - components += queryComponents(fromKey: key, value: value) - } - - 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: - - -/// Uses `JSONSerialization` to create a JSON representation of the parameters object, which is set as the body of the -/// request. The `Content-Type` HTTP header field of an encoded request is set to `application/json`. -public struct JSONEncoding: ParameterEncoding { - - // MARK: Properties - - /// Returns a `JSONEncoding` instance with default writing options. - public static var `default`: JSONEncoding { return JSONEncoding() } - - /// Returns a `JSONEncoding` instance with `.prettyPrinted` writing options. - public static var prettyPrinted: JSONEncoding { return JSONEncoding(options: .prettyPrinted) } - - /// The options for writing the parameters as JSON data. - public let options: JSONSerialization.WritingOptions - - // MARK: Initialization - - /// Creates a `JSONEncoding` instance using the specified options. - /// - /// - parameter options: The options for writing the parameters as JSON data. - /// - /// - returns: The new `JSONEncoding` instance. - public init(options: JSONSerialization.WritingOptions = []) { - 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 JSONSerialization.data(withJSONObject: parameters, options: options) - - if urlRequest.value(forHTTPHeaderField: "Content-Type") == nil { - urlRequest.setValue("application/json", forHTTPHeaderField: "Content-Type") - } - - urlRequest.httpBody = data - } catch { - throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error)) - } - - return urlRequest - } -} - -// 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/Request.swift b/Example/Pods/Alamofire/Source/Request.swift deleted file mode 100644 index 85eb869..0000000 --- a/Example/Pods/Alamofire/Source/Request.swift +++ /dev/null @@ -1,600 +0,0 @@ -// -// Request.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 - -/// 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. - /// - /// - parameter urlRequest: The URL request to adapt. - /// - /// - throws: An `Error` if the adaptation encounters an error. - /// - /// - returns: The adapted `URLRequest`. - func adapt(_ urlRequest: URLRequest) throws -> URLRequest -} - -// MARK: - - -/// A closure executed when the `RequestRetrier` determines whether a `Request` should be retried or not. -public typealias RequestRetryCompletion = (_ shouldRetry: Bool, _ timeDelay: TimeInterval) -> Void - -/// 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 asychronous. 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 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) -} - -// MARK: - - -protocol TaskConvertible { - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask -} - -/// A dictionary of headers to apply to a `URLRequest`. -public typealias HTTPHeaders = [String: String] - -// MARK: - - -/// 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 { - - // MARK: Helper Types - - /// A closure executed when monitoring upload or download progress of a request. - public typealias ProgressHandler = (Progress) -> Void - - enum RequestTask { - case data(TaskConvertible?, URLSessionTask?) - case download(TaskConvertible?, URLSessionTask?) - case upload(TaskConvertible?, URLSessionTask?) - case stream(TaskConvertible?, URLSessionTask?) - } - - // MARK: Properties - - /// The delegate for the underlying task. - open internal(set) var delegate: TaskDelegate { - get { - taskDelegateLock.lock() ; defer { taskDelegateLock.unlock() } - return taskDelegate - } - set { - taskDelegateLock.lock() ; defer { taskDelegateLock.unlock() } - taskDelegate = newValue - } - } - - /// The underlying task. - open var task: URLSessionTask? { return delegate.task } - - /// The session belonging to the underlying task. - open let session: URLSession - - /// The request sent or to be sent to the server. - open var request: URLRequest? { return task?.originalRequest } - - /// The response received from the server, if any. - open var response: HTTPURLResponse? { return task?.response as? HTTPURLResponse } - - let originalTask: TaskConvertible? - - var startTime: CFAbsoluteTime? - var endTime: CFAbsoluteTime? - - var validations: [() -> Void] = [] - - private var taskDelegate: TaskDelegate - private var taskDelegateLock = NSLock() - - // MARK: Lifecycle - - init(session: URLSession, requestTask: RequestTask, error: Error? = nil) { - self.session = session - - 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 - } - - delegate.error = error - delegate.queue.addOperation { self.endTime = CFAbsoluteTimeGetCurrent() } - } - - // MARK: Authentication - - /// Associates an HTTP Basic credential with the request. - /// - /// - parameter user: The user. - /// - parameter password: The password. - /// - parameter persistence: The URL credential persistence. `.ForSession` by default. - /// - /// - 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) - } - - /// Associates a specified credential with the request. - /// - /// - parameter credential: The credential. - /// - /// - returns: The request. - @discardableResult - open func authenticate(usingCredential credential: URLCredential) -> Self { - delegate.credential = credential - return self - } - - /// Returns a base64 encoded basic authentication credential as an authorization header tuple. - /// - /// - parameter user: The user. - /// - parameter password: The password. - /// - /// - returns: A tuple with Authorization header and credential value if encoding succeeds, `nil` otherwise. - open static func authorizationHeader(user: String, password: String) -> (key: String, value: String)? { - guard let data = "\(user):\(password)".data(using: .utf8) else { return nil } - - let credential = data.base64EncodedString(options: []) - - return (key: "Authorization", value: "Basic \(credential)") - } - - // MARK: State - - /// Resumes the request. - open func resume() { - guard let task = task else { delegate.queue.isSuspended = false ; return } - - if startTime == nil { startTime = CFAbsoluteTimeGetCurrent() } - - task.resume() - - NotificationCenter.default.post( - name: Notification.Name.Task.DidResume, - object: self, - userInfo: [Notification.Key.Task: task] - ) - } - - /// Suspends the request. - open func suspend() { - guard let task = task else { return } - - task.suspend() - - NotificationCenter.default.post( - name: Notification.Name.Task.DidSuspend, - object: self, - userInfo: [Notification.Key.Task: task] - ) - } - - /// Cancels the request. - open func cancel() { - guard let task = task else { return } - - task.cancel() - - NotificationCenter.default.post( - name: Notification.Name.Task.DidCancel, - object: self, - userInfo: [Notification.Key.Task: task] - ) - } -} - -// MARK: - CustomStringConvertible - -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] = [] - - if let HTTPMethod = request?.httpMethod { - components.append(HTTPMethod) - } - - if let urlString = request?.url?.absoluteString { - components.append(urlString) - } - - if let response = response { - components.append("(\(response.statusCode))") - } - - return components.joined(separator: " ") - } -} - -// 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 { - return cURLRepresentation() - } - - func cURLRepresentation() -> String { - var components = ["$ curl -i"] - - guard let request = self.request, - let url = request.url, - let host = url.host - else { - return "$ curl command could not be created" - } - - if let httpMethod = request.httpMethod, httpMethod != "GET" { - components.append("-X \(httpMethod)") - } - - if let credentialStorage = self.session.configuration.urlCredentialStorage { - let protectionSpace = URLProtectionSpace( - host: host, - port: url.port ?? 0, - protocol: url.scheme, - realm: host, - authenticationMethod: NSURLAuthenticationMethodHTTPBasic - ) - - if let credentials = credentialStorage.credentials(for: protectionSpace)?.values { - for credential in credentials { - components.append("-u \(credential.user!):\(credential.password!)") - } - } else { - if let credential = delegate.credential { - components.append("-u \(credential.user!):\(credential.password!)") - } - } - } - - if session.configuration.httpShouldSetCookies { - if - let cookieStorage = session.configuration.httpCookieStorage, - let cookies = cookieStorage.cookies(for: url), !cookies.isEmpty - { - let string = cookies.reduce("") { $0 + "\($1.name)=\($1.value);" } - components.append("-b \"\(string.substring(to: string.characters.index(before: string.endIndex)))\"") - } - } - - var headers: [AnyHashable: Any] = [:] - - if let additionalHeaders = session.configuration.httpAdditionalHeaders { - for (field, value) in additionalHeaders where field != AnyHashable("Cookie") { - headers[field] = value - } - } - - if let headerFields = request.allHTTPHeaderFields { - for (field, value) in headerFields where field != "Cookie" { - headers[field] = value - } - } - - for (field, value) in headers { - components.append("-H \"\(field): \(value)\"") - } - - if let httpBodyData = request.httpBody, let httpBody = String(data: httpBodyData, encoding: .utf8) { - var escapedBody = httpBody.replacingOccurrences(of: "\\\"", with: "\\\\\"") - escapedBody = escapedBody.replacingOccurrences(of: "\"", with: "\\\"") - - components.append("-d \"\(escapedBody)\"") - } - - components.append("\"\(url.absoluteString)\"") - - return components.joined(separator: " \\\n\t") - } -} - -// MARK: - - -/// Specific type of `Request` that manages an underlying `URLSessionDataTask`. -open class DataRequest: Request { - - // MARK: Helper Types - - struct Requestable: TaskConvertible { - let urlRequest: URLRequest - - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { - let urlRequest = try self.urlRequest.adapt(using: adapter) - return queue.syncResult { session.dataTask(with: urlRequest) } - } - } - - // MARK: Properties - - /// The progress of fetching the response data from the server for the request. - open var progress: Progress { return dataDelegate.progress } - - var dataDelegate: DataTaskDelegate { return delegate as! DataTaskDelegate } - - // MARK: Stream - - /// Sets a closure to be called periodically during the lifecycle of the request as data is read from the server. - /// - /// 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`. - /// - /// - parameter closure: The code to be executed periodically during the lifecycle of the request. - /// - /// - returns: The request. - @discardableResult - open func stream(closure: ((Data) -> Void)? = nil) -> Self { - dataDelegate.dataStream = closure - return self - } - - // MARK: Progress - - /// 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 - } -} - -// MARK: - - -/// Specific type of `Request` that manages an underlying `URLSessionDownloadTask`. -open class DownloadRequest: Request { - - // MARK: Helper Types - - /// 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 - - /// A `DownloadOptions` flag that creates intermediate directories for the destination URL if specified. - public static let createIntermediateDirectories = DownloadOptions(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) - - /// Creates a `DownloadFileDestinationOptions` 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) { - self.rawValue = rawValue - } - } - - /// A closure executed once a download request has successfully completed in order to determine where to move the - /// 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) - - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { - let task: URLSessionTask - - switch self { - case let .request(urlRequest): - let urlRequest = try urlRequest.adapt(using: adapter) - task = queue.syncResult { session.downloadTask(with: urlRequest) } - case let .resumeData(resumeData): - task = queue.syncResult { session.downloadTask(withResumeData: resumeData) } - } - - return task - } - } - - // MARK: Properties - - /// The resume data of the underlying download task if available after a failure. - open var resumeData: Data? { return downloadDelegate.resumeData } - - /// The progress of downloading the response data from the server for the request. - open var progress: Progress { return downloadDelegate.progress } - - var downloadDelegate: DownloadTaskDelegate { return delegate as! DownloadTaskDelegate } - - // MARK: State - - /// Cancels the request. - open override func cancel() { - downloadDelegate.downloadTask.cancel { self.downloadDelegate.resumeData = $0 } - - NotificationCenter.default.post( - name: Notification.Name.Task.DidCancel, - object: self, - userInfo: [Notification.Key.Task: task] - ) - } - - // MARK: Progress - - /// 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) - 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. - /// - /// - 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. - 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) - - if !directoryURLs.isEmpty { - return (directoryURLs[0].appendingPathComponent(response.suggestedFilename!), []) - } - - return (temporaryURL, []) - } - } -} - -// MARK: - - -/// Specific type of `Request` that manages an underlying `URLSessionUploadTask`. -open class UploadRequest: DataRequest { - - // MARK: Helper Types - - enum Uploadable: TaskConvertible { - case data(Data, URLRequest) - case file(URL, URLRequest) - case stream(InputStream, URLRequest) - - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { - let task: URLSessionTask - - switch self { - case let .data(data, urlRequest): - let urlRequest = try urlRequest.adapt(using: adapter) - task = queue.syncResult { session.uploadTask(with: urlRequest, from: data) } - case let .file(url, urlRequest): - let urlRequest = try urlRequest.adapt(using: adapter) - task = queue.syncResult { session.uploadTask(with: urlRequest, fromFile: url) } - case let .stream(_, urlRequest): - let urlRequest = try urlRequest.adapt(using: adapter) - task = queue.syncResult { session.uploadTask(withStreamedRequest: urlRequest) } - } - - return task - } - } - - // MARK: Properties - - /// The progress of uploading the payload to the server for the upload request. - open var uploadProgress: Progress { return uploadDelegate.uploadProgress } - - var uploadDelegate: UploadTaskDelegate { return delegate as! UploadTaskDelegate } - - // MARK: Upload Progress - - /// 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 - } -} - -// MARK: - - -#if !os(watchOS) - -/// Specific type of `Request` that manages an underlying `URLSessionStreamTask`. -open class StreamRequest: Request { - enum Streamable: TaskConvertible { - case stream(hostName: String, port: Int) - case netService(NetService) - - func task(session: URLSession, adapter: RequestAdapter?, queue: DispatchQueue) throws -> URLSessionTask { - let task: URLSessionTask - - switch self { - case let .stream(hostName, port): - task = queue.syncResult { session.streamTask(withHostName: hostName, port: port) } - case let .netService(netService): - task = queue.syncResult { session.streamTask(with: netService) } - } - - return task - } - } -} - -#endif diff --git a/Example/Pods/Alamofire/Source/Response.swift b/Example/Pods/Alamofire/Source/Response.swift deleted file mode 100644 index f80779c..0000000 --- a/Example/Pods/Alamofire/Source/Response.swift +++ /dev/null @@ -1,296 +0,0 @@ -// -// Response.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 - -/// 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? - - var _metrics: AnyObject? - - init(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) { - self.request = request - self.response = response - self.data = data - self.error = error - } -} - -// 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. - 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 result of response serialization. - public let result: Result - - /// The timeline of the complete lifecycle of the `Request`. - public let timeline: Timeline - - var _metrics: AnyObject? - - /// Creates a `DataResponse` 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 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()) - { - self.request = request - self.response = response - self.data = data - self.result = result - self.timeline = timeline - } -} - -// MARK: - - -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 - } - - /// 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. - public var debugDescription: String { - var output: [String] = [] - - output.append(request != nil ? "[Request]: \(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") - } -} - -// 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? - - var _metrics: AnyObject? - - init( - request: URLRequest?, - response: HTTPURLResponse?, - temporaryURL: URL?, - destinationURL: URL?, - resumeData: Data?, - error: Error?) - { - self.request = request - self.response = response - self.temporaryURL = temporaryURL - self.destinationURL = destinationURL - self.resumeData = resumeData - self.error = error - } -} - -// MARK: - - -/// Used to store all data associated with a serialized response of a download request. -public struct DownloadResponse { - /// 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 result of response serialization. - public let result: Result - - /// The timeline of the complete lifecycle of the request. - public let timeline: Timeline - - 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. - public init( - request: URLRequest?, - response: HTTPURLResponse?, - temporaryURL: URL?, - destinationURL: URL?, - resumeData: Data?, - result: Result, - timeline: Timeline = Timeline()) - { - self.request = request - self.response = response - self.temporaryURL = temporaryURL - self.destinationURL = destinationURL - self.resumeData = resumeData - self.result = result - self.timeline = timeline - } -} - -// MARK: - - -extension DownloadResponse: 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 - } - - /// 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. - public var debugDescription: String { - var output: [String] = [] - - output.append(request != nil ? "[Request]: \(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") - } -} - -// 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 deleted file mode 100644 index 0bbb373..0000000 --- a/Example/Pods/Alamofire/Source/ResponseSerialization.swift +++ /dev/null @@ -1,716 +0,0 @@ -// -// ResponseSerialization.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 - -/// The type in which all data response serializers must conform to in order to serialize a response. -public protocol DataResponseSerializerProtocol { - /// The type of serialized object to be created by this `DataResponseSerializerType`. - 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 - } -} - -// MARK: - - -/// The type in which all download response serializers must conform to 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 } -} - -// MARK: - - -/// 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 - - /// 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 - - /// 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 - } -} - -// MARK: - Default - -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. - @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 - ) - - dataResponse.add(self.delegate.metrics) - - completionHandler(dataResponse) - } - } - - return self - } - - /// 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. - @discardableResult - public func response( - queue: DispatchQueue? = nil, - responseSerializer: T, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - { - delegate.queue.addOperation { - let result = responseSerializer.serializeResponse( - self.request, - self.response, - self.delegate.data, - self.delegate.error - ) - - let requestCompletedTime = self.endTime ?? CFAbsoluteTimeGetCurrent() - let initialResponseTime = self.delegate.initialResponseTime ?? requestCompletedTime - - let timeline = Timeline( - requestStartTime: self.startTime ?? CFAbsoluteTimeGetCurrent(), - initialResponseTime: initialResponseTime, - requestCompletedTime: requestCompletedTime, - serializationCompletedTime: CFAbsoluteTimeGetCurrent() - ) - - var dataResponse = DataResponse( - request: self.request, - response: self.response, - data: self.delegate.data, - result: result, - timeline: timeline - ) - - dataResponse.add(self.delegate.metrics) - - (queue ?? DispatchQueue.main).async { completionHandler(dataResponse) } - } - - return self - } -} - -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. - @discardableResult - public func response( - queue: DispatchQueue? = nil, - completionHandler: @escaping (DefaultDownloadResponse) -> 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 - ) - - downloadResponse.add(self.delegate.metrics) - - completionHandler(downloadResponse) - } - } - - return self - } - - /// 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. - @discardableResult - public func response( - queue: DispatchQueue? = nil, - responseSerializer: T, - completionHandler: @escaping (DownloadResponse) -> Void) - -> Self - { - delegate.queue.addOperation { - let result = responseSerializer.serializeResponse( - self.request, - self.response, - self.downloadDelegate.fileURL, - self.downloadDelegate.error - ) - - let requestCompletedTime = self.endTime ?? CFAbsoluteTimeGetCurrent() - let initialResponseTime = self.delegate.initialResponseTime ?? requestCompletedTime - - let timeline = Timeline( - requestStartTime: self.startTime ?? CFAbsoluteTimeGetCurrent(), - initialResponseTime: initialResponseTime, - requestCompletedTime: requestCompletedTime, - serializationCompletedTime: CFAbsoluteTimeGetCurrent() - ) - - var downloadResponse = DownloadResponse( - request: self.request, - response: self.response, - temporaryURL: self.downloadDelegate.temporaryURL, - destinationURL: self.downloadDelegate.destinationURL, - resumeData: self.downloadDelegate.resumeData, - result: result, - timeline: timeline - ) - - downloadResponse.add(self.delegate.metrics) - - (queue ?? DispatchQueue.main).async { completionHandler(downloadResponse) } - } - - return self - } -} - -// MARK: - Data - -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!) } - - if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(Data()) } - - guard let validData = data else { - return .failure(AFError.responseSerializationFailed(reason: .inputDataNil)) - } - - return .success(validData) - } -} - -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) - } - } - - /// 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. - @discardableResult - public func responseData( - queue: DispatchQueue? = nil, - completionHandler: @escaping (DataResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DataRequest.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!) } - - guard let fileURL = fileURL else { - return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) - } - - 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))) - } - } - } - - /// 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. - @discardableResult - public func responseData( - queue: DispatchQueue? = nil, - completionHandler: @escaping (DownloadResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DownloadRequest.dataResponseSerializer(), - completionHandler: completionHandler - ) - } -} - -// 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!) } - - if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success("") } - - guard let validData = data else { - return .failure(AFError.responseSerializationFailed(reason: .inputDataNil)) - } - - var convertedEncoding = encoding - - if let encodingName = response?.textEncodingName as CFString!, convertedEncoding == nil { - convertedEncoding = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding( - CFStringConvertIANACharSetNameToEncoding(encodingName)) - ) - } - - let actualEncoding = convertedEncoding ?? String.Encoding.isoLatin1 - - if let string = String(data: validData, encoding: actualEncoding) { - return .success(string) - } else { - return .failure(AFError.responseSerializationFailed(reason: .stringSerializationFailed(encoding: actualEncoding))) - } - } -} - -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. - @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 - ) - } -} - -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. - @discardableResult - public func responseString( - queue: DispatchQueue? = nil, - encoding: String.Encoding? = nil, - completionHandler: @escaping (DownloadResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DownloadRequest.stringResponseSerializer(encoding: encoding), - completionHandler: completionHandler - ) - } -} - -// 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!) } - - if let response = response, emptyDataStatusCodes.contains(response.statusCode) { return .success(NSNull()) } - - guard let validData = data, validData.count > 0 else { - return .failure(AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)) - } - - do { - let json = try JSONSerialization.jsonObject(with: validData, options: options) - return .success(json) - } catch { - return .failure(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. - @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 - ) - } -} - -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. - @discardableResult - public func responseJSON( - queue: DispatchQueue? = nil, - options: JSONSerialization.ReadingOptions = .allowFragments, - completionHandler: @escaping (DownloadResponse) -> Void) - -> Self - { - return response( - queue: queue, - responseSerializer: DownloadRequest.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()) } - - guard let validData = data, validData.count > 0 else { - return .failure(AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)) - } - - 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 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) - } - } - - /// 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. - @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 - ) - } -} - -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!) } - - guard let fileURL = fileURL else { - return .failure(AFError.responseSerializationFailed(reason: .inputFileNil)) - } - - 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))) - } - } - } - - /// 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. - @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 - ) - } -} - -/// 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 2293308..0000000 --- a/Example/Pods/Alamofire/Source/Result.swift +++ /dev/null @@ -1,102 +0,0 @@ -// -// Result.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 - -/// 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)" - } - } -} diff --git a/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift b/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift deleted file mode 100644 index 4d5030f..0000000 --- a/Example/Pods/Alamofire/Source/ServerTrustPolicy.swift +++ /dev/null @@ -1,293 +0,0 @@ -// -// 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 `ServerTrustPolicy` objects to a given host. -open class ServerTrustPolicyManager { - /// The dictionary of policies mapped to a particular host. - open 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. -/// -/// - 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 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 .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/SessionDelegate.swift b/Example/Pods/Alamofire/Source/SessionDelegate.swift deleted file mode 100644 index 4549731..0000000 --- a/Example/Pods/Alamofire/Source/SessionDelegate.swift +++ /dev/null @@ -1,681 +0,0 @@ -// -// SessionDelegate.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 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, (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, (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, (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, (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 - - /// 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, (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, (CachedURLResponse?) -> Void) -> Void)? - - // MARK: URLSessionDownloadDelegate Overrides - - /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didFinishDownloadingTo:)`. - open var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> Void)? - - /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)`. - open var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)? - - /// Overrides default behavior for URLSessionDownloadDelegate method `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)`. - open var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)? - - // MARK: URLSessionStreamDelegate Overrides - -#if !os(watchOS) - - /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:readClosedFor:)`. - open var streamTaskReadClosed: ((URLSession, URLSessionStreamTask) -> Void)? - - /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:writeClosedFor:)`. - open var streamTaskWriteClosed: ((URLSession, URLSessionStreamTask) -> Void)? - - /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:betterRouteDiscoveredFor:)`. - open var streamTaskBetterRouteDiscovered: ((URLSession, URLSessionStreamTask) -> Void)? - - /// Overrides default behavior for URLSessionStreamDelegate method `urlSession(_:streamTask:didBecome:outputStream:)`. - open var streamTaskDidBecomeInputAndOutputStreams: ((URLSession, URLSessionStreamTask, InputStream, OutputStream) -> Void)? - -#endif - - // MARK: Properties - - var retrier: RequestRetrier? - weak var sessionManager: SessionManager? - - private 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 - } - } - - // 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 - } - #endif - - #if !os(watchOS) - 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 - -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) - } - - /// 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 - } - - 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 - } - } - } - - completionHandler(disposition, credential) - } - -#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) - } - -#endif -} - -// MARK: - URLSessionTaskDelegate - -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 - } - - var redirectRequest: URLRequest? = request - - if let taskWillPerformHTTPRedirection = taskWillPerformHTTPRedirection { - redirectRequest = taskWillPerformHTTPRedirection(session, task, response, request) - } - - completionHandler(redirectRequest) - } - - /// 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 - } - - 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 - ) - } 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) - } - } - - /// 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 - ) - } - } - -#if !os(watchOS) - - /// 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 - } - -#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 } - - if let taskDidComplete = strongSelf.taskDidComplete { - taskDidComplete(session, task, error) - } else if let delegate = strongSelf[task]?.delegate { - delegate.urlSession(session, task: task, didCompleteWithError: error) - } - - NotificationCenter.default.post( - name: Notification.Name.Task.DidComplete, - object: strongSelf, - userInfo: [Notification.Key.Task: task] - ) - - 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 let taskDelegate = self[task]?.delegate, taskDelegate.error != nil { - error = taskDelegate.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, delay in - guard shouldRetry else { completeTask(session, task, error) ; return } - - DispatchQueue.utility.after(delay) { [weak self] in - guard let strongSelf = self else { return } - - let retrySucceeded = strongSelf.sessionManager?.retry(request) ?? false - - if retrySucceeded, let task = request.task { - strongSelf[task] = request - return - } else { - completeTask(session, task, error) - } - } - } - } else { - completeTask(session, task, error) - } - } -} - -// 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 - - if let dataTaskDidReceiveResponse = dataTaskDidReceiveResponse { - disposition = dataTaskDidReceiveResponse(session, dataTask, response) - } - - completionHandler(disposition) - } - - /// 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) - } else { - self[downloadTask]?.delegate = DownloadTaskDelegate(task: downloadTask) - } - } - - /// 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) - } - } - - /// 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 - } - - 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) - } - } -} - -// MARK: - URLSessionDownloadDelegate - -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) - } - } - - /// 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 - ) - } - } - - /// 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 - ) - } - } -} - -// MARK: - URLSessionStreamDelegate - -#if !os(watchOS) - -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) - } - - /// 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) - } - - /// 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) - } - - /// 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) - } -} - -#endif diff --git a/Example/Pods/Alamofire/Source/SessionManager.swift b/Example/Pods/Alamofire/Source/SessionManager.swift deleted file mode 100644 index 1363125..0000000 --- a/Example/Pods/Alamofire/Source/SessionManager.swift +++ /dev/null @@ -1,776 +0,0 @@ -// -// SessionManager.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 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. - open 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. - open 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. - open static let multipartFormDataEncodingMemoryThreshold: UInt64 = 10_000_000 - - /// The underlying session. - open let session: URLSession - - /// The session delegate handling all the task and session delegate callbacks. - open 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 - { - do { - let urlRequest = try URLRequest(url: url, method: method, headers: headers) - let encodedURLRequest = try encoding.encode(urlRequest, with: parameters) - return request(encodedURLRequest) - } catch { - return request(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`. - open func request(_ urlRequest: URLRequestConvertible) -> DataRequest { - do { - let 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(failedWith: error) - } - } - - // MARK: Private - Request Implementation - - private func request(failedWith error: Error) -> DataRequest { - let request = DataRequest(session: session, requestTask: .data(nil, nil), error: error) - 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(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(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. - /// - /// - 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 request = DownloadRequest(session: session, requestTask: .download(downloadable, task)) - - request.downloadDelegate.destination = destination - - delegate[task] = request - - if startRequestsImmediately { request.resume() } - - return request - } catch { - return download(failedWith: error) - } - } - - private func download(failedWith error: Error) -> DownloadRequest { - let download = DownloadRequest(session: session, requestTask: .download(nil, nil), error: error) - 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(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(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(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(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(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(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, - encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?) - { - do { - let urlRequest = try URLRequest(url: url, method: method, headers: headers) - - return upload( - multipartFormData: multipartFormData, - usingThreshold: encodingMemoryThreshold, - with: urlRequest, - encodingCompletion: encodingCompletion - ) - } catch { - 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, - encodingCompletion: ((MultipartFormDataEncodingResult) -> Void)?) - { - DispatchQueue.global(qos: .utility).async { - let formData = MultipartFormData() - multipartFormData(formData) - - 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 - ) - - 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) - - 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) - - DispatchQueue.main.async { - let encodingResult = MultipartFormDataEncodingResult.success( - request: self.upload(fileURL, with: urlRequestWithContentType), - streamingFromDisk: true, - streamFileURL: fileURL - ) - encodingCompletion?(encodingResult) - } - } - } catch { - 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(failedWith: error) - } - } - - private func upload(failedWith error: Error) -> UploadRequest { - let upload = UploadRequest(session: session, requestTask: .upload(nil, nil), error: error) - 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 - 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 - open func stream(with netService: NetService) -> StreamRequest { - return stream(.netService(netService)) - } - - // MARK: Private - Stream Implementation - - 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) - } - } - - 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) - - request.delegate.task = task // resets all task delegate data - - request.startTime = CFAbsoluteTimeGetCurrent() - request.endTime = nil - - task.resume() - - return true - } catch { - request.delegate.error = error - return false - } - } -} diff --git a/Example/Pods/Alamofire/Source/TaskDelegate.swift b/Example/Pods/Alamofire/Source/TaskDelegate.swift deleted file mode 100644 index 4a10b65..0000000 --- a/Example/Pods/Alamofire/Source/TaskDelegate.swift +++ /dev/null @@ -1,449 +0,0 @@ -// -// TaskDelegate.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 - -/// 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. - open let queue: OperationQueue - - var task: URLSessionTask? { - didSet { reset() } - } - - var data: Data? { return nil } - var error: Error? - - var initialResponseTime: CFAbsoluteTime? - var credential: URLCredential? - var metrics: AnyObject? // URLSessionTaskMetrics - - // MARK: Lifecycle - - init(task: URLSessionTask?) { - self.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 - - if let destination = destination { - let result = destination(location, downloadTask.response as! HTTPURLResponse) - let destination = result.destinationURL - let options = result.options - - do { - destinationURL = destination - - if options.contains(.removePreviousFile) { - if FileManager.default.fileExists(atPath: destination.path) { - try FileManager.default.removeItem(at: destination) - } - } - - if options.contains(.createIntermediateDirectories) { - let directory = destination.deletingLastPathComponent() - try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true, attributes: nil) - } - - try FileManager.default.moveItem(at: location, to: destination) - } 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 1440989..0000000 --- a/Example/Pods/Alamofire/Source/Timeline.swift +++ /dev/null @@ -1,136 +0,0 @@ -// -// Timeline.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 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/Validation.swift b/Example/Pods/Alamofire/Source/Validation.swift deleted file mode 100644 index c405d02..0000000 --- a/Example/Pods/Alamofire/Source/Validation.swift +++ /dev/null @@ -1,309 +0,0 @@ -// -// Validation.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 - -extension Request { - - // MARK: Helper Types - - 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) - } - - fileprivate struct MIMEType { - let type: String - let subtype: String - - var isWildcard: Bool { return type == "*" && subtype == "*" } - - init?(_ string: String) { - let components: [String] = { - let stripped = string.trimmingCharacters(in: .whitespacesAndNewlines) - let split = stripped.substring(to: stripped.range(of: ";")?.lowerBound ?? stripped.endIndex) - return split.components(separatedBy: "/") - }() - - if let type = components.first, let subtype = components.last { - self.type = type - self.subtype = subtype - } else { - return nil - } - } - - func matches(_ mime: MIMEType) -> Bool { - switch (type, subtype) { - case (mime.type, mime.subtype), (mime.type, "*"), ("*", mime.subtype), ("*", "*"): - return true - default: - return false - } - } - } - - // MARK: Properties - - fileprivate var acceptableStatusCodes: [Int] { return Array(200..<300) } - - fileprivate var acceptableContentTypes: [String] { - if let accept = request?.value(forHTTPHeaderField: "Accept") { - return accept.components(separatedBy: ",") - } - - return ["*/*"] - } - - // MARK: Status Code - - fileprivate func validate( - statusCode acceptableStatusCodes: S, - response: HTTPURLResponse) - -> ValidationResult - where S.Iterator.Element == Int - { - if acceptableStatusCodes.contains(response.statusCode) { - return .success - } else { - let reason: ErrorReason = .unacceptableStatusCode(code: response.statusCode) - return .failure(AFError.responseValidationFailed(reason: reason)) - } - } - - // MARK: Content Type - - fileprivate func validate( - contentType acceptableContentTypes: S, - response: HTTPURLResponse, - data: Data?) - -> ValidationResult - where S.Iterator.Element == String - { - guard let data = data, data.count > 0 else { return .success } - - guard - let responseContentType = response.mimeType, - let responseMIMEType = MIMEType(responseContentType) - else { - for contentType in acceptableContentTypes { - if let mimeType = MIMEType(contentType), mimeType.isWildcard { - return .success - } - } - - let error: AFError = { - let reason: ErrorReason = .missingContentType(acceptableContentTypes: Array(acceptableContentTypes)) - return AFError.responseValidationFailed(reason: reason) - }() - - return .failure(error) - } - - for contentType in acceptableContentTypes { - if let acceptableMIMEType = MIMEType(contentType), acceptableMIMEType.matches(responseMIMEType) { - return .success - } - } - - let error: AFError = { - let reason: ErrorReason = .unacceptableContentType( - acceptableContentTypes: Array(acceptableContentTypes), - responseContentType: responseContentType - ) - - return AFError.responseValidationFailed(reason: reason) - }() - - return .failure(error) - } -} - -// MARK: - - -extension DataRequest { - /// A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the - /// 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. - /// - /// - parameter range: The range of acceptable status codes. - /// - /// - returns: The request. - @discardableResult - public func validate(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int { - return validate { [unowned self] _, response, _ in - return self.validate(statusCode: acceptableStatusCodes, response: response) - } - } - - /// Validates that the response has a content type in the specified sequence. - /// - /// If validation fails, subsequent calls to response handlers will have an associated error. - /// - /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes. - /// - /// - returns: The request. - @discardableResult - public func validate(contentType acceptableContentTypes: S) -> Self where S.Iterator.Element == String { - return validate { [unowned self] _, response, data in - return self.validate(contentType: acceptableContentTypes, response: response, data: data) - } - } - - /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content - /// type matches any specified in the Accept HTTP header field. - /// - /// If validation fails, subsequent calls to response handlers will have an associated error. - /// - /// - returns: The request. - @discardableResult - public func validate() -> Self { - return validate(statusCode: self.acceptableStatusCodes).validate(contentType: self.acceptableContentTypes) - } -} - -// MARK: - - -extension DownloadRequest { - /// A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a - /// destination URL, and returns whether the request was valid. - public typealias Validation = ( - _ request: URLRequest?, - _ response: HTTPURLResponse, - _ temporaryURL: URL?, - _ destinationURL: 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. - /// - /// - parameter range: The range of acceptable status codes. - /// - /// - returns: The request. - @discardableResult - public func validate(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int { - return validate { [unowned self] _, response, _, _ in - return self.validate(statusCode: acceptableStatusCodes, response: response) - } - } - - /// Validates that the response has a content type in the specified sequence. - /// - /// If validation fails, subsequent calls to response handlers will have an associated error. - /// - /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes. - /// - /// - 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 - - 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) - } catch { - return .failure(AFError.responseValidationFailed(reason: .dataFileReadFailed(at: validFileURL))) - } - } - } - - /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content - /// type matches any specified in the Accept HTTP header field. - /// - /// If validation fails, subsequent calls to response handlers will have an associated error. - /// - /// - returns: The request. - @discardableResult - public func validate() -> Self { - return validate(statusCode: self.acceptableStatusCodes).validate(contentType: self.acceptableContentTypes) - } -} diff --git a/Example/Pods/Local Podspecs/Reqres.podspec.json b/Example/Pods/Local Podspecs/Reqres.podspec.json deleted file mode 100644 index af9585e..0000000 --- a/Example/Pods/Local Podspecs/Reqres.podspec.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "Reqres", - "version": "1.2.0", - "summary": "Simple network activity logger", - "description": "Logs every request app makes, works great with Alamofire.", - "homepage": "https://github.com/AckeeCZ/Reqres", - "license": { - "type": "MIT", - "file": "LICENSE" - }, - "authors": { - "Ackee": "info@ackee.cz" - }, - "source": { - "git": "https://github.com/AckeeCZ/Reqres.git", - "tag": "1.2.0" - }, - "platforms": { - "ios": "8.0" - }, - "source_files": "Reqres/Classes/**/*" -} diff --git a/Example/Pods/Manifest.lock b/Example/Pods/Manifest.lock deleted file mode 100644 index 9f9c911..0000000 --- a/Example/Pods/Manifest.lock +++ /dev/null @@ -1,25 +0,0 @@ -PODS: - - Alamofire (4.0.1) - - Nimble (5.0.0) - - Quick (0.10.0) - - Reqres (1.2.0) - -DEPENDENCIES: - - Alamofire - - Nimble (~> 5.0) - - Quick (~> 0.10) - - Reqres (from `../`) - -EXTERNAL SOURCES: - Reqres: - :path: ../ - -SPEC CHECKSUMS: - Alamofire: 7682d43245de14874acd142ec137b144aa1dd335 - Nimble: 56fc9f5020effa2206de22c3dd910f4fb011b92f - Quick: 5d290df1c69d5ee2f0729956dcf0fd9a30447eaa - Reqres: 1f2b4310bbdbb8b4bf72d8ad4e35b58aee6a2181 - -PODFILE CHECKSUM: 9d807594251db4fbaf40232aaa50dd502a0b95a2 - -COCOAPODS: 1.1.0.rc.2 diff --git a/Example/Pods/Nimble/LICENSE.md b/Example/Pods/Nimble/LICENSE.md deleted file mode 100644 index 0f3eb71..0000000 --- a/Example/Pods/Nimble/LICENSE.md +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Quick Team - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Example/Pods/Nimble/README.md b/Example/Pods/Nimble/README.md deleted file mode 100644 index e816baf..0000000 --- a/Example/Pods/Nimble/README.md +++ /dev/null @@ -1,1268 +0,0 @@ -# Nimble - -Use Nimble to express the expected outcomes of Swift -or Objective-C expressions. Inspired by -[Cedar](https://github.com/pivotal/cedar). - -```swift -// Swift -expect(1 + 1).to(equal(2)) -expect(1.2).to(beCloseTo(1.1, within: 0.1)) -expect(3) > 2 -expect("seahorse").to(contain("sea")) -expect(["Atlantic", "Pacific"]).toNot(contain("Mississippi")) -expect(ocean.isClean).toEventually(beTruthy()) -``` - -# How to Use Nimble - - - -**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* - -- [Some Background: Expressing Outcomes Using Assertions in XCTest](#some-background-expressing-outcomes-using-assertions-in-xctest) -- [Nimble: Expectations Using `expect(...).to`](#nimble-expectations-using-expectto) - - [Custom Failure Messages](#custom-failure-messages) - - [Type Checking](#type-checking) - - [Operator Overloads](#operator-overloads) - - [Lazily Computed Values](#lazily-computed-values) - - [C Primitives](#c-primitives) - - [Asynchronous Expectations](#asynchronous-expectations) - - [Objective-C Support](#objective-c-support) - - [Disabling Objective-C Shorthand](#disabling-objective-c-shorthand) -- [Built-in Matcher Functions](#built-in-matcher-functions) - - [Equivalence](#equivalence) - - [Identity](#identity) - - [Comparisons](#comparisons) - - [Types/Classes](#typesclasses) - - [Truthiness](#truthiness) - - [Swift Error Handling](#swift-error-handling) - - [Exceptions](#exceptions) - - [Collection Membership](#collection-membership) - - [Strings](#strings) - - [Checking if all elements of a collection pass a condition](#checking-if-all-elements-of-a-collection-pass-a-condition) - - [Verify collection count](#verify-collection-count) - - [Matching a value to any of a group of matchers](#matching-a-value-to-any-of-a-group-of-matchers) -- [Writing Your Own Matchers](#writing-your-own-matchers) - - [Lazy Evaluation](#lazy-evaluation) - - [Type Checking via Swift Generics](#type-checking-via-swift-generics) - - [Customizing Failure Messages](#customizing-failure-messages) - - [Supporting Objective-C](#supporting-objective-c) - - [Properly Handling `nil` in Objective-C Matchers](#properly-handling-nil-in-objective-c-matchers) -- [Installing Nimble](#installing-nimble) - - [Installing Nimble as a Submodule](#installing-nimble-as-a-submodule) - - [Installing Nimble via CocoaPods](#installing-nimble-via-cocoapods) - - [Using Nimble without XCTest](#using-nimble-without-xctest) - - - -# Some Background: Expressing Outcomes Using Assertions in XCTest - -Apple's Xcode includes the XCTest framework, which provides -assertion macros to test whether code behaves properly. -For example, to assert that `1 + 1 = 2`, XCTest has you write: - -```swift -// Swift - -XCTAssertEqual(1 + 1, 2, "expected one plus one to equal two") -``` - -Or, in Objective-C: - -```objc -// Objective-C - -XCTAssertEqual(1 + 1, 2, @"expected one plus one to equal two"); -``` - -XCTest assertions have a couple of drawbacks: - -1. **Not enough macros.** There's no easy way to assert that a string - contains a particular substring, or that a number is less than or - equal to another. -2. **It's hard to write asynchronous tests.** XCTest forces you to write - a lot of boilerplate code. - -Nimble addresses these concerns. - -# Nimble: Expectations Using `expect(...).to` - -Nimble allows you to express expectations using a natural, -easily understood language: - -```swift -// Swift - -import Nimble - -expect(seagull.squawk).to(equal("Squee!")) -``` - -```objc -// Objective-C - -@import Nimble; - -expect(seagull.squawk).to(equal(@"Squee!")); -``` - -> The `expect` function autocompletes to include `file:` and `line:`, - but these parameters are optional. Use the default values to have - Xcode highlight the correct line when an expectation is not met. - -To perform the opposite expectation--to assert something is *not* -equal--use `toNot` or `notTo`: - -```swift -// Swift - -import Nimble - -expect(seagull.squawk).toNot(equal("Oh, hello there!")) -expect(seagull.squawk).notTo(equal("Oh, hello there!")) -``` - -```objc -// Objective-C - -@import Nimble; - -expect(seagull.squawk).toNot(equal(@"Oh, hello there!")); -expect(seagull.squawk).notTo(equal(@"Oh, hello there!")); -``` - -## Custom Failure Messages - -Would you like to add more information to the test's failure messages? Use the `description` optional argument to add your own text: - -```swift -// Swift - -expect(1 + 1).to(equal(3)) -// failed - expected to equal <3>, got <2> - -expect(1 + 1).to(equal(3), description: "Make sure libKindergartenMath is loaded") -// failed - Make sure libKindergartenMath is loaded -// expected to equal <3>, got <2> -``` - -Or the *WithDescription version in Objective-C: - -```objc -// Objective-C - -@import Nimble; - -expect(@(1+1)).to(equal(@3)); -// failed - expected to equal <3.0000>, got <2.0000> - -expect(@(1+1)).toWithDescription(equal(@3), @"Make sure libKindergartenMath is loaded"); -// failed - Make sure libKindergartenMath is loaded -// expected to equal <3.0000>, got <2.0000> -``` - -## Type Checking - -Nimble makes sure you don't compare two types that don't match: - -```swift -// Swift - -// Does not compile: -expect(1 + 1).to(equal("Squee!")) -``` - -> Nimble uses generics--only available in Swift--to ensure - type correctness. That means type checking is - not available when using Nimble in Objective-C. :sob: - -## Operator Overloads - -Tired of so much typing? With Nimble, you can use overloaded operators -like `==` for equivalence, or `>` for comparisons: - -```swift -// Swift - -// Passes if squawk does not equal "Hi!": -expect(seagull.squawk) != "Hi!" - -// Passes if 10 is greater than 2: -expect(10) > 2 -``` - -> Operator overloads are only available in Swift, so you won't be able - to use this syntax in Objective-C. :broken_heart: - -## Lazily Computed Values - -The `expect` function doesn't evaluate the value it's given until it's -time to match. So Nimble can test whether an expression raises an -exception once evaluated: - -```swift -// Swift - -// Note: Swift currently doesn't have exceptions. -// Only Objective-C code can raise exceptions -// that Nimble will catch. -// (see https://github.com/Quick/Nimble/issues/220#issuecomment-172667064) -let exception = NSException( - name: NSInternalInconsistencyException, - reason: "Not enough fish in the sea.", - userInfo: ["something": "is fishy"]) -expect { exception.raise() }.to(raiseException()) - -// Also, you can customize raiseException to be more specific -expect { exception.raise() }.to(raiseException(named: NSInternalInconsistencyException)) -expect { exception.raise() }.to(raiseException( - named: NSInternalInconsistencyException, - reason: "Not enough fish in the sea")) -expect { exception.raise() }.to(raiseException( - named: NSInternalInconsistencyException, - reason: "Not enough fish in the sea", - userInfo: ["something": "is fishy"])) -``` - -Objective-C works the same way, but you must use the `expectAction` -macro when making an expectation on an expression that has no return -value: - -```objc -// Objective-C - -NSException *exception = [NSException exceptionWithName:NSInternalInconsistencyException - reason:@"Not enough fish in the sea." - userInfo:nil]; -expectAction(^{ [exception raise]; }).to(raiseException()); - -// Use the property-block syntax to be more specific. -expectAction(^{ [exception raise]; }).to(raiseException().named(NSInternalInconsistencyException)); -expectAction(^{ [exception raise]; }).to(raiseException(). - named(NSInternalInconsistencyException). - reason("Not enough fish in the sea")); -expectAction(^{ [exception raise]; }).to(raiseException(). - named(NSInternalInconsistencyException). - reason("Not enough fish in the sea"). - userInfo(@{@"something": @"is fishy"})); - -// You can also pass a block for custom matching of the raised exception -expectAction(exception.raise()).to(raiseException().satisfyingBlock(^(NSException *exception) { - expect(exception.name).to(beginWith(NSInternalInconsistencyException)); -})); -``` - -## C Primitives - -Some testing frameworks make it hard to test primitive C values. -In Nimble, it just works: - -```swift -// Swift - -let actual: CInt = 1 -let expectedValue: CInt = 1 -expect(actual).to(equal(expectedValue)) -``` - -In fact, Nimble uses type inference, so you can write the above -without explicitly specifying both types: - -```swift -// Swift - -expect(1 as CInt).to(equal(1)) -``` - -> In Objective-C, Nimble only supports Objective-C objects. To - make expectations on primitive C values, wrap then in an object - literal: - - ```objc - expect(@(1 + 1)).to(equal(@2)); - ``` - -## Asynchronous Expectations - -In Nimble, it's easy to make expectations on values that are updated -asynchronously. Just use `toEventually` or `toEventuallyNot`: - -```swift -// Swift - -dispatch_async(dispatch_get_main_queue()) { - ocean.add("dolphins") - ocean.add("whales") -} -expect(ocean).toEventually(contain("dolphins", "whales")) -``` - - -```objc -// Objective-C -dispatch_async(dispatch_get_main_queue(), ^{ - [ocean add:@"dolphins"]; - [ocean add:@"whales"]; -}); -expect(ocean).toEventually(contain(@"dolphins", @"whales")); -``` - -Note: toEventually triggers its polls on the main thread. Blocking the main -thread will cause Nimble to stop the run loop. This can cause test pollution -for whatever incomplete code that was running on the main thread. Blocking the -main thread can be caused by blocking IO, calls to sleep(), deadlocks, and -synchronous IPC. - -In the above example, `ocean` is constantly re-evaluated. If it ever -contains dolphins and whales, the expectation passes. If `ocean` still -doesn't contain them, even after being continuously re-evaluated for one -whole second, the expectation fails. - -Sometimes it takes more than a second for a value to update. In those -cases, use the `timeout` parameter: - -```swift -// Swift - -// Waits three seconds for ocean to contain "starfish": -expect(ocean).toEventually(contain("starfish"), timeout: 3) -``` - -```objc -// Objective-C - -// Waits three seconds for ocean to contain "starfish": -expect(ocean).withTimeout(3).toEventually(contain(@"starfish")); -``` - -You can also provide a callback by using the `waitUntil` function: - -```swift -// Swift - -waitUntil { done in - // do some stuff that takes a while... - NSThread.sleepForTimeInterval(0.5) - done() -} -``` - -```objc -// Objective-C - -waitUntil(^(void (^done)(void)){ - // do some stuff that takes a while... - [NSThread sleepForTimeInterval:0.5]; - done(); -}); -``` - -`waitUntil` also optionally takes a timeout parameter: - -```swift -// Swift - -waitUntil(timeout: 10) { done in - // do some stuff that takes a while... - NSThread.sleepForTimeInterval(1) - done() -} -``` - -```objc -// Objective-C - -waitUntilTimeout(10, ^(void (^done)(void)){ - // do some stuff that takes a while... - [NSThread sleepForTimeInterval:1]; - done(); -}); -``` - -Note: waitUntil triggers its timeout code on the main thread. Blocking the main -thread will cause Nimble to stop the run loop to continue. This can cause test -pollution for whatever incomplete code that was running on the main thread. -Blocking the main thread can be caused by blocking IO, calls to sleep(), -deadlocks, and synchronous IPC. - -In some cases (e.g. when running on slower machines) it can be useful to modify -the default timeout and poll interval values. This can be done as follows: - -```swift -// Swift - -// Increase the global timeout to 5 seconds: -Nimble.AsyncDefaults.Timeout = 5 - -// Slow the polling interval to 0.1 seconds: -Nimble.AsyncDefaults.PollInterval = 0.1 -``` - -## Objective-C Support - -Nimble has full support for Objective-C. However, there are two things -to keep in mind when using Nimble in Objective-C: - -1. All parameters passed to the `expect` function, as well as matcher - functions like `equal`, must be Objective-C objects: - - ```objc - // Objective-C - - @import Nimble; - - expect(@(1 + 1)).to(equal(@2)); - expect(@"Hello world").to(contain(@"world")); - ``` - -2. To make an expectation on an expression that does not return a value, - such as `-[NSException raise]`, use `expectAction` instead of - `expect`: - - ```objc - // Objective-C - - expectAction(^{ [exception raise]; }).to(raiseException()); - ``` - -## Disabling Objective-C Shorthand - -Nimble provides a shorthand for expressing expectations using the -`expect` function. To disable this shorthand in Objective-C, define the -`NIMBLE_DISABLE_SHORT_SYNTAX` macro somewhere in your code before -importing Nimble: - -```objc -#define NIMBLE_DISABLE_SHORT_SYNTAX 1 - -@import Nimble; - -NMB_expect(^{ return seagull.squawk; }, __FILE__, __LINE__).to(NMB_equal(@"Squee!")); -``` - -> Disabling the shorthand is useful if you're testing functions with - names that conflict with Nimble functions, such as `expect` or - `equal`. If that's not the case, there's no point in disabling the - shorthand. - -# Built-in Matcher Functions - -Nimble includes a wide variety of matcher functions. - -## Equivalence - -```swift -// Swift - -// Passes if actual is equivalent to expected: -expect(actual).to(equal(expected)) -expect(actual) == expected - -// Passes if actual is not equivalent to expected: -expect(actual).toNot(equal(expected)) -expect(actual) != expected -``` - -```objc -// Objective-C - -// Passes if actual is equivalent to expected: -expect(actual).to(equal(expected)) - -// Passes if actual is not equivalent to expected: -expect(actual).toNot(equal(expected)) -``` - -Values must be `Equatable`, `Comparable`, or subclasses of `NSObject`. -`equal` will always fail when used to compare one or more `nil` values. - -## Identity - -```swift -// Swift - -// Passes if actual has the same pointer address as expected: -expect(actual).to(beIdenticalTo(expected)) -expect(actual) === expected - -// Passes if actual does not have the same pointer address as expected: -expect(actual).toNot(beIdenticalTo(expected)) -expect(actual) !== expected -``` - -Its important to remember that `beIdenticalTo` only makes sense when comparing types with reference semantics, which have a notion of identity. In Swift, that means a `class`. This matcher will not work with types with value semantics such as `struct` or `enum`. If you need to compare two value types, you can either compare individual properties or if it makes sense to do so, make your type implement `Equatable` and use Nimble's equivalence matchers instead. - - -```objc -// Objective-C - -// Passes if actual has the same pointer address as expected: -expect(actual).to(beIdenticalTo(expected)); - -// Passes if actual does not have the same pointer address as expected: -expect(actual).toNot(beIdenticalTo(expected)); -``` - -## Comparisons - -```swift -// Swift - -expect(actual).to(beLessThan(expected)) -expect(actual) < expected - -expect(actual).to(beLessThanOrEqualTo(expected)) -expect(actual) <= expected - -expect(actual).to(beGreaterThan(expected)) -expect(actual) > expected - -expect(actual).to(beGreaterThanOrEqualTo(expected)) -expect(actual) >= expected -``` - -```objc -// Objective-C - -expect(actual).to(beLessThan(expected)); -expect(actual).to(beLessThanOrEqualTo(expected)); -expect(actual).to(beGreaterThan(expected)); -expect(actual).to(beGreaterThanOrEqualTo(expected)); -``` - -> Values given to the comparison matchers above must implement - `Comparable`. - -Because of how computers represent floating point numbers, assertions -that two floating point numbers be equal will sometimes fail. To express -that two numbers should be close to one another within a certain margin -of error, use `beCloseTo`: - -```swift -// Swift - -expect(actual).to(beCloseTo(expected, within: delta)) -``` - -```objc -// Objective-C - -expect(actual).to(beCloseTo(expected).within(delta)); -``` - -For example, to assert that `10.01` is close to `10`, you can write: - -```swift -// Swift - -expect(10.01).to(beCloseTo(10, within: 0.1)) -``` - -```objc -// Objective-C - -expect(@(10.01)).to(beCloseTo(@10).within(0.1)); -``` - -There is also an operator shortcut available in Swift: - -```swift -// Swift - -expect(actual) ≈ expected -expect(actual) ≈ (expected, delta) - -``` -(Type Option-x to get ≈ on a U.S. keyboard) - -The former version uses the default delta of 0.0001. Here is yet another way to do this: - -```swift -// Swift - -expect(actual) ≈ expected ± delta -expect(actual) == expected ± delta - -``` -(Type Option-Shift-= to get ± on a U.S. keyboard) - -If you are comparing arrays of floating point numbers, you'll find the following useful: - -```swift -// Swift - -expect([0.0, 2.0]) ≈ [0.0001, 2.0001] -expect([0.0, 2.0]).to(beCloseTo([0.1, 2.1], within: 0.1)) - -``` - -> Values given to the `beCloseTo` matcher must be coercable into a - `Double`. - -## Types/Classes - -```swift -// Swift - -// Passes if instance is an instance of aClass: -expect(instance).to(beAnInstanceOf(aClass)) - -// Passes if instance is an instance of aClass or any of its subclasses: -expect(instance).to(beAKindOf(aClass)) -``` - -```objc -// Objective-C - -// Passes if instance is an instance of aClass: -expect(instance).to(beAnInstanceOf(aClass)); - -// Passes if instance is an instance of aClass or any of its subclasses: -expect(instance).to(beAKindOf(aClass)); -``` - -> Instances must be Objective-C objects: subclasses of `NSObject`, - or Swift objects bridged to Objective-C with the `@objc` prefix. - -For example, to assert that `dolphin` is a kind of `Mammal`: - -```swift -// Swift - -expect(dolphin).to(beAKindOf(Mammal)) -``` - -```objc -// Objective-C - -expect(dolphin).to(beAKindOf([Mammal class])); -``` - -> `beAnInstanceOf` uses the `-[NSObject isMemberOfClass:]` method to - test membership. `beAKindOf` uses `-[NSObject isKindOfClass:]`. - -## Truthiness - -```swift -// Passes if actual is not nil, true, or an object with a boolean value of true: -expect(actual).to(beTruthy()) - -// Passes if actual is only true (not nil or an object conforming to Boolean true): -expect(actual).to(beTrue()) - -// Passes if actual is nil, false, or an object with a boolean value of false: -expect(actual).to(beFalsy()) - -// Passes if actual is only false (not nil or an object conforming to Boolean false): -expect(actual).to(beFalse()) - -// Passes if actual is nil: -expect(actual).to(beNil()) -``` - -```objc -// Objective-C - -// Passes if actual is not nil, true, or an object with a boolean value of true: -expect(actual).to(beTruthy()); - -// Passes if actual is only true (not nil or an object conforming to Boolean true): -expect(actual).to(beTrue()); - -// Passes if actual is nil, false, or an object with a boolean value of false: -expect(actual).to(beFalsy()); - -// Passes if actual is only false (not nil or an object conforming to Boolean false): -expect(actual).to(beFalse()); - -// Passes if actual is nil: -expect(actual).to(beNil()); -``` - -## Swift Error Handling - -If you're using Swift 2.0+, you can use the `throwError` matcher to check if an error is thrown. - -```swift -// Swift - -// Passes if somethingThatThrows() throws an ErrorProtocol: -expect{ try somethingThatThrows() }.to(throwError()) - -// Passes if somethingThatThrows() throws an error with a given domain: -expect{ try somethingThatThrows() }.to(throwError { (error: ErrorProtocol) in - expect(error._domain).to(equal(NSCocoaErrorDomain)) -}) - -// Passes if somethingThatThrows() throws an error with a given case: -expect{ try somethingThatThrows() }.to(throwError(NSCocoaError.PropertyListReadCorruptError)) - -// Passes if somethingThatThrows() throws an error with a given type: -expect{ try somethingThatThrows() }.to(throwError(errorType: NimbleError.self)) -``` - -If you are working directly with `ErrorProtocol` values, as is sometimes the case when using `Result` or `Promise` types, you can use the `matchError` matcher to check if the error is the same error is is supposed to be, without requiring explicit casting. - -```swift -// Swift - -let actual: ErrorProtocol = … - -// Passes if actual contains any error value from the NimbleErrorEnum type: -expect(actual).to(matchError(NimbleErrorEnum)) - -// Passes if actual contains the Timeout value from the NimbleErrorEnum type: -expect(actual).to(matchError(NimbleErrorEnum.Timeout)) - -// Passes if actual contains an NSError equal to the given one: -expect(actual).to(matchError(NSError(domain: "err", code: 123, userInfo: nil))) -``` - -Note: This feature is only available in Swift. - -## Exceptions - -```swift -// Swift - -// Passes if actual, when evaluated, raises an exception: -expect(actual).to(raiseException()) - -// Passes if actual raises an exception with the given name: -expect(actual).to(raiseException(named: name)) - -// Passes if actual raises an exception with the given name and reason: -expect(actual).to(raiseException(named: name, reason: reason)) - -// Passes if actual raises an exception and it passes expectations in the block -// (in this case, if name begins with 'a r') -expect { exception.raise() }.to(raiseException { (exception: NSException) in - expect(exception.name).to(beginWith("a r")) -}) -``` - -```objc -// Objective-C - -// Passes if actual, when evaluated, raises an exception: -expect(actual).to(raiseException()) - -// Passes if actual raises an exception with the given name -expect(actual).to(raiseException().named(name)) - -// Passes if actual raises an exception with the given name and reason: -expect(actual).to(raiseException().named(name).reason(reason)) - -// Passes if actual raises an exception and it passes expectations in the block -// (in this case, if name begins with 'a r') -expect(actual).to(raiseException().satisfyingBlock(^(NSException *exception) { - expect(exception.name).to(beginWith(@"a r")); -})); -``` - -Note: Swift currently doesn't have exceptions (see [#220](https://github.com/Quick/Nimble/issues/220#issuecomment-172667064)). Only Objective-C code can raise -exceptions that Nimble will catch. - -## Collection Membership - -```swift -// Swift - -// Passes if all of the expected values are members of actual: -expect(actual).to(contain(expected...)) - -// Passes if actual is an empty collection (it contains no elements): -expect(actual).to(beEmpty()) -``` - -```objc -// Objective-C - -// Passes if expected is a member of actual: -expect(actual).to(contain(expected)); - -// Passes if actual is an empty collection (it contains no elements): -expect(actual).to(beEmpty()); -``` - -> In Swift `contain` takes any number of arguments. The expectation - passes if all of them are members of the collection. In Objective-C, - `contain` only takes one argument [for now](https://github.com/Quick/Nimble/issues/27). - -For example, to assert that a list of sea creature names contains -"dolphin" and "starfish": - -```swift -// Swift - -expect(["whale", "dolphin", "starfish"]).to(contain("dolphin", "starfish")) -``` - -```objc -// Objective-C - -expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"dolphin")); -expect(@[@"whale", @"dolphin", @"starfish"]).to(contain(@"starfish")); -``` - -> `contain` and `beEmpty` expect collections to be instances of - `NSArray`, `NSSet`, or a Swift collection composed of `Equatable` elements. - -To test whether a set of elements is present at the beginning or end of -an ordered collection, use `beginWith` and `endWith`: - -```swift -// Swift - -// Passes if the elements in expected appear at the beginning of actual: -expect(actual).to(beginWith(expected...)) - -// Passes if the the elements in expected come at the end of actual: -expect(actual).to(endWith(expected...)) -``` - -```objc -// Objective-C - -// Passes if the elements in expected appear at the beginning of actual: -expect(actual).to(beginWith(expected)); - -// Passes if the the elements in expected come at the end of actual: -expect(actual).to(endWith(expected)); -``` - -> `beginWith` and `endWith` expect collections to be instances of - `NSArray`, or ordered Swift collections composed of `Equatable` - elements. - - Like `contain`, in Objective-C `beginWith` and `endWith` only support - a single argument [for now](https://github.com/Quick/Nimble/issues/27). - -## Strings - -```swift -// Swift - -// Passes if actual contains substring expected: -expect(actual).to(contain(expected)) - -// Passes if actual begins with substring: -expect(actual).to(beginWith(expected)) - -// Passes if actual ends with substring: -expect(actual).to(endWith(expected)) - -// Passes if actual is an empty string, "": -expect(actual).to(beEmpty()) - -// Passes if actual matches the regular expression defined in expected: -expect(actual).to(match(expected)) -``` - -```objc -// Objective-C - -// Passes if actual contains substring expected: -expect(actual).to(contain(expected)); - -// Passes if actual begins with substring: -expect(actual).to(beginWith(expected)); - -// Passes if actual ends with substring: -expect(actual).to(endWith(expected)); - -// Passes if actual is an empty string, "": -expect(actual).to(beEmpty()); - -// Passes if actual matches the regular expression defined in expected: -expect(actual).to(match(expected)) -``` - -## Checking if all elements of a collection pass a condition - -```swift -// Swift - -// with a custom function: -expect([1,2,3,4]).to(allPass({$0 < 5})) - -// with another matcher: -expect([1,2,3,4]).to(allPass(beLessThan(5))) -``` - -```objc -// Objective-C - -expect(@[@1, @2, @3,@4]).to(allPass(beLessThan(@5))); -``` - -For Swift the actual value has to be a Sequence, e.g. an array, a set or a custom seqence type. - -For Objective-C the actual value has to be a NSFastEnumeration, e.g. NSArray and NSSet, of NSObjects and only the variant which -uses another matcher is available here. - -## Verify collection count - -```swift -// Swift - -// passes if actual collection's count is equal to expected -expect(actual).to(haveCount(expected)) - -// passes if actual collection's count is not equal to expected -expect(actual).notTo(haveCount(expected)) -``` - -```objc -// Objective-C - -// passes if actual collection's count is equal to expected -expect(actual).to(haveCount(expected)) - -// passes if actual collection's count is not equal to expected -expect(actual).notTo(haveCount(expected)) -``` - -For Swift the actual value must be a `Collection` such as array, dictionary or set. - -For Objective-C the actual value has to be one of the following classes `NSArray`, `NSDictionary`, `NSSet`, `NSHashTable` or one of their subclasses. - -## Foundation - -### Verifying a Notification was posted - -```swift -// Swift -let testNotification = Notification(name: "Foo", object: nil) - -// passes if the closure in expect { ... } posts a notification to the default -// notification center. -expect { - NotificationCenter.default.postNotification(testNotification) -}.to(postNotifications(equal([testNotification])) - -// passes if the closure in expect { ... } posts a notification to a given -// notification center -let notificationCenter = NotificationCenter() -expect { - notificationCenter.postNotification(testNotification) -}.to(postNotifications(equal([testNotification]), fromNotificationCenter: notificationCenter)) -``` - -> This matcher is only available in Swift. - -## Matching a value to any of a group of matchers - -```swift -// passes if actual is either less than 10 or greater than 20 -expect(actual).to(satisfyAnyOf(beLessThan(10), beGreaterThan(20))) - -// can include any number of matchers -- the following will pass -// **be careful** -- too many matchers can be the sign of an unfocused test -expect(6).to(satisfyAnyOf(equal(2), equal(3), equal(4), equal(5), equal(6), equal(7))) - -// in Swift you also have the option to use the || operator to achieve a similar function -expect(82).to(beLessThan(50) || beGreaterThan(80)) -``` - -```objc -// passes if actual is either less than 10 or greater than 20 -expect(actual).to(satisfyAnyOf(beLessThan(@10), beGreaterThan(@20))) - -// can include any number of matchers -- the following will pass -// **be careful** -- too many matchers can be the sign of an unfocused test -expect(@6).to(satisfyAnyOf(equal(@2), equal(@3), equal(@4), equal(@5), equal(@6), equal(@7))) -``` - -Note: This matcher allows you to chain any number of matchers together. This provides flexibility, - but if you find yourself chaining many matchers together in one test, consider whether you - could instead refactor that single test into multiple, more precisely focused tests for - better coverage. - -# Writing Your Own Matchers - -In Nimble, matchers are Swift functions that take an expected -value and return a `MatcherFunc` closure. Take `equal`, for example: - -```swift -// Swift - -public func equal(expectedValue: T?) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(expectedValue)>" - if let actualValue = try actualExpression.evaluate() { - return actualValue == expectedValue - } else { - return false - } - } -} -``` - -The return value of a `MatcherFunc` closure is a `Bool` that indicates -whether the actual value matches the expectation: `true` if it does, or -`false` if it doesn't. - -> The actual `equal` matcher function does not match when either - `actual` or `expected` are nil; the example above has been edited for - brevity. - -Since matchers are just Swift functions, you can define them anywhere: -at the top of your test file, in a file shared by all of your tests, or -in an Xcode project you distribute to others. - -> If you write a matcher you think everyone can use, consider adding it - to Nimble's built-in set of matchers by sending a pull request! Or - distribute it yourself via GitHub. - -For examples of how to write your own matchers, just check out the -[`Matchers` directory](https://github.com/Quick/Nimble/tree/master/Sources/Nimble/Matchers) -to see how Nimble's built-in set of matchers are implemented. You can -also check out the tips below. - -## Lazy Evaluation - -`actualExpression` is a lazy, memoized closure around the value provided to the -`expect` function. The expression can either be a closure or a value directly -passed to `expect(...)`. In order to determine whether that value matches, -custom matchers should call `actualExpression.evaluate()`: - -```swift -// Swift - -public func beNil() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be nil" - return actualExpression.evaluate() == nil - } -} -``` - -In the above example, `actualExpression` is not `nil`--it is a closure -that returns a value. The value it returns, which is accessed via the -`evaluate()` method, may be `nil`. If that value is `nil`, the `beNil` -matcher function returns `true`, indicating that the expectation passed. - -Use `expression.isClosure` to determine if the expression will be invoking -a closure to produce its value. - -## Type Checking via Swift Generics - -Using Swift's generics, matchers can constrain the type of the actual value -passed to the `expect` function by modifying the return type. - -For example, the following matcher, `haveDescription`, only accepts actual -values that implement the `Printable` protocol. It checks their `description` -against the one provided to the matcher function, and passes if they are the same: - -```swift -// Swift - -public func haveDescription(description: String) -> MatcherFunc { - return MatcherFunc { actual, failureMessage in - return actual.evaluate().description == description - } -} -``` - -## Customizing Failure Messages - -By default, Nimble outputs the following failure message when an -expectation fails: - -``` -expected to match, got <\(actual)> -``` - -You can customize this message by modifying the `failureMessage` struct -from within your `MatcherFunc` closure. To change the verb "match" to -something else, update the `postfixMessage` property: - -```swift -// Swift - -// Outputs: expected to be under the sea, got <\(actual)> -failureMessage.postfixMessage = "be under the sea" -``` - -You can change how the `actual` value is displayed by updating -`failureMessage.actualValue`. Or, to remove it altogether, set it to -`nil`: - -```swift -// Swift - -// Outputs: expected to be under the sea -failureMessage.actualValue = nil -failureMessage.postfixMessage = "be under the sea" -``` - -## Supporting Objective-C - -To use a custom matcher written in Swift from Objective-C, you'll have -to extend the `NMBObjCMatcher` class, adding a new class method for your -custom matcher. The example below defines the class method -`+[NMBObjCMatcher beNilMatcher]`: - -```swift -// Swift - -extension NMBObjCMatcher { - public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualBlock, failureMessage, location in - let block = ({ actualBlock() as NSObject? }) - let expr = Expression(expression: block, location: location) - return beNil().matches(expr, failureMessage: failureMessage) - } - } -} -``` - -The above allows you to use the matcher from Objective-C: - -```objc -// Objective-C - -expect(actual).to([NMBObjCMatcher beNilMatcher]()); -``` - -To make the syntax easier to use, define a C function that calls the -class method: - -```objc -// Objective-C - -FOUNDATION_EXPORT id beNil() { - return [NMBObjCMatcher beNilMatcher]; -} -``` - -### Properly Handling `nil` in Objective-C Matchers - -When supporting Objective-C, make sure you handle `nil` appropriately. -Like [Cedar](https://github.com/pivotal/cedar/issues/100), -**most matchers do not match with nil**. This is to bring prevent test -writers from being surprised by `nil` values where they did not expect -them. - -Nimble provides the `beNil` matcher function for test writer that want -to make expectations on `nil` objects: - -```objc -// Objective-C - -expect(nil).to(equal(nil)); // fails -expect(nil).to(beNil()); // passes -``` - -If your matcher does not want to match with nil, you use `NonNilMatcherFunc` -and the `canMatchNil` constructor on `NMBObjCMatcher`. Using both types will -automatically generate expected value failure messages when they're nil. - -```swift - -public func beginWith(startingElement: T) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingElement)>" - if let actualValue = actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - return actualGenerator.next() == startingElement - } - return false - } -} - -extension NMBObjCMatcher { - public class func beginWithMatcher(expected: AnyObject) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = actualExpression.evaluate() - let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return beginWith(expected).matches(expr, failureMessage: failureMessage) - } - } -} -``` - -# Installing Nimble - -> Nimble can be used on its own, or in conjunction with its sister - project, [Quick](https://github.com/Quick/Quick). To install both - Quick and Nimble, follow [the installation instructions in the Quick - README](https://github.com/Quick/Quick#how-to-install-quick). - -Nimble can currently be installed in one of two ways: using CocoaPods, or with -git submodules. - -## Installing Nimble as a Submodule - -To use Nimble as a submodule to test your macOS, iOS or tvOS applications, follow -these 4 easy steps: - -1. Clone the Nimble repository -2. Add Nimble.xcodeproj to the Xcode workspace for your project -3. Link Nimble.framework to your test target -4. Start writing expectations! - -For more detailed instructions on each of these steps, -read [How to Install Quick](https://github.com/Quick/Quick#how-to-install-quick). -Ignore the steps involving adding Quick to your project in order to -install just Nimble. - -## Installing Nimble via CocoaPods - -To use Nimble in CocoaPods to test your macOS, iOS or tvOS applications, add -Nimble to your podfile and add the ```use_frameworks!``` line to enable Swift -support for CocoaPods. - -```ruby -platform :ios, '8.0' - -source 'https://github.com/CocoaPods/Specs.git' - -# Whatever pods you need for your app go here - -target 'YOUR_APP_NAME_HERE_Tests', :exclusive => true do - use_frameworks! - pod 'Nimble', '~> 4.0.0' -end -``` - -Finally run `pod install`. - -## Using Nimble without XCTest - -Nimble is integrated with XCTest to allow it work well when used in Xcode test -bundles, however it can also be used in a standalone app. After installing -Nimble using one of the above methods, there are two additional steps required -to make this work. - -1. Create a custom assertion handler and assign an instance of it to the - global `NimbleAssertionHandler` variable. For example: - -```swift -class MyAssertionHandler : AssertionHandler { - func assert(assertion: Bool, message: FailureMessage, location: SourceLocation) { - if (!assertion) { - print("Expectation failed: \(message.stringValue)") - } - } -} -``` -```swift -// Somewhere before you use any assertions -NimbleAssertionHandler = MyAssertionHandler() -``` - -2. Add a post-build action to fix an issue with the Swift XCTest support - library being unnecessarily copied into your app - * Edit your scheme in Xcode, and navigate to Build -> Post-actions - * Click the "+" icon and select "New Run Script Action" - * Open the "Provide build settings from" dropdown and select your target - * Enter the following script contents: -``` -rm "${SWIFT_STDLIB_TOOL_DESTINATION_DIR}/libswiftXCTest.dylib" -``` - -You can now use Nimble assertions in your code and handle failures as you see -fit. diff --git a/Example/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift b/Example/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift deleted file mode 100644 index 2e58fdf..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Adapters/AdapterProtocols.swift +++ /dev/null @@ -1,17 +0,0 @@ -import Foundation - -/// Protocol for the assertion handler that Nimble uses for all expectations. -public protocol AssertionHandler { - func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) -} - -/// Global backing interface for assertions that Nimble creates. -/// Defaults to a private test handler that passes through to XCTest. -/// -/// If XCTest is not available, you must assign your own assertion handler -/// before using any matchers, otherwise Nimble will abort the program. -/// -/// @see AssertionHandler -public var NimbleAssertionHandler: AssertionHandler = { () -> AssertionHandler in - return isXCTestAvailable() ? NimbleXCTestHandler() : NimbleXCTestUnavailableHandler() -}() diff --git a/Example/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift b/Example/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift deleted file mode 100644 index 2e30f61..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Adapters/AssertionDispatcher.swift +++ /dev/null @@ -1,20 +0,0 @@ - -/// AssertionDispatcher allows multiple AssertionHandlers to receive -/// assertion messages. -/// -/// @warning Does not fully dispatch if one of the handlers raises an exception. -/// This is possible with XCTest-based assertion handlers. -/// -public class AssertionDispatcher: AssertionHandler { - let handlers: [AssertionHandler] - - public init(handlers: [AssertionHandler]) { - self.handlers = handlers - } - - public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - for handler in handlers { - handler.assert(assertion, message: message, location: location) - } - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift b/Example/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift deleted file mode 100644 index 7d0bab2..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Adapters/AssertionRecorder.swift +++ /dev/null @@ -1,100 +0,0 @@ -import Foundation - -/// A data structure that stores information about an assertion when -/// AssertionRecorder is set as the Nimble assertion handler. -/// -/// @see AssertionRecorder -/// @see AssertionHandler -public struct AssertionRecord: CustomStringConvertible { - /// Whether the assertion succeeded or failed - public let success: Bool - /// The failure message the assertion would display on failure. - public let message: FailureMessage - /// The source location the expectation occurred on. - public let location: SourceLocation - - public var description: String { - return "AssertionRecord { success=\(success), message='\(message.stringValue)', location=\(location) }" - } -} - -/// An AssertionHandler that silently records assertions that Nimble makes. -/// This is useful for testing failure messages for matchers. -/// -/// @see AssertionHandler -public class AssertionRecorder : AssertionHandler { - /// All the assertions that were captured by this recorder - public var assertions = [AssertionRecord]() - - public init() {} - - public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - assertions.append( - AssertionRecord( - success: assertion, - message: message, - location: location)) - } -} - -/// Allows you to temporarily replace the current Nimble assertion handler with -/// the one provided for the scope of the closure. -/// -/// Once the closure finishes, then the original Nimble assertion handler is restored. -/// -/// @see AssertionHandler -public func withAssertionHandler(_ tempAssertionHandler: AssertionHandler, closure: @escaping () throws -> Void) { - let environment = NimbleEnvironment.activeInstance - let oldRecorder = environment.assertionHandler - let capturer = NMBExceptionCapture(handler: nil, finally: ({ - environment.assertionHandler = oldRecorder - })) - environment.assertionHandler = tempAssertionHandler - capturer.tryBlock { - try! closure() - } -} - -/// Captures expectations that occur in the given closure. Note that all -/// expectations will still go through to the default Nimble handler. -/// -/// This can be useful if you want to gather information about expectations -/// that occur within a closure. -/// -/// @param silently expectations are no longer send to the default Nimble -/// assertion handler when this is true. Defaults to false. -/// -/// @see gatherFailingExpectations -public func gatherExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { - let previousRecorder = NimbleEnvironment.activeInstance.assertionHandler - let recorder = AssertionRecorder() - let handlers: [AssertionHandler] - - if silently { - handlers = [recorder] - } else { - handlers = [recorder, previousRecorder] - } - - let dispatcher = AssertionDispatcher(handlers: handlers) - withAssertionHandler(dispatcher, closure: closure) - return recorder.assertions -} - -/// Captures failed expectations that occur in the given closure. Note that all -/// expectations will still go through to the default Nimble handler. -/// -/// This can be useful if you want to gather information about failed -/// expectations that occur within a closure. -/// -/// @param silently expectations are no longer send to the default Nimble -/// assertion handler when this is true. Defaults to false. -/// -/// @see gatherExpectations -/// @see raiseException source for an example use case. -public func gatherFailingExpectations(silently: Bool = false, closure: @escaping () -> Void) -> [AssertionRecord] { - let assertions = gatherExpectations(silently: silently, closure: closure) - return assertions.filter { assertion in - !assertion.success - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift b/Example/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift deleted file mode 100644 index 47d4eed..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Adapters/NMBExpectation.swift +++ /dev/null @@ -1,131 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) - -internal struct ObjCMatcherWrapper : Matcher { - let matcher: NMBMatcher - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - return matcher.matches( - ({ try! actualExpression.evaluate() }), - failureMessage: failureMessage, - location: actualExpression.location) - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - return matcher.doesNotMatch( - ({ try! actualExpression.evaluate() }), - failureMessage: failureMessage, - location: actualExpression.location) - } -} - -// Equivalent to Expectation, but for Nimble's Objective-C interface -public class NMBExpectation : NSObject { - internal let _actualBlock: () -> NSObject! - internal var _negative: Bool - internal let _file: FileString - internal let _line: UInt - internal var _timeout: TimeInterval = 1.0 - - public init(actualBlock: @escaping () -> NSObject!, negative: Bool, file: FileString, line: UInt) { - self._actualBlock = actualBlock - self._negative = negative - self._file = file - self._line = line - } - - private var expectValue: Expectation { - return expect(_file, line: _line){ - self._actualBlock() as NSObject? - } - } - - public var withTimeout: (TimeInterval) -> NMBExpectation { - return ({ timeout in self._timeout = timeout - return self - }) - } - - public var to: (NMBMatcher) -> Void { - return ({ matcher in - self.expectValue.to(ObjCMatcherWrapper(matcher: matcher)) - }) - } - - public var toWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in - self.expectValue.to(ObjCMatcherWrapper(matcher: matcher), description: description) - }) - } - - public var toNot: (NMBMatcher) -> Void { - return ({ matcher in - self.expectValue.toNot( - ObjCMatcherWrapper(matcher: matcher) - ) - }) - } - - public var toNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in - self.expectValue.toNot( - ObjCMatcherWrapper(matcher: matcher), description: description - ) - }) - } - - public var notTo: (NMBMatcher) -> Void { return toNot } - - public var notToWithDescription: (NMBMatcher, String) -> Void { return toNotWithDescription } - - public var toEventually: (NMBMatcher) -> Void { - return ({ matcher in - self.expectValue.toEventually( - ObjCMatcherWrapper(matcher: matcher), - timeout: self._timeout, - description: nil - ) - }) - } - - public var toEventuallyWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in - self.expectValue.toEventually( - ObjCMatcherWrapper(matcher: matcher), - timeout: self._timeout, - description: description - ) - }) - } - - public var toEventuallyNot: (NMBMatcher) -> Void { - return ({ matcher in - self.expectValue.toEventuallyNot( - ObjCMatcherWrapper(matcher: matcher), - timeout: self._timeout, - description: nil - ) - }) - } - - public var toEventuallyNotWithDescription: (NMBMatcher, String) -> Void { - return ({ matcher, description in - self.expectValue.toEventuallyNot( - ObjCMatcherWrapper(matcher: matcher), - timeout: self._timeout, - description: description - ) - }) - } - - public var toNotEventually: (NMBMatcher) -> Void { return toEventuallyNot } - - public var toNotEventuallyWithDescription: (NMBMatcher, String) -> Void { return toEventuallyNotWithDescription } - - public class func failWithMessage(_ message: String, file: FileString, line: UInt) { - fail(message, location: SourceLocation(file: file, line: line)) - } -} - -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift b/Example/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift deleted file mode 100644 index c609f69..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Adapters/NMBObjCMatcher.swift +++ /dev/null @@ -1,81 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) - -public typealias MatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage) -> Bool -public typealias FullMatcherBlock = (_ actualExpression: Expression, _ failureMessage: FailureMessage, _ shouldNotMatch: Bool) -> Bool - -public class NMBObjCMatcher : NSObject, NMBMatcher { - let _match: MatcherBlock - let _doesNotMatch: MatcherBlock - let canMatchNil: Bool - - public init(canMatchNil: Bool, matcher: @escaping MatcherBlock, notMatcher: @escaping MatcherBlock) { - self.canMatchNil = canMatchNil - self._match = matcher - self._doesNotMatch = notMatcher - } - - public convenience init(matcher: @escaping MatcherBlock) { - self.init(canMatchNil: true, matcher: matcher) - } - - public convenience init(canMatchNil: Bool, matcher: @escaping MatcherBlock) { - self.init(canMatchNil: canMatchNil, matcher: matcher, notMatcher: ({ actualExpression, failureMessage in - return !matcher(actualExpression, failureMessage) - })) - } - - public convenience init(matcher: @escaping FullMatcherBlock) { - self.init(canMatchNil: true, matcher: matcher) - } - - public convenience init(canMatchNil: Bool, matcher: @escaping FullMatcherBlock) { - self.init(canMatchNil: canMatchNil, matcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, false) - }), notMatcher: ({ actualExpression, failureMessage in - return matcher(actualExpression, failureMessage, true) - })) - } - - private func canMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - do { - if !canMatchNil { - if try actualExpression.evaluate() == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - return false - } - } - } catch let error { - failureMessage.actualValue = "an unexpected error thrown: \(error)" - return false - } - return true - } - - public func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let expr = Expression(expression: actualBlock, location: location) - let result = _match( - expr, - failureMessage) - if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { - return result - } else { - return false - } - } - - public func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let expr = Expression(expression: actualBlock, location: location) - let result = _doesNotMatch( - expr, - failureMessage) - if self.canMatch(Expression(expression: actualBlock, location: location), failureMessage: failureMessage) { - return result - } else { - return false - } - } -} - -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift b/Example/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift deleted file mode 100644 index 5434aaf..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Adapters/NimbleEnvironment.swift +++ /dev/null @@ -1,45 +0,0 @@ -import Foundation - -/// "Global" state of Nimble is stored here. Only DSL functions should access / be aware of this -/// class' existance -internal class NimbleEnvironment { - static var activeInstance: NimbleEnvironment { - get { - let env = Thread.current.threadDictionary["NimbleEnvironment"] - if let env = env as? NimbleEnvironment { - return env - } else { - let newEnv = NimbleEnvironment() - self.activeInstance = newEnv - return newEnv - } - } - set { - Thread.current.threadDictionary["NimbleEnvironment"] = newValue - } - } - - // TODO: eventually migrate the global to this environment value - var assertionHandler: AssertionHandler { - get { return NimbleAssertionHandler } - set { NimbleAssertionHandler = newValue } - } - -#if _runtime(_ObjC) - var awaiter: Awaiter - - init() { - let timeoutQueue: DispatchQueue - if #available(OSX 10.10, *) { - timeoutQueue = DispatchQueue.global(qos: .userInitiated) - } else { - timeoutQueue = DispatchQueue.global(priority: .high) - } - - awaiter = Awaiter( - waitLock: AssertionWaitLock(), - asyncQueue: .main, - timeoutQueue: timeoutQueue) - } -#endif -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift b/Example/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift deleted file mode 100644 index 1aba8bc..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Adapters/NimbleXCTestHandler.swift +++ /dev/null @@ -1,77 +0,0 @@ -import Foundation -import XCTest - -/// Default handler for Nimble. This assertion handler passes failures along to -/// XCTest. -public class NimbleXCTestHandler : AssertionHandler { - public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - if !assertion { - recordFailure("\(message.stringValue)\n", location: location) - } - } -} - -/// Alternative handler for Nimble. This assertion handler passes failures along -/// to XCTest by attempting to reduce the failure message size. -public class NimbleShortXCTestHandler: AssertionHandler { - public func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - if !assertion { - let msg: String - if let actual = message.actualValue { - msg = "got: \(actual) \(message.postfixActual)" - } else { - msg = "expected \(message.to) \(message.postfixMessage)" - } - recordFailure("\(msg)\n", location: location) - } - } -} - -/// Fallback handler in case XCTest is unavailable. This assertion handler will abort -/// the program if it is invoked. -class NimbleXCTestUnavailableHandler : AssertionHandler { - func assert(_ assertion: Bool, message: FailureMessage, location: SourceLocation) { - fatalError("XCTest is not available and no custom assertion handler was configured. Aborting.") - } -} - -#if _runtime(_ObjC) - /// Helper class providing access to the currently executing XCTestCase instance, if any -@objc final internal class CurrentTestCaseTracker: NSObject, XCTestObservation { - @objc static let sharedInstance = CurrentTestCaseTracker() - - private(set) var currentTestCase: XCTestCase? - - @objc func testCaseWillStart(_ testCase: XCTestCase) { - currentTestCase = testCase - } - - @objc func testCaseDidFinish(_ testCase: XCTestCase) { - currentTestCase = nil - } -} -#endif - - -func isXCTestAvailable() -> Bool { -#if _runtime(_ObjC) - // XCTest is weakly linked and so may not be present - return NSClassFromString("XCTestCase") != nil -#else - return true -#endif -} - -private func recordFailure(_ message: String, location: SourceLocation) { -#if _runtime(_ObjC) - if let testCase = CurrentTestCaseTracker.sharedInstance.currentTestCase { - testCase.recordFailure(withDescription: message, inFile: location.file, atLine: location.line, expected: true) - } else { - let msg = "Attempted to report a test failure to XCTest while no test case was running. " + - "The failure was:\n\"\(message)\"\nIt occurred at: \(location.file):\(location.line)" - NSException(name: .internalInconsistencyException, reason: msg, userInfo: nil).raise() - } -#else - XCTFail("\(message)\n", file: location.file, line: location.line) -#endif -} diff --git a/Example/Pods/Nimble/Sources/Nimble/DSL+Wait.swift b/Example/Pods/Nimble/Sources/Nimble/DSL+Wait.swift deleted file mode 100644 index fa5a10f..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/DSL+Wait.swift +++ /dev/null @@ -1,93 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) -private enum ErrorResult { - case exception(NSException) - case error(Error) - case none -} - -/// Only classes, protocols, methods, properties, and subscript declarations can be -/// bridges to Objective-C via the @objc keyword. This class encapsulates callback-style -/// asynchronous waiting logic so that it may be called from Objective-C and Swift. -internal class NMBWait: NSObject { - internal class func until( - timeout: TimeInterval, - file: FileString = #file, - line: UInt = #line, - action: @escaping (@escaping () -> Void) -> Void) -> Void { - return throwableUntil(timeout: timeout, file: file, line: line) { done in - action(done) - } - } - - // Using a throwable closure makes this method not objc compatible. - internal class func throwableUntil( - timeout: TimeInterval, - file: FileString = #file, - line: UInt = #line, - action: @escaping (@escaping () -> Void) throws -> Void) -> Void { - let awaiter = NimbleEnvironment.activeInstance.awaiter - let leeway = timeout / 2.0 - let result = awaiter.performBlock { (done: @escaping (ErrorResult) -> Void) throws -> Void in - DispatchQueue.main.async { - let capture = NMBExceptionCapture( - handler: ({ exception in - done(.exception(exception)) - }), - finally: ({ }) - ) - capture.tryBlock { - do { - try action() { - done(.none) - } - } catch let e { - done(.error(e)) - } - } - } - }.timeout(timeout, forcefullyAbortTimeout: leeway).wait("waitUntil(...)", file: file, line: line) - - switch result { - case .incomplete: internalError("Reached .incomplete state for waitUntil(...).") - case .blockedRunLoop: - fail(blockedRunLoopErrorMessageFor("-waitUntil()", leeway: leeway), - file: file, line: line) - case .timedOut: - let pluralize = (timeout == 1 ? "" : "s") - fail("Waited more than \(timeout) second\(pluralize)", file: file, line: line) - case let .raisedException(exception): - fail("Unexpected exception raised: \(exception)") - case let .errorThrown(error): - fail("Unexpected error thrown: \(error)") - case .completed(.exception(let exception)): - fail("Unexpected exception raised: \(exception)") - case .completed(.error(let error)): - fail("Unexpected error thrown: \(error)") - case .completed(.none): // success - break - } - } - - @objc(untilFile:line:action:) - internal class func until(_ file: FileString = #file, line: UInt = #line, action: @escaping (() -> Void) -> Void) -> Void { - until(timeout: 1, file: file, line: line, action: action) - } -} - -internal func blockedRunLoopErrorMessageFor(_ fnName: String, leeway: TimeInterval) -> String { - return "\(fnName) timed out but was unable to run the timeout handler because the main thread is unresponsive (\(leeway) seconds is allow after the wait times out). Conditions that may cause this include processing blocking IO on the main thread, calls to sleep(), deadlocks, and synchronous IPC. Nimble forcefully stopped run loop which may cause future failures in test run." -} - -/// Wait asynchronously until the done closure is called or the timeout has been reached. -/// -/// @discussion -/// Call the done() closure to indicate the waiting has completed. -/// -/// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function -/// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. -public func waitUntil(timeout: TimeInterval = 1, file: FileString = #file, line: UInt = #line, action: @escaping (@escaping () -> Void) -> Void) -> Void { - NMBWait.until(timeout: timeout, file: file, line: line, action: action) -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/DSL.swift b/Example/Pods/Nimble/Sources/Nimble/DSL.swift deleted file mode 100644 index 7ebd684..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/DSL.swift +++ /dev/null @@ -1,64 +0,0 @@ -import Foundation - -/// Make an expectation on a given actual value. The value given is lazily evaluated. -public func expect(_ expression: @autoclosure @escaping () throws -> T?, file: FileString = #file, line: UInt = #line) -> Expectation { - return Expectation( - expression: Expression( - expression: expression, - location: SourceLocation(file: file, line: line), - isClosure: true)) -} - -/// Make an expectation on a given actual value. The closure is lazily invoked. -public func expect(_ file: FileString = #file, line: UInt = #line, expression: @escaping () throws -> T?) -> Expectation { - return Expectation( - expression: Expression( - expression: expression, - location: SourceLocation(file: file, line: line), - isClosure: true)) -} - -/// Always fails the test with a message and a specified location. -public func fail(_ message: String, location: SourceLocation) { - let handler = NimbleEnvironment.activeInstance.assertionHandler - handler.assert(false, message: FailureMessage(stringValue: message), location: location) -} - -/// Always fails the test with a message. -public func fail(_ message: String, file: FileString = #file, line: UInt = #line) { - fail(message, location: SourceLocation(file: file, line: line)) -} - -/// Always fails the test. -public func fail(_ file: FileString = #file, line: UInt = #line) { - fail("fail() always fails", file: file, line: line) -} - -/// Like Swift's precondition(), but raises NSExceptions instead of sigaborts -internal func nimblePrecondition( - _ expr: @autoclosure() -> Bool, - _ name: @autoclosure() -> String, - _ message: @autoclosure() -> String, - file: StaticString = #file, - line: UInt = #line) { - let result = expr() - if !result { -#if _runtime(_ObjC) - let e = NSException( - name: NSExceptionName(name()), - reason: message(), - userInfo: nil) - e.raise() -#else - preconditionFailure("\(name()) - \(message())", file: file, line: line) -#endif - } -} - -internal func internalError(_ msg: String, file: FileString = #file, line: UInt = #line) -> Never { - fatalError( - "Nimble Bug Found: \(msg) at \(file):\(line).\n" + - "Please file a bug to Nimble: https://github.com/Quick/Nimble/issues with the " + - "code snippet that caused this error." - ) -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Expectation.swift b/Example/Pods/Nimble/Sources/Nimble/Expectation.swift deleted file mode 100644 index 16d7c3b..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Expectation.swift +++ /dev/null @@ -1,76 +0,0 @@ -import Foundation - -internal func expressionMatches(_ expression: Expression, matcher: U, to: String, description: String?) -> (Bool, FailureMessage) - where U: Matcher, U.ValueType == T -{ - let msg = FailureMessage() - msg.userDescription = description - msg.to = to - do { - let pass = try matcher.matches(expression, failureMessage: msg) - if msg.actualValue == "" { - msg.actualValue = "<\(stringify(try expression.evaluate()))>" - } - return (pass, msg) - } catch let error { - msg.actualValue = "an unexpected error thrown: <\(error)>" - return (false, msg) - } -} - -internal func expressionDoesNotMatch(_ expression: Expression, matcher: U, toNot: String, description: String?) -> (Bool, FailureMessage) - where U: Matcher, U.ValueType == T -{ - let msg = FailureMessage() - msg.userDescription = description - msg.to = toNot - do { - let pass = try matcher.doesNotMatch(expression, failureMessage: msg) - if msg.actualValue == "" { - msg.actualValue = "<\(stringify(try expression.evaluate()))>" - } - return (pass, msg) - } catch let error { - msg.actualValue = "an unexpected error thrown: <\(error)>" - return (false, msg) - } -} - -public struct Expectation { - - public let expression: Expression - - public func verify(_ pass: Bool, _ message: FailureMessage) { - let handler = NimbleEnvironment.activeInstance.assertionHandler - handler.assert(pass, message: message, location: expression.location) - } - - /// Tests the actual value using a matcher to match. - public func to(_ matcher: U, description: String? = nil) - where U: Matcher, U.ValueType == T - { - let (pass, msg) = expressionMatches(expression, matcher: matcher, to: "to", description: description) - verify(pass, msg) - } - - /// Tests the actual value using a matcher to not match. - public func toNot(_ matcher: U, description: String? = nil) - where U: Matcher, U.ValueType == T - { - let (pass, msg) = expressionDoesNotMatch(expression, matcher: matcher, toNot: "to not", description: description) - verify(pass, msg) - } - - /// Tests the actual value using a matcher to not match. - /// - /// Alias to toNot(). - public func notTo(_ matcher: U, description: String? = nil) - where U: Matcher, U.ValueType == T - { - toNot(matcher, description: description) - } - - // see: - // - AsyncMatcherWrapper for extension - // - NMBExpectation for Objective-C interface -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Expression.swift b/Example/Pods/Nimble/Sources/Nimble/Expression.swift deleted file mode 100644 index 8ba53e4..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Expression.swift +++ /dev/null @@ -1,90 +0,0 @@ -import Foundation - -// Memoizes the given closure, only calling the passed -// closure once; even if repeat calls to the returned closure -internal func memoizedClosure(_ closure: @escaping () throws -> T) -> (Bool) throws -> T { - var cache: T? - return ({ withoutCaching in - if (withoutCaching || cache == nil) { - cache = try closure() - } - return cache! - }) -} - -/// Expression represents the closure of the value inside expect(...). -/// Expressions are memoized by default. This makes them safe to call -/// evaluate() multiple times without causing a re-evaluation of the underlying -/// closure. -/// -/// @warning Since the closure can be any code, Objective-C code may choose -/// to raise an exception. Currently, Expression does not memoize -/// exception raising. -/// -/// This provides a common consumable API for matchers to utilize to allow -/// Nimble to change internals to how the captured closure is managed. -public struct Expression { - internal let _expression: (Bool) throws -> T? - internal let _withoutCaching: Bool - public let location: SourceLocation - public let isClosure: Bool - - /// Creates a new expression struct. Normally, expect(...) will manage this - /// creation process. The expression is memoized. - /// - /// @param expression The closure that produces a given value. - /// @param location The source location that this closure originates from. - /// @param isClosure A bool indicating if the captured expression is a - /// closure or internally produced closure. Some matchers - /// may require closures. For example, toEventually() - /// requires an explicit closure. This gives Nimble - /// flexibility if @autoclosure behavior changes between - /// Swift versions. Nimble internals always sets this true. - public init(expression: @escaping () throws -> T?, location: SourceLocation, isClosure: Bool = true) { - self._expression = memoizedClosure(expression) - self.location = location - self._withoutCaching = false - self.isClosure = isClosure - } - - /// Creates a new expression struct. Normally, expect(...) will manage this - /// creation process. - /// - /// @param expression The closure that produces a given value. - /// @param location The source location that this closure originates from. - /// @param withoutCaching Indicates if the struct should memoize the given - /// closure's result. Subsequent evaluate() calls will - /// not call the given closure if this is true. - /// @param isClosure A bool indicating if the captured expression is a - /// closure or internally produced closure. Some matchers - /// may require closures. For example, toEventually() - /// requires an explicit closure. This gives Nimble - /// flexibility if @autoclosure behavior changes between - /// Swift versions. Nimble internals always sets this true. - public init(memoizedExpression: @escaping (Bool) throws -> T?, location: SourceLocation, withoutCaching: Bool, isClosure: Bool = true) { - self._expression = memoizedExpression - self.location = location - self._withoutCaching = withoutCaching - self.isClosure = isClosure - } - - /// Returns a new Expression from the given expression. Identical to a map() - /// on this type. This should be used only to typecast the Expression's - /// closure value. - /// - /// The returned expression will preserve location and isClosure. - /// - /// @param block The block that can cast the current Expression value to a - /// new type. - public func cast(_ block: @escaping (T?) throws -> U?) -> Expression { - return Expression(expression: ({ try block(self.evaluate()) }), location: self.location, isClosure: self.isClosure) - } - - public func evaluate() throws -> T? { - return try self._expression(_withoutCaching) - } - - public func withoutCaching() -> Expression { - return Expression(memoizedExpression: self._expression, location: location, withoutCaching: true, isClosure: isClosure) - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/FailureMessage.swift b/Example/Pods/Nimble/Sources/Nimble/FailureMessage.swift deleted file mode 100644 index 2d245e5..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/FailureMessage.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation - -/// Encapsulates the failure message that matchers can report to the end user. -/// -/// This is shared state between Nimble and matchers that mutate this value. -public class FailureMessage: NSObject { - public var expected: String = "expected" - public var actualValue: String? = "" // empty string -> use default; nil -> exclude - public var to: String = "to" - public var postfixMessage: String = "match" - public var postfixActual: String = "" - /// An optional message that will be appended as a new line and provides additional details - /// about the failure. This message will only be visible in the issue navigator / in logs but - /// not directly in the source editor since only a single line is presented there. - public var extendedMessage: String? = nil - public var userDescription: String? = nil - - public var stringValue: String { - get { - if let value = _stringValueOverride { - return value - } else { - return computeStringValue() - } - } - set { - _stringValueOverride = newValue - } - } - - internal var _stringValueOverride: String? - - public override init() { - } - - public init(stringValue: String) { - _stringValueOverride = stringValue - } - - internal func stripNewlines(_ str: String) -> String { - let whitespaces = CharacterSet.whitespacesAndNewlines - return str - .components(separatedBy: "\n") - .map { line in line.trimmingCharacters(in: whitespaces) } - .joined(separator: "") - } - - internal func computeStringValue() -> String { - var value = "\(expected) \(to) \(postfixMessage)" - if let actualValue = actualValue { - value = "\(expected) \(to) \(postfixMessage), got \(actualValue)\(postfixActual)" - } - value = stripNewlines(value) - - if let extendedMessage = extendedMessage { - value += "\n\(stripNewlines(extendedMessage))" - } - - if let userDescription = userDescription { - return "\(userDescription)\n\(value)" - } - - return value - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift deleted file mode 100644 index 3a9258d..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/AllPass.swift +++ /dev/null @@ -1,100 +0,0 @@ -import Foundation - -public func allPass - (_ passFunc: @escaping (T?) -> Bool) -> NonNilMatcherFunc - where U: Sequence, U.Iterator.Element == T -{ - return allPass("pass a condition", passFunc) -} - -public func allPass - (_ passName: String, _ passFunc: @escaping (T?) -> Bool) -> NonNilMatcherFunc - where U: Sequence, U.Iterator.Element == T -{ - return createAllPassMatcher() { - expression, failureMessage in - failureMessage.postfixMessage = passName - return passFunc(try expression.evaluate()) - } -} - -public func allPass - (_ matcher: V) -> NonNilMatcherFunc - where U: Sequence, V: Matcher, U.Iterator.Element == V.ValueType -{ - return createAllPassMatcher() { - try matcher.matches($0, failureMessage: $1) - } -} - -private func createAllPassMatcher - (_ elementEvaluator: @escaping (Expression, FailureMessage) throws -> Bool) -> NonNilMatcherFunc - where U: Sequence, U.Iterator.Element == T -{ - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.actualValue = nil - if let actualValue = try actualExpression.evaluate() { - for currentElement in actualValue { - let exp = Expression( - expression: {currentElement}, location: actualExpression.location) - if try !elementEvaluator(exp, failureMessage) { - failureMessage.postfixMessage = - "all \(failureMessage.postfixMessage)," - + " but failed first at element <\(stringify(currentElement))>" - + " in <\(stringify(actualValue))>" - return false - } - } - failureMessage.postfixMessage = "all \(failureMessage.postfixMessage)" - } else { - failureMessage.postfixMessage = "all pass (use beNil() to match nils)" - return false - } - - return true - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func allPassMatcher(_ matcher: NMBObjCMatcher) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() - var nsObjects = [NSObject]() - - var collectionIsUsable = true - if let value = actualValue as? NSFastEnumeration { - let generator = NSFastEnumerationIterator(value) - while let obj = generator.next() { - if let nsObject = obj as? NSObject { - nsObjects.append(nsObject) - } else { - collectionIsUsable = false - break - } - } - } else { - collectionIsUsable = false - } - - if !collectionIsUsable { - failureMessage.postfixMessage = - "allPass only works with NSFastEnumeration (NSArray, NSSet, ...) of NSObjects" - failureMessage.expected = "" - failureMessage.to = "" - return false - } - - let expr = Expression(expression: ({ nsObjects }), location: location) - let elementEvaluator: (Expression, FailureMessage) -> Bool = { - expression, failureMessage in - return matcher.matches( - {try! expression.evaluate()}, failureMessage: failureMessage, location: expr.location) - } - return try! createAllPassMatcher(elementEvaluator).matches( - expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift deleted file mode 100644 index c028f5a..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/AsyncMatcherWrapper.swift +++ /dev/null @@ -1,148 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) - -public struct AsyncDefaults { - public static var Timeout: TimeInterval = 1 - public static var PollInterval: TimeInterval = 0.01 -} - -internal struct AsyncMatcherWrapper: Matcher - where U: Matcher, U.ValueType == T -{ - let fullMatcher: U - let timeoutInterval: TimeInterval - let pollInterval: TimeInterval - - init(fullMatcher: U, timeoutInterval: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval) { - self.fullMatcher = fullMatcher - self.timeoutInterval = timeoutInterval - self.pollInterval = pollInterval - } - - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let fnName = "expect(...).toEventually(...)" - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: fnName) { - try self.fullMatcher.matches(uncachedExpression, failureMessage: failureMessage) - } - switch (result) { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.actualValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.actualValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventually(...).") - } - } - - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) -> Bool { - let uncachedExpression = actualExpression.withoutCaching() - let result = pollBlock( - pollInterval: pollInterval, - timeoutInterval: timeoutInterval, - file: actualExpression.location.file, - line: actualExpression.location.line, - fnName: "expect(...).toEventuallyNot(...)") { - try self.fullMatcher.doesNotMatch(uncachedExpression, failureMessage: failureMessage) - } - switch (result) { - case let .completed(isSuccessful): return isSuccessful - case .timedOut: return false - case let .errorThrown(error): - failureMessage.actualValue = "an unexpected error thrown: <\(error)>" - return false - case let .raisedException(exception): - failureMessage.actualValue = "an unexpected exception thrown: <\(exception)>" - return false - case .blockedRunLoop: - failureMessage.postfixMessage += " (timed out, but main thread was unresponsive)." - return false - case .incomplete: - internalError("Reached .incomplete state for toEventuallyNot(...).") - } - } -} - -private let toEventuallyRequiresClosureError = FailureMessage(stringValue: "expect(...).toEventually(...) requires an explicit closure (eg - expect { ... }.toEventually(...) )\nSwift 1.2 @autoclosure behavior has changed in an incompatible way for Nimble to function") - - -extension Expectation { - /// Tests the actual value using a matcher to match by checking continuously - /// at each pollInterval until the timeout is reached. - /// - /// @discussion - /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function - /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) - where U: Matcher, U.ValueType == T - { - if expression.isClosure { - let (pass, msg) = expressionMatches( - expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), - to: "to eventually", - description: description - ) - verify(pass, msg) - } else { - verify(false, toEventuallyRequiresClosureError) - } - } - - /// Tests the actual value using a matcher to not match by checking - /// continuously at each pollInterval until the timeout is reached. - /// - /// @discussion - /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function - /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toEventuallyNot(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) - where U: Matcher, U.ValueType == T - { - if expression.isClosure { - let (pass, msg) = expressionDoesNotMatch( - expression, - matcher: AsyncMatcherWrapper( - fullMatcher: matcher, - timeoutInterval: timeout, - pollInterval: pollInterval), - toNot: "to eventually not", - description: description - ) - verify(pass, msg) - } else { - verify(false, toEventuallyRequiresClosureError) - } - } - - /// Tests the actual value using a matcher to not match by checking - /// continuously at each pollInterval until the timeout is reached. - /// - /// Alias of toEventuallyNot() - /// - /// @discussion - /// This function manages the main run loop (`NSRunLoop.mainRunLoop()`) while this function - /// is executing. Any attempts to touch the run loop may cause non-deterministic behavior. - public func toNotEventually(_ matcher: U, timeout: TimeInterval = AsyncDefaults.Timeout, pollInterval: TimeInterval = AsyncDefaults.PollInterval, description: String? = nil) - where U: Matcher, U.ValueType == T - { - return toEventuallyNot(matcher, timeout: timeout, pollInterval: pollInterval, description: description) - } -} - -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift deleted file mode 100644 index 99b8f8f..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeAKindOf.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) - -// A Nimble matcher that catches attempts to use beAKindOf with non Objective-C types -public func beAKindOf(_ expectedClass: Any) -> NonNilMatcherFunc { - return NonNilMatcherFunc {actualExpression, failureMessage in - failureMessage.stringValue = "beAKindOf only works on Objective-C types since" - + " the Swift compiler will automatically type check Swift-only types." - + " This expectation is redundant." - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is an instance of the given class. -/// @see beAnInstanceOf if you want to match against the exact class -public func beAKindOf(_ expectedClass: AnyClass) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - let instance = try actualExpression.evaluate() - if let validInstance = instance { - failureMessage.actualValue = "<\(String(describing: type(of: validInstance))) instance>" - } else { - failureMessage.actualValue = "" - } - failureMessage.postfixMessage = "be a kind of \(String(describing: expectedClass))" - return instance != nil && instance!.isKind(of: expectedClass) - } -} - -extension NMBObjCMatcher { - public class func beAKindOfMatcher(_ expected: AnyClass) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! beAKindOf(expected).matches(actualExpression, failureMessage: failureMessage) - } - } -} - -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift deleted file mode 100644 index 2298c78..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeAnInstanceOf.swift +++ /dev/null @@ -1,40 +0,0 @@ -import Foundation - -// A Nimble matcher that catches attempts to use beAnInstanceOf with non Objective-C types -public func beAnInstanceOf(_ expectedClass: Any) -> NonNilMatcherFunc { - return NonNilMatcherFunc {actualExpression, failureMessage in - failureMessage.stringValue = "beAnInstanceOf only works on Objective-C types since" - + " the Swift compiler will automatically type check Swift-only types." - + " This expectation is redundant." - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is an instance of the given class. -/// @see beAKindOf if you want to match against subclasses -public func beAnInstanceOf(_ expectedClass: AnyClass) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - let instance = try actualExpression.evaluate() - if let validInstance = instance { - failureMessage.actualValue = "<\(String(describing: type(of: validInstance))) instance>" - } else { - failureMessage.actualValue = "" - } - failureMessage.postfixMessage = "be an instance of \(String(describing: expectedClass))" -#if _runtime(_ObjC) - return instance != nil && instance!.isMember(of: expectedClass) -#else - return instance != nil && type(of: instance!) == expectedClass -#endif - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beAnInstanceOfMatcher(_ expected: AnyClass) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! beAnInstanceOf(expected).matches(actualExpression, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift deleted file mode 100644 index 48e9895..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeCloseTo.swift +++ /dev/null @@ -1,122 +0,0 @@ -import Foundation - -internal let DefaultDelta = 0.0001 - -internal func isCloseTo(_ actualValue: NMBDoubleConvertible?, expectedValue: NMBDoubleConvertible, delta: Double, failureMessage: FailureMessage) -> Bool { - failureMessage.postfixMessage = "be close to <\(stringify(expectedValue))> (within \(stringify(delta)))" - failureMessage.actualValue = "<\(stringify(actualValue))>" - return actualValue != nil && abs(actualValue!.doubleValue - expectedValue.doubleValue) < delta -} - -/// A Nimble matcher that succeeds when a value is close to another. This is used for floating -/// point values which can have imprecise results when doing arithmetic on them. -/// -/// @see equal -public func beCloseTo(_ expectedValue: Double, within delta: Double = DefaultDelta) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta, failureMessage: failureMessage) - } -} - -/// A Nimble matcher that succeeds when a value is close to another. This is used for floating -/// point values which can have imprecise results when doing arithmetic on them. -/// -/// @see equal -public func beCloseTo(_ expectedValue: NMBDoubleConvertible, within delta: Double = DefaultDelta) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - return isCloseTo(try actualExpression.evaluate(), expectedValue: expectedValue, delta: delta, failureMessage: failureMessage) - } -} - -#if _runtime(_ObjC) -public class NMBObjCBeCloseToMatcher : NSObject, NMBMatcher { - var _expected: NSNumber - var _delta: CDouble - init(expected: NSNumber, within: CDouble) { - _expected = expected - _delta = within - } - - public func matches(_ actualExpression: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let actualBlock: () -> NMBDoubleConvertible? = ({ - return actualExpression() as? NMBDoubleConvertible - }) - let expr = Expression(expression: actualBlock, location: location) - let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.matches(expr, failureMessage: failureMessage) - } - - public func doesNotMatch(_ actualExpression: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let actualBlock: () -> NMBDoubleConvertible? = ({ - return actualExpression() as? NMBDoubleConvertible - }) - let expr = Expression(expression: actualBlock, location: location) - let matcher = beCloseTo(self._expected, within: self._delta) - return try! matcher.doesNotMatch(expr, failureMessage: failureMessage) - } - - public var within: (CDouble) -> NMBObjCBeCloseToMatcher { - return ({ delta in - return NMBObjCBeCloseToMatcher(expected: self._expected, within: delta) - }) - } -} - -extension NMBObjCMatcher { - public class func beCloseToMatcher(_ expected: NSNumber, within: CDouble) -> NMBObjCBeCloseToMatcher { - return NMBObjCBeCloseToMatcher(expected: expected, within: within) - } -} -#endif - -public func beCloseTo(_ expectedValues: [Double], within delta: Double = DefaultDelta) -> NonNilMatcherFunc <[Double]> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be close to <\(stringify(expectedValues))> (each within \(stringify(delta)))" - if let actual = try actualExpression.evaluate() { - failureMessage.actualValue = "<\(stringify(actual))>" - - if actual.count != expectedValues.count { - return false - } else { - for (index, actualItem) in actual.enumerated() { - if fabs(actualItem - expectedValues[index]) > delta { - return false - } - } - return true - } - } - return false - } -} - -// MARK: - Operators - -infix operator ≈ : ComparisonPrecedence - -public func ≈(lhs: Expectation<[Double]>, rhs: [Double]) { - lhs.to(beCloseTo(rhs)) -} - -public func ≈(lhs: Expectation, rhs: NMBDoubleConvertible) { - lhs.to(beCloseTo(rhs)) -} - -public func ≈(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { - lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) -} - -public func ==(lhs: Expectation, rhs: (expected: NMBDoubleConvertible, delta: Double)) { - lhs.to(beCloseTo(rhs.expected, within: rhs.delta)) -} - -// make this higher precedence than exponents so the Doubles either end aren't pulled in -// unexpectantly -precedencegroup PlusMinusOperatorPrecedence { - higherThan: BitwiseShiftPrecedence -} - -infix operator ± : PlusMinusOperatorPrecedence -public func ±(lhs: NMBDoubleConvertible, rhs: Double) -> (expected: NMBDoubleConvertible, delta: Double) { - return (expected: lhs, delta: rhs) -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift deleted file mode 100644 index 19df0d2..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeEmpty.swift +++ /dev/null @@ -1,92 +0,0 @@ -import Foundation - - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualSeq = try actualExpression.evaluate() - if actualSeq == nil { - return true - } - var generator = actualSeq!.makeIterator() - return generator.next() == nil - } -} - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualString = try actualExpression.evaluate() - return actualString == nil || NSString(string: actualString!).length == 0 - } -} - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For NSString instances, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualString = try actualExpression.evaluate() - return actualString == nil || actualString!.length == 0 - } -} - -// Without specific overrides, beEmpty() is ambiguous for NSDictionary, NSArray, -// etc, since they conform to Sequence as well as NMBCollection. - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualDictionary = try actualExpression.evaluate() - return actualDictionary == nil || actualDictionary!.count == 0 - } -} - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actualArray = try actualExpression.evaluate() - return actualArray == nil || actualArray!.count == 0 - } -} - -/// A Nimble matcher that succeeds when a value is "empty". For collections, this -/// means the are no items in that collection. For strings, it is an empty string. -public func beEmpty() -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be empty" - let actual = try actualExpression.evaluate() - return actual == nil || actual!.count == 0 - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beEmptyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() - failureMessage.postfixMessage = "be empty" - if let value = actualValue as? NMBCollection { - let expr = Expression(expression: ({ value as NMBCollection }), location: location) - return try! beEmpty().matches(expr, failureMessage: failureMessage) - } else if let value = actualValue as? NSString { - let expr = Expression(expression: ({ value as String }), location: location) - return try! beEmpty().matches(expr, failureMessage: failureMessage) - } else if let actualValue = actualValue { - failureMessage.postfixMessage = "be empty (only works for NSArrays, NSSets, NSIndexSets, NSDictionaries, NSHashTables, and NSStrings)" - failureMessage.actualValue = "\(String(describing: type(of: actualValue))) type" - } - return false - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift deleted file mode 100644 index 1345199..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThan.swift +++ /dev/null @@ -1,42 +0,0 @@ -import Foundation - - -/// A Nimble matcher that succeeds when the actual value is greater than the expected value. -public func beGreaterThan(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual > expected - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is greater than the expected value. -public func beGreaterThan(_ expectedValue: NMBComparable?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedDescending - return matches - } -} - -public func >(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThan(rhs)) -} - -public func >(lhs: Expectation, rhs: NMBComparable?) { - lhs.to(beGreaterThan(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beGreaterThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThan(expected).matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift deleted file mode 100644 index 2949fce..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift +++ /dev/null @@ -1,44 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is greater than -/// or equal to the expected value. -public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - if let actual = actualValue, let expected = expectedValue { - return actual >= expected - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is greater than -/// or equal to the expected value. -public func beGreaterThanOrEqualTo(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be greater than or equal to <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedAscending - return matches - } -} - -public func >=(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThanOrEqualTo(rhs)) -} - -public func >=(lhs: Expectation, rhs: T) { - lhs.to(beGreaterThanOrEqualTo(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beGreaterThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beGreaterThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift deleted file mode 100644 index ca3357b..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeIdenticalTo.swift +++ /dev/null @@ -1,47 +0,0 @@ -import Foundation - - -/// A Nimble matcher that succeeds when the actual value is the same instance -/// as the expected instance. -public func beIdenticalTo(_ expected: Any?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - #if os(Linux) - let actual = try actualExpression.evaluate() as? AnyObject - #else - let actual = try actualExpression.evaluate() as AnyObject? - #endif - failureMessage.actualValue = "\(identityAsString(actual))" - failureMessage.postfixMessage = "be identical to \(identityAsString(expected))" - #if os(Linux) - return actual === (expected as? AnyObject) && actual !== nil - #else - return actual === (expected as AnyObject?) && actual !== nil - #endif - } -} - -public func ===(lhs: Expectation, rhs: Any?) { - lhs.to(beIdenticalTo(rhs)) -} -public func !==(lhs: Expectation, rhs: Any?) { - lhs.toNot(beIdenticalTo(rhs)) -} - -/// A Nimble matcher that succeeds when the actual value is the same instance -/// as the expected instance. -/// -/// Alias for "beIdenticalTo". -public func be(_ expected: Any?) -> NonNilMatcherFunc { - return beIdenticalTo(expected) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beIdenticalToMatcher(_ expected: NSObject?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let aExpr = actualExpression.cast { $0 as Any? } - return try! beIdenticalTo(expected).matches(aExpr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift deleted file mode 100644 index 4cd1a05..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThan.swift +++ /dev/null @@ -1,41 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is less than the expected value. -public func beLessThan(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual < expected - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is less than the expected value. -public func beLessThan(_ expectedValue: NMBComparable?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - let matches = actualValue != nil && actualValue!.NMB_compare(expectedValue) == ComparisonResult.orderedAscending - return matches - } -} - -public func <(lhs: Expectation, rhs: T) { - lhs.to(beLessThan(rhs)) -} - -public func <(lhs: Expectation, rhs: NMBComparable?) { - lhs.to(beLessThan(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beLessThanMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { $0 as! NMBComparable? } - return try! beLessThan(expected).matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift deleted file mode 100644 index a0cd2f0..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLessThanOrEqual.swift +++ /dev/null @@ -1,42 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is less than -/// or equal to the expected value. -public func beLessThanOrEqualTo(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" - if let actual = try actualExpression.evaluate(), let expected = expectedValue { - return actual <= expected - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual value is less than -/// or equal to the expected value. -public func beLessThanOrEqualTo(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be less than or equal to <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - return actualValue != nil && actualValue!.NMB_compare(expectedValue) != ComparisonResult.orderedDescending - } -} - -public func <=(lhs: Expectation, rhs: T) { - lhs.to(beLessThanOrEqualTo(rhs)) -} - -public func <=(lhs: Expectation, rhs: T) { - lhs.to(beLessThanOrEqualTo(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beLessThanOrEqualToMatcher(_ expected: NMBComparable?) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil:false) { actualExpression, failureMessage in - let expr = actualExpression.cast { $0 as? NMBComparable } - return try! beLessThanOrEqualTo(expected).matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift deleted file mode 100644 index ee62928..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeLogical.swift +++ /dev/null @@ -1,173 +0,0 @@ -import Foundation - -extension Int8: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).int8Value - } -} - -extension UInt8: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uint8Value - } -} - -extension Int16: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).int16Value - } -} - -extension UInt16: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uint16Value - } -} - -extension Int32: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).int32Value - } -} - -extension UInt32: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uint32Value - } -} - -extension Int64: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).int64Value - } -} - -extension UInt64: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uint64Value - } -} - -extension Float: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).floatValue - } -} - -extension Double: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).doubleValue - } -} - -extension Int: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).intValue - } -} - -extension UInt: ExpressibleByBooleanLiteral { - public init(booleanLiteral value: Bool) { - self = NSNumber(value: value).uintValue - } -} - -internal func matcherWithFailureMessage(_ matcher: NonNilMatcherFunc, postprocessor: @escaping (FailureMessage) -> Void) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - defer { postprocessor(failureMessage) } - return try matcher.matcher(actualExpression, failureMessage) - } -} - -// MARK: beTrue() / beFalse() - -/// A Nimble matcher that succeeds when the actual value is exactly true. -/// This matcher will not match against nils. -public func beTrue() -> NonNilMatcherFunc { - return matcherWithFailureMessage(equal(true)) { failureMessage in - failureMessage.postfixMessage = "be true" - } -} - -/// A Nimble matcher that succeeds when the actual value is exactly false. -/// This matcher will not match against nils. -public func beFalse() -> NonNilMatcherFunc { - return matcherWithFailureMessage(equal(false)) { failureMessage in - failureMessage.postfixMessage = "be false" - } -} - -// MARK: beTruthy() / beFalsy() - -/// A Nimble matcher that succeeds when the actual value is not logically false. -public func beTruthy() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be truthy" - let actualValue = try actualExpression.evaluate() - if let actualValue = actualValue { - // FIXME: This is a workaround to SR-2290. - // See: - // - https://bugs.swift.org/browse/SR-2290 - // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873 - if let number = actualValue as? NSNumber { - return number.boolValue == true - } - - return actualValue == (true as T) - } - return actualValue != nil - } -} - -/// A Nimble matcher that succeeds when the actual value is logically false. -/// This matcher will match against nils. -public func beFalsy() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be falsy" - let actualValue = try actualExpression.evaluate() - if let actualValue = actualValue { - // FIXME: This is a workaround to SR-2290. - // See: - // - https://bugs.swift.org/browse/SR-2290 - // - https://github.com/norio-nomura/Nimble/pull/5#issuecomment-237835873 - if let number = actualValue as? NSNumber { - return number.boolValue == false - } - - return actualValue == (false as T) - } - return actualValue == nil - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beTruthyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false as Bool? } - return try! beTruthy().matches(expr, failureMessage: failureMessage) - } - } - - public class func beFalsyMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false as Bool? } - return try! beFalsy().matches(expr, failureMessage: failureMessage) - } - } - - public class func beTrueMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false as Bool? } - return try! beTrue().matches(expr, failureMessage: failureMessage) - } - } - - public class func beFalseMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let expr = actualExpression.cast { ($0 as? NSNumber)?.boolValue ?? false as Bool? } - return try! beFalse().matches(expr, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift deleted file mode 100644 index a6fb31f..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeNil.swift +++ /dev/null @@ -1,20 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is nil. -public func beNil() -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be nil" - let actualValue = try actualExpression.evaluate() - return actualValue == nil - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beNilMatcher() -> NMBObjCMatcher { - return NMBObjCMatcher { actualExpression, failureMessage in - return try! beNil().matches(actualExpression, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift deleted file mode 100644 index 8f86265..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeVoid.swift +++ /dev/null @@ -1,18 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is Void. -public func beVoid() -> MatcherFunc<()> { - return MatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "be void" - let actualValue: ()? = try actualExpression.evaluate() - return actualValue != nil - } -} - -public func ==(lhs: Expectation<()>, rhs: ()) { - lhs.to(beVoid()) -} - -public func !=(lhs: Expectation<()>, rhs: ()) { - lhs.toNot(beVoid()) -} \ No newline at end of file diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift deleted file mode 100644 index ef6c603..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/BeginWith.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation - - -/// A Nimble matcher that succeeds when the actual sequence's first element -/// is equal to the expected value. -public func beginWith(_ startingElement: T) -> NonNilMatcherFunc - where S.Iterator.Element == T -{ - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingElement)>" - if let actualValue = try actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - return actualGenerator.next() == startingElement - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual collection's first element -/// is equal to the expected object. -public func beginWith(_ startingElement: Any) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingElement)>" - guard let collection = try actualExpression.evaluate() else { return false } - guard collection.count > 0 else { return false } - #if os(Linux) - guard let collectionValue = collection.object(at: 0) as? NSObject else { - return false - } - #else - let collectionValue = collection.object(at: 0) as AnyObject - #endif - return collectionValue.isEqual(startingElement) - } -} - -/// A Nimble matcher that succeeds when the actual string contains expected substring -/// where the expected substring's location is zero. -public func beginWith(_ startingSubstring: String) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "begin with <\(startingSubstring)>" - if let actual = try actualExpression.evaluate() { - let range = actual.range(of: startingSubstring) - return range != nil && range!.lowerBound == actual.startIndex - } - return false - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func beginWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if let _ = actual as? String { - let expr = actualExpression.cast { $0 as? String } - return try! beginWith(expected as! String).matches(expr, failureMessage: failureMessage) - } else { - let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! beginWith(expected).matches(expr, failureMessage: failureMessage) - } - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift deleted file mode 100644 index 4400d30..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/Contain.swift +++ /dev/null @@ -1,96 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual sequence contains the expected value. -public func contain(_ items: T...) -> NonNilMatcherFunc - where S.Iterator.Element == T -{ - return contain(items) -} - -public func contain(_ items: [T]) -> NonNilMatcherFunc - where S.Iterator.Element == T -{ - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" - if let actual = try actualExpression.evaluate() { - return items.all { - return actual.contains($0) - } - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual string contains the expected substring. -public func contain(_ substrings: String...) -> NonNilMatcherFunc { - return contain(substrings) -} - -public func contain(_ substrings: [String]) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" - if let actual = try actualExpression.evaluate() { - return substrings.all { - let range = actual.range(of: $0) - return range != nil && !range!.isEmpty - } - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual string contains the expected substring. -public func contain(_ substrings: NSString...) -> NonNilMatcherFunc { - return contain(substrings) -} - -public func contain(_ substrings: [NSString]) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(substrings))>" - if let actual = try actualExpression.evaluate() { - return substrings.all { actual.range(of: $0.description).length != 0 } - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual collection contains the expected object. -public func contain(_ items: Any?...) -> NonNilMatcherFunc { - return contain(items) -} - -public func contain(_ items: [Any?]) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "contain <\(arrayAsString(items))>" - guard let actual = try actualExpression.evaluate() else { return false } - return items.all { item in - return item != nil && actual.contains(item!) - } - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func containMatcher(_ expected: [NSObject]) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() - if let value = actualValue as? NMBContainer { - let expr = Expression(expression: ({ value as NMBContainer }), location: location) - - // A straightforward cast on the array causes this to crash, so we have to cast the individual items - let expectedOptionals: [Any?] = expected.map({ $0 as Any? }) - return try! contain(expectedOptionals).matches(expr, failureMessage: failureMessage) - } else if let value = actualValue as? NSString { - let expr = Expression(expression: ({ value as String }), location: location) - return try! contain(expected as! [String]).matches(expr, failureMessage: failureMessage) - } else if actualValue != nil { - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))> (only works for NSArrays, NSSets, NSHashTables, and NSStrings)" - } else { - failureMessage.postfixMessage = "contain <\(arrayAsString(expected))>" - } - return false - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift deleted file mode 100644 index b96e96c..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/EndWith.swift +++ /dev/null @@ -1,75 +0,0 @@ -import Foundation - - -/// A Nimble matcher that succeeds when the actual sequence's last element -/// is equal to the expected value. -public func endWith(_ endingElement: T) -> NonNilMatcherFunc - where S.Iterator.Element == T -{ - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - - if let actualValue = try actualExpression.evaluate() { - var actualGenerator = actualValue.makeIterator() - var lastItem: T? - var item: T? - repeat { - lastItem = item - item = actualGenerator.next() - } while(item != nil) - - return lastItem == endingElement - } - return false - } -} - -/// A Nimble matcher that succeeds when the actual collection's last element -/// is equal to the expected object. -public func endWith(_ endingElement: Any) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingElement)>" - guard let collection = try actualExpression.evaluate() else { return false } - guard collection.count > 0 else { return false } - #if os(Linux) - guard let collectionValue = collection.object(at: collection.count - 1) as? NSObject else { - return false - } - #else - let collectionValue = collection.object(at: collection.count - 1) as AnyObject - #endif - - return collectionValue.isEqual(endingElement) - } -} - - -/// A Nimble matcher that succeeds when the actual string contains the expected substring -/// where the expected substring's location is the actual string's length minus the -/// expected substring's length. -public func endWith(_ endingSubstring: String) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "end with <\(endingSubstring)>" - if let collection = try actualExpression.evaluate() { - return collection.hasSuffix(endingSubstring) - } - return false - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func endWithMatcher(_ expected: Any) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = try! actualExpression.evaluate() - if let _ = actual as? String { - let expr = actualExpression.cast { $0 as? String } - return try! endWith(expected as! String).matches(expr, failureMessage: failureMessage) - } else { - let expr = actualExpression.cast { $0 as? NMBOrderedCollection } - return try! endWith(expected).matches(expr, failureMessage: failureMessage) - } - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift deleted file mode 100644 index 53579e0..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/Equal.swift +++ /dev/null @@ -1,181 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value is equal to the expected value. -/// Values can support equal by supporting the Equatable protocol. -/// -/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). -public func equal(_ expectedValue: T?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - let matches = actualValue == expectedValue && expectedValue != nil - if expectedValue == nil || actualValue == nil { - if expectedValue == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - return false - } - return matches - } -} - -/// A Nimble matcher that succeeds when the actual value is equal to the expected value. -/// Values can support equal by supporting the Equatable protocol. -/// -/// @see beCloseTo if you want to match imprecise types (eg - floats, doubles). -public func equal(_ expectedValue: [T: C]?) -> NonNilMatcherFunc<[T: C]> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - return false - } - return expectedValue! == actualValue! - } -} - -/// A Nimble matcher that succeeds when the actual collection is equal to the expected collection. -/// Items must implement the Equatable protocol. -public func equal(_ expectedValue: [T]?) -> NonNilMatcherFunc<[T]> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - let actualValue = try actualExpression.evaluate() - if expectedValue == nil || actualValue == nil { - if expectedValue == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - return false - } - return expectedValue! == actualValue! - } -} - -/// A Nimble matcher allowing comparison of collection with optional type -public func equal(_ expectedValue: [T?]) -> NonNilMatcherFunc<[T?]> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - if let actualValue = try actualExpression.evaluate() { - if expectedValue.count != actualValue.count { - return false - } - - for (index, item) in actualValue.enumerated() { - let otherItem = expectedValue[index] - if item == nil && otherItem == nil { - continue - } else if item == nil && otherItem != nil { - return false - } else if item != nil && otherItem == nil { - return false - } else if item! != otherItem! { - return false - } - } - - return true - } else { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - - return false - } -} - -/// A Nimble matcher that succeeds when the actual set is equal to the expected set. -public func equal(_ expectedValue: Set?) -> NonNilMatcherFunc> { - return equal(expectedValue, stringify: { stringify($0) }) -} - -/// A Nimble matcher that succeeds when the actual set is equal to the expected set. -public func equal(_ expectedValue: Set?) -> NonNilMatcherFunc> { - return equal(expectedValue, stringify: { - if let set = $0 { - return stringify(Array(set).sorted { $0 < $1 }) - } else { - return "nil" - } - }) -} - -private func equal(_ expectedValue: Set?, stringify: @escaping (Set?) -> String) -> NonNilMatcherFunc> { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "equal <\(stringify(expectedValue))>" - - if let expectedValue = expectedValue { - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "<\(stringify(actualValue))>" - - if expectedValue == actualValue { - return true - } - - let missing = expectedValue.subtracting(actualValue) - if missing.count > 0 { - failureMessage.postfixActual += ", missing <\(stringify(missing))>" - } - - let extra = actualValue.subtracting(expectedValue) - if extra.count > 0 { - failureMessage.postfixActual += ", extra <\(stringify(extra))>" - } - } - } else { - failureMessage.postfixActual = " (use beNil() to match nils)" - } - - return false - } -} - -public func ==(lhs: Expectation, rhs: T?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation, rhs: T?) { - lhs.toNot(equal(rhs)) -} - -public func ==(lhs: Expectation<[T]>, rhs: [T]?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation<[T]>, rhs: [T]?) { - lhs.toNot(equal(rhs)) -} - -public func ==(lhs: Expectation>, rhs: Set?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation>, rhs: Set?) { - lhs.toNot(equal(rhs)) -} - -public func ==(lhs: Expectation>, rhs: Set?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation>, rhs: Set?) { - lhs.toNot(equal(rhs)) -} - -public func ==(lhs: Expectation<[T: C]>, rhs: [T: C]?) { - lhs.to(equal(rhs)) -} - -public func !=(lhs: Expectation<[T: C]>, rhs: [T: C]?) { - lhs.toNot(equal(rhs)) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func equalMatcher(_ expected: NSObject) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - return try! equal(expected).matches(actualExpression, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift deleted file mode 100644 index 5b24af2..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/HaveCount.swift +++ /dev/null @@ -1,57 +0,0 @@ -import Foundation - -// The `haveCount` matchers do not print the full string representation of the collection value, -// instead they only print the type name and the expected count. This makes it easier to understand -// the reason for failed expectations. See: https://github.com/Quick/Nimble/issues/308. -// The representation of the collection content is provided in a new line as an `extendedMessage`. - -/// A Nimble matcher that succeeds when the actual Collection's count equals -/// the expected value -public func haveCount(_ expectedValue: T.IndexDistance) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - if let actualValue = try actualExpression.evaluate() { - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" - let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result - } else { - return false - } - } -} - -/// A Nimble matcher that succeeds when the actual collection's count equals -/// the expected value -public func haveCount(_ expectedValue: Int) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - if let actualValue = try actualExpression.evaluate() { - failureMessage.postfixMessage = "have \(prettyCollectionType(actualValue)) with count \(stringify(expectedValue))" - let result = expectedValue == actualValue.count - failureMessage.actualValue = "\(actualValue.count)" - failureMessage.extendedMessage = "Actual Value: \(stringify(actualValue))" - return result - } else { - return false - } - } -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func haveCountMatcher(_ expected: NSNumber) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let location = actualExpression.location - let actualValue = try! actualExpression.evaluate() - if let value = actualValue as? NMBCollection { - let expr = Expression(expression: ({ value as NMBCollection}), location: location) - return try! haveCount(expected.intValue).matches(expr, failureMessage: failureMessage) - } else if let actualValue = actualValue { - failureMessage.postfixMessage = "get type of NSArray, NSSet, NSDictionary, or NSHashTable" - failureMessage.actualValue = "\(String(describing: type(of: actualValue)))" - } - return false - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/Match.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/Match.swift deleted file mode 100644 index c225f88..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/Match.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) - -/// A Nimble matcher that succeeds when the actual string satisfies the regular expression -/// described by the expected string. -public func match(_ expectedValue: String?) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - failureMessage.postfixMessage = "match <\(stringify(expectedValue))>" - - if let actual = try actualExpression.evaluate() { - if let regexp = expectedValue { - return actual.range(of: regexp, options: .regularExpression) != nil - } - } - - return false - } -} - -extension NMBObjCMatcher { - public class func matchMatcher(_ expected: NSString) -> NMBMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - let actual = actualExpression.cast { $0 as? String } - return try! match(expected.description).matches(actual, failureMessage: failureMessage) - } - } -} - -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift deleted file mode 100644 index 2092cb6..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/MatchError.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual expression evaluates to an -/// error from the specified case. -/// -/// Errors are tried to be compared by their implementation of Equatable, -/// otherwise they fallback to comparision by _domain and _code. -public func matchError(_ error: T) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() - - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, error: error) - return errorMatchesNonNilFieldsOrClosure(actualError, error: error) - } -} - -/// A Nimble matcher that succeeds when the actual expression evaluates to an -/// error of the specified type -public func matchError(_ errorType: T.Type) -> NonNilMatcherFunc { - return NonNilMatcherFunc { actualExpression, failureMessage in - let actualError: Error? = try actualExpression.evaluate() - - setFailureMessageForError(failureMessage, postfixMessageVerb: "match", actualError: actualError, errorType: errorType) - return errorMatchesNonNilFieldsOrClosure(actualError, errorType: errorType) - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift deleted file mode 100644 index 02d3245..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/MatcherFunc.swift +++ /dev/null @@ -1,69 +0,0 @@ -/// A convenience API to build matchers that don't need special negation -/// behavior. The toNot() behavior is the negation of to(). -/// -/// @see NonNilMatcherFunc if you prefer to have this matcher fail when nil -/// values are recieved in an expectation. -/// -/// You may use this when implementing your own custom matchers. -/// -/// Use the Matcher protocol instead of this type to accept custom matchers as -/// input parameters. -/// @see allPass for an example that uses accepts other matchers as input. -public struct MatcherFunc: Matcher { - public let matcher: (Expression, FailureMessage) throws -> Bool - - public init(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) { - self.matcher = matcher - } - - public func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - return try matcher(actualExpression, failureMessage) - } - - public func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - return try !matcher(actualExpression, failureMessage) - } -} - -/// A convenience API to build matchers that don't need special negation -/// behavior. The toNot() behavior is the negation of to(). -/// -/// Unlike MatcherFunc, this will always fail if an expectation contains nil. -/// This applies regardless of using to() or toNot(). -/// -/// You may use this when implementing your own custom matchers. -/// -/// Use the Matcher protocol instead of this type to accept custom matchers as -/// input parameters. -/// @see allPass for an example that uses accepts other matchers as input. -public struct NonNilMatcherFunc: Matcher { - public let matcher: (Expression, FailureMessage) throws -> Bool - - public init(_ matcher: @escaping (Expression, FailureMessage) throws -> Bool) { - self.matcher = matcher - } - - public func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - let pass = try matcher(actualExpression, failureMessage) - if try attachNilErrorIfNeeded(actualExpression, failureMessage: failureMessage) { - return false - } - return pass - } - - public func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - let pass = try !matcher(actualExpression, failureMessage) - if try attachNilErrorIfNeeded(actualExpression, failureMessage: failureMessage) { - return false - } - return pass - } - - internal func attachNilErrorIfNeeded(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool { - if try actualExpression.evaluate() == nil { - failureMessage.postfixActual = " (use beNil() to match nils)" - return true - } - return false - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift deleted file mode 100644 index ac1eb9d..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/MatcherProtocols.swift +++ /dev/null @@ -1,153 +0,0 @@ -import Foundation -// `CGFloat` is in Foundation (swift-corelibs-foundation) on Linux. -#if _runtime(_ObjC) - import CoreGraphics -#endif - -/// Implement this protocol to implement a custom matcher for Swift -public protocol Matcher { - associatedtype ValueType - func matches(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool - func doesNotMatch(_ actualExpression: Expression, failureMessage: FailureMessage) throws -> Bool -} - -#if _runtime(_ObjC) -/// Objective-C interface to the Swift variant of Matcher. -@objc public protocol NMBMatcher { - func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool - func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool -} -#endif - -#if _runtime(_ObjC) -/// Protocol for types that support contain() matcher. -@objc public protocol NMBContainer { - @objc(containsObject:) - func contains(_ anObject: Any) -> Bool -} - -// FIXME: NSHashTable can not conform to NMBContainer since swift-DEVELOPMENT-SNAPSHOT-2016-04-25-a -//extension NSHashTable : NMBContainer {} // Corelibs Foundation does not include this class yet -#else -public protocol NMBContainer { - func contains(_ anObject: Any) -> Bool -} -#endif - -extension NSArray : NMBContainer {} -extension NSSet : NMBContainer {} - -#if _runtime(_ObjC) -/// Protocol for types that support only beEmpty(), haveCount() matchers -@objc public protocol NMBCollection { - var count: Int { get } -} - -extension NSHashTable : NMBCollection {} // Corelibs Foundation does not include these classes yet -extension NSMapTable : NMBCollection {} -#else -public protocol NMBCollection { - var count: Int { get } -} -#endif - -extension NSSet : NMBCollection {} -extension NSIndexSet : NMBCollection {} -extension NSDictionary : NMBCollection {} - -#if _runtime(_ObjC) -/// Protocol for types that support beginWith(), endWith(), beEmpty() matchers -@objc public protocol NMBOrderedCollection : NMBCollection { - @objc(objectAtIndex:) - func object(at index: Int) -> Any -} -#else -public protocol NMBOrderedCollection : NMBCollection { - func object(at index: Int) -> Any -} -#endif - -extension NSArray : NMBOrderedCollection {} - -public protocol NMBDoubleConvertible { - var doubleValue: CDouble { get } -} - -extension Double : NMBDoubleConvertible { - public var doubleValue: CDouble { - return self - } -} - -extension Float : NMBDoubleConvertible { - public var doubleValue: CDouble { - return CDouble(self) - } -} - -extension CGFloat: NMBDoubleConvertible { - public var doubleValue: CDouble { - return CDouble(self) - } -} - -extension NSNumber : NMBDoubleConvertible { -} - -private let dateFormatter: DateFormatter = { - let formatter = DateFormatter() - formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSSS" - formatter.locale = Locale(identifier: "en_US_POSIX") - - return formatter -}() - -extension Date: NMBDoubleConvertible { - public var doubleValue: CDouble { - return self.timeIntervalSinceReferenceDate - } -} - -extension NSDate: NMBDoubleConvertible { - public var doubleValue: CDouble { - return self.timeIntervalSinceReferenceDate - } -} - -extension Date: TestOutputStringConvertible { - public var testDescription: String { - return dateFormatter.string(from: self) - } -} - -extension NSDate: TestOutputStringConvertible { - public var testDescription: String { - return dateFormatter.string(from: Date(timeIntervalSinceReferenceDate: self.timeIntervalSinceReferenceDate)) - } -} - -/// Protocol for types to support beLessThan(), beLessThanOrEqualTo(), -/// beGreaterThan(), beGreaterThanOrEqualTo(), and equal() matchers. -/// -/// Types that conform to Swift's Comparable protocol will work implicitly too -#if _runtime(_ObjC) -@objc public protocol NMBComparable { - func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult -} -#else -// This should become obsolete once Corelibs Foundation adds Comparable conformance to NSNumber -public protocol NMBComparable { - func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult -} -#endif - -extension NSNumber : NMBComparable { - public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { - return compare(otherObject as! NSNumber) - } -} -extension NSString : NMBComparable { - public func NMB_compare(_ otherObject: NMBComparable!) -> ComparisonResult { - return compare(otherObject as! String) - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift deleted file mode 100644 index 84b9d49..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/PostNotification.swift +++ /dev/null @@ -1,70 +0,0 @@ -import Foundation - -internal class NotificationCollector { - private(set) var observedNotifications: [Notification] - private let notificationCenter: NotificationCenter - #if _runtime(_ObjC) - private var token: AnyObject? - #else - private var token: NSObjectProtocol? - #endif - - required init(notificationCenter: NotificationCenter) { - self.notificationCenter = notificationCenter - self.observedNotifications = [] - } - - func startObserving() { - self.token = self.notificationCenter.addObserver(forName: nil, object: nil, queue: nil) { - // linux-swift gets confused by .append(n) - [weak self] n in self?.observedNotifications.append(n) - } - } - - deinit { - #if _runtime(_ObjC) - if let token = self.token { - self.notificationCenter.removeObserver(token) - } - #else - if let token = self.token as? AnyObject { - self.notificationCenter.removeObserver(token) - } - #endif - } -} - -private let mainThread = pthread_self() - -let notificationCenterDefault = NotificationCenter.default - -public func postNotifications( - _ notificationsMatcher: T, - fromNotificationCenter center: NotificationCenter = notificationCenterDefault) - -> MatcherFunc - where T: Matcher, T.ValueType == [Notification] -{ - let _ = mainThread // Force lazy-loading of this value - let collector = NotificationCollector(notificationCenter: center) - collector.startObserving() - var once: Bool = false - return MatcherFunc { actualExpression, failureMessage in - let collectorNotificationsExpression = Expression(memoizedExpression: { _ in - return collector.observedNotifications - }, location: actualExpression.location, withoutCaching: true) - - assert(pthread_equal(mainThread, pthread_self()) != 0, "Only expecting closure to be evaluated on main thread.") - if !once { - once = true - _ = try actualExpression.evaluate() - } - - let match = try notificationsMatcher.matches(collectorNotificationsExpression, failureMessage: failureMessage) - if collector.observedNotifications.isEmpty { - failureMessage.actualValue = "no notifications" - } else { - failureMessage.actualValue = "<\(stringify(collector.observedNotifications))>" - } - return match - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift deleted file mode 100644 index 09e28c7..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/RaisesException.swift +++ /dev/null @@ -1,183 +0,0 @@ -import Foundation - -// This matcher requires the Objective-C, and being built by Xcode rather than the Swift Package Manager -#if _runtime(_ObjC) && !SWIFT_PACKAGE - -/// A Nimble matcher that succeeds when the actual expression raises an -/// exception with the specified name, reason, and/or userInfo. -/// -/// Alternatively, you can pass a closure to do any arbitrary custom matching -/// to the raised exception. The closure only gets called when an exception -/// is raised. -/// -/// nil arguments indicates that the matcher should not attempt to match against -/// that parameter. -public func raiseException( - named: String? = nil, - reason: String? = nil, - userInfo: NSDictionary? = nil, - closure: ((NSException) -> Void)? = nil) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - - var exception: NSException? - let capture = NMBExceptionCapture(handler: ({ e in - exception = e - }), finally: nil) - - capture.tryBlock { - _ = try! actualExpression.evaluate() - return - } - - setFailureMessageForException(failureMessage, exception: exception, named: named, reason: reason, userInfo: userInfo, closure: closure) - return exceptionMatchesNonNilFieldsOrClosure(exception, named: named, reason: reason, userInfo: userInfo, closure: closure) - } -} - -internal func setFailureMessageForException( - _ failureMessage: FailureMessage, - exception: NSException?, - named: String?, - reason: String?, - userInfo: NSDictionary?, - closure: ((NSException) -> Void)?) { - failureMessage.postfixMessage = "raise exception" - - if let named = named { - failureMessage.postfixMessage += " with name <\(named)>" - } - if let reason = reason { - failureMessage.postfixMessage += " with reason <\(reason)>" - } - if let userInfo = userInfo { - failureMessage.postfixMessage += " with userInfo <\(userInfo)>" - } - if let _ = closure { - failureMessage.postfixMessage += " that satisfies block" - } - if named == nil && reason == nil && userInfo == nil && closure == nil { - failureMessage.postfixMessage = "raise any exception" - } - - if let exception = exception { - failureMessage.actualValue = "\(String(describing: type(of: exception))) { name=\(exception.name), reason='\(stringify(exception.reason))', userInfo=\(stringify(exception.userInfo)) }" - } else { - failureMessage.actualValue = "no exception" - } -} - -internal func exceptionMatchesNonNilFieldsOrClosure( - _ exception: NSException?, - named: String?, - reason: String?, - userInfo: NSDictionary?, - closure: ((NSException) -> Void)?) -> Bool { - var matches = false - - if let exception = exception { - matches = true - - if let named = named, exception.name.rawValue != named { - matches = false - } - if reason != nil && exception.reason != reason { - matches = false - } - if let userInfo = userInfo, let exceptionUserInfo = exception.userInfo, - (exceptionUserInfo as NSDictionary) != userInfo { - matches = false - } - if let closure = closure { - let assertions = gatherFailingExpectations { - closure(exception) - } - let messages = assertions.map { $0.message } - if messages.count > 0 { - matches = false - } - } - } - - return matches -} - -public class NMBObjCRaiseExceptionMatcher : NSObject, NMBMatcher { - internal var _name: String? - internal var _reason: String? - internal var _userInfo: NSDictionary? - internal var _block: ((NSException) -> Void)? - - internal init(name: String?, reason: String?, userInfo: NSDictionary?, block: ((NSException) -> Void)?) { - _name = name - _reason = reason - _userInfo = userInfo - _block = block - } - - public func matches(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - let block: () -> Any? = ({ _ = actualBlock(); return nil }) - let expr = Expression(expression: block, location: location) - - return try! raiseException( - named: _name, - reason: _reason, - userInfo: _userInfo, - closure: _block - ).matches(expr, failureMessage: failureMessage) - } - - public func doesNotMatch(_ actualBlock: @escaping () -> NSObject!, failureMessage: FailureMessage, location: SourceLocation) -> Bool { - return !matches(actualBlock, failureMessage: failureMessage, location: location) - } - - public var named: (_ name: String) -> NMBObjCRaiseExceptionMatcher { - return ({ name in - return NMBObjCRaiseExceptionMatcher( - name: name, - reason: self._reason, - userInfo: self._userInfo, - block: self._block - ) - }) - } - - public var reason: (_ reason: String?) -> NMBObjCRaiseExceptionMatcher { - return ({ reason in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: reason, - userInfo: self._userInfo, - block: self._block - ) - }) - } - - public var userInfo: (_ userInfo: NSDictionary?) -> NMBObjCRaiseExceptionMatcher { - return ({ userInfo in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: self._reason, - userInfo: userInfo, - block: self._block - ) - }) - } - - public var satisfyingBlock: (_ block: ((NSException) -> Void)?) -> NMBObjCRaiseExceptionMatcher { - return ({ block in - return NMBObjCRaiseExceptionMatcher( - name: self._name, - reason: self._reason, - userInfo: self._userInfo, - block: block - ) - }) - } -} - -extension NMBObjCMatcher { - public class func raiseExceptionMatcher() -> NMBObjCRaiseExceptionMatcher { - return NMBObjCRaiseExceptionMatcher(name: nil, reason: nil, userInfo: nil, block: nil) - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift deleted file mode 100644 index b24b3ec..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/SatisfyAnyOf.swift +++ /dev/null @@ -1,65 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual value matches with any of the matchers -/// provided in the variable list of matchers. -public func satisfyAnyOf(_ matchers: U...) -> NonNilMatcherFunc - where U: Matcher, U.ValueType == T -{ - return satisfyAnyOf(matchers) -} - -internal func satisfyAnyOf(_ matchers: [U]) -> NonNilMatcherFunc - where U: Matcher, U.ValueType == T -{ - return NonNilMatcherFunc { actualExpression, failureMessage in - let postfixMessages = NSMutableArray() - var matches = false - for matcher in matchers { - if try matcher.matches(actualExpression, failureMessage: failureMessage) { - matches = true - } - postfixMessages.add(NSString(string: "{\(failureMessage.postfixMessage)}")) - } - - failureMessage.postfixMessage = "match one of: " + postfixMessages.componentsJoined(by: ", or ") - if let actualValue = try actualExpression.evaluate() { - failureMessage.actualValue = "\(actualValue)" - } - - return matches - } -} - -public func ||(left: NonNilMatcherFunc, right: NonNilMatcherFunc) -> NonNilMatcherFunc { - return satisfyAnyOf(left, right) -} - -public func ||(left: MatcherFunc, right: MatcherFunc) -> NonNilMatcherFunc { - return satisfyAnyOf(left, right) -} - -#if _runtime(_ObjC) -extension NMBObjCMatcher { - public class func satisfyAnyOfMatcher(_ matchers: [NMBObjCMatcher]) -> NMBObjCMatcher { - return NMBObjCMatcher(canMatchNil: false) { actualExpression, failureMessage in - if matchers.isEmpty { - failureMessage.stringValue = "satisfyAnyOf must be called with at least one matcher" - return false - } - - var elementEvaluators = [NonNilMatcherFunc]() - for matcher in matchers { - let elementEvaluator: (Expression, FailureMessage) -> Bool = { - expression, failureMessage in - return matcher.matches( - {try! expression.evaluate()}, failureMessage: failureMessage, location: actualExpression.location) - } - - elementEvaluators.append(NonNilMatcherFunc(elementEvaluator)) - } - - return try! satisfyAnyOf(elementEvaluators).matches(actualExpression, failureMessage: failureMessage) - } - } -} -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift b/Example/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift deleted file mode 100644 index 8c9b91b..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Matchers/ThrowError.swift +++ /dev/null @@ -1,53 +0,0 @@ -import Foundation - -/// A Nimble matcher that succeeds when the actual expression throws an -/// error of the specified type or from the specified case. -/// -/// Errors are tried to be compared by their implementation of Equatable, -/// otherwise they fallback to comparision by _domain and _code. -/// -/// Alternatively, you can pass a closure to do any arbitrary custom matching -/// to the thrown error. The closure only gets called when an error was thrown. -/// -/// nil arguments indicates that the matcher should not attempt to match against -/// that parameter. -public func throwError( - _ error: T? = nil, - errorType: T.Type? = nil, - closure: ((T) -> Void)? = nil) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - - var actualError: Error? - do { - _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError - } - - setFailureMessageForError(failureMessage, actualError: actualError, error: error, errorType: errorType, closure: closure) - return errorMatchesNonNilFieldsOrClosure(actualError, error: error, errorType: errorType, closure: closure) - } -} - -/// A Nimble matcher that succeeds when the actual expression throws any -/// error or when the passed closures' arbitrary custom matching succeeds. -/// -/// This duplication to it's generic adequate is required to allow to receive -/// values of the existential type `Error` in the closure. -/// -/// The closure only gets called when an error was thrown. -public func throwError( - closure: ((Error) -> Void)? = nil) -> MatcherFunc { - return MatcherFunc { actualExpression, failureMessage in - - var actualError: Error? - do { - _ = try actualExpression.evaluate() - } catch let catchedError { - actualError = catchedError - } - - setFailureMessageForError(failureMessage, actualError: actualError, closure: closure) - return errorMatchesNonNilFieldsOrClosure(actualError, closure: closure) - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Nimble.h b/Example/Pods/Nimble/Sources/Nimble/Nimble.h deleted file mode 100644 index 1eab61a..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Nimble.h +++ /dev/null @@ -1,7 +0,0 @@ -#import -#import "NMBExceptionCapture.h" -#import "NMBStringify.h" -#import "DSL.h" - -FOUNDATION_EXPORT double NimbleVersionNumber; -FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; diff --git a/Example/Pods/Nimble/Sources/Nimble/Utils/Async.swift b/Example/Pods/Nimble/Sources/Nimble/Utils/Async.swift deleted file mode 100644 index a78a147..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Utils/Async.swift +++ /dev/null @@ -1,350 +0,0 @@ -import Foundation - -#if _runtime(_ObjC) -import Dispatch - -private let timeoutLeeway = DispatchTimeInterval.nanoseconds(Int(NSEC_PER_MSEC)) -private let pollLeeway = DispatchTimeInterval.nanoseconds(Int(NSEC_PER_MSEC)) - -/// Stores debugging information about callers -internal struct WaitingInfo: CustomStringConvertible { - let name: String - let file: FileString - let lineNumber: UInt - - var description: String { - return "\(name) at \(file):\(lineNumber)" - } -} - -internal protocol WaitLock { - func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) - func releaseWaitingLock() - func isWaitingLocked() -> Bool -} - -internal class AssertionWaitLock: WaitLock { - private var currentWaiter: WaitingInfo? = nil - init() { } - - func acquireWaitingLock(_ fnName: String, file: FileString, line: UInt) { - let info = WaitingInfo(name: fnName, file: file, lineNumber: line) - nimblePrecondition( - Thread.isMainThread, - "InvalidNimbleAPIUsage", - "\(fnName) can only run on the main thread." - ) - nimblePrecondition( - currentWaiter == nil, - "InvalidNimbleAPIUsage", - "Nested async expectations are not allowed to avoid creating flaky tests.\n\n" + - "The call to\n\t\(info)\n" + - "triggered this exception because\n\t\(currentWaiter!)\n" + - "is currently managing the main run loop." - ) - currentWaiter = info - } - - func isWaitingLocked() -> Bool { - return currentWaiter != nil - } - - func releaseWaitingLock() { - currentWaiter = nil - } -} - -internal enum AwaitResult { - /// Incomplete indicates None (aka - this value hasn't been fulfilled yet) - case incomplete - /// TimedOut indicates the result reached its defined timeout limit before returning - case timedOut - /// BlockedRunLoop indicates the main runloop is too busy processing other blocks to trigger - /// the timeout code. - /// - /// This may also mean the async code waiting upon may have never actually ran within the - /// required time because other timers & sources are running on the main run loop. - case blockedRunLoop - /// The async block successfully executed and returned a given result - case completed(T) - /// When a Swift Error is thrown - case errorThrown(Error) - /// When an Objective-C Exception is raised - case raisedException(NSException) - - func isIncomplete() -> Bool { - switch self { - case .incomplete: return true - default: return false - } - } - - func isCompleted() -> Bool { - switch self { - case .completed(_): return true - default: return false - } - } -} - -/// Holds the resulting value from an asynchronous expectation. -/// This class is thread-safe at receiving an "response" to this promise. -internal class AwaitPromise { - private(set) internal var asyncResult: AwaitResult = .incomplete - private var signal: DispatchSemaphore - - init() { - signal = DispatchSemaphore(value: 1) - } - - /// Resolves the promise with the given result if it has not been resolved. Repeated calls to - /// this method will resolve in a no-op. - /// - /// @returns a Bool that indicates if the async result was accepted or rejected because another - /// value was recieved first. - func resolveResult(_ result: AwaitResult) -> Bool { - if signal.wait(timeout: .now()) == .success { - self.asyncResult = result - return true - } else { - return false - } - } -} - -internal struct AwaitTrigger { - let timeoutSource: DispatchSourceTimer - let actionSource: DispatchSourceTimer? - let start: () throws -> Void -} - -/// Factory for building fully configured AwaitPromises and waiting for their results. -/// -/// This factory stores all the state for an async expectation so that Await doesn't -/// doesn't have to manage it. -internal class AwaitPromiseBuilder { - let awaiter: Awaiter - let waitLock: WaitLock - let trigger: AwaitTrigger - let promise: AwaitPromise - - internal init( - awaiter: Awaiter, - waitLock: WaitLock, - promise: AwaitPromise, - trigger: AwaitTrigger) { - self.awaiter = awaiter - self.waitLock = waitLock - self.promise = promise - self.trigger = trigger - } - - func timeout(_ timeoutInterval: TimeInterval, forcefullyAbortTimeout: TimeInterval) -> Self { - // = Discussion = - // - // There's a lot of technical decisions here that is useful to elaborate on. This is - // definitely more lower-level than the previous NSRunLoop based implementation. - // - // - // Why Dispatch Source? - // - // - // We're using a dispatch source to have better control of the run loop behavior. - // A timer source gives us deferred-timing control without having to rely as much on - // a run loop's traditional dispatching machinery (eg - NSTimers, DefaultRunLoopMode, etc.) - // which is ripe for getting corrupted by application code. - // - // And unlike dispatch_async(), we can control how likely our code gets prioritized to - // executed (see leeway parameter) + DISPATCH_TIMER_STRICT. - // - // This timer is assumed to run on the HIGH priority queue to ensure it maintains the - // highest priority over normal application / test code when possible. - // - // - // Run Loop Management - // - // In order to properly interrupt the waiting behavior performed by this factory class, - // this timer stops the main run loop to tell the waiter code that the result should be - // checked. - // - // In addition, stopping the run loop is used to halt code executed on the main run loop. - trigger.timeoutSource.scheduleOneshot( - deadline: DispatchTime.now() + timeoutInterval, - leeway: timeoutLeeway) - trigger.timeoutSource.setEventHandler() { - guard self.promise.asyncResult.isIncomplete() else { return } - let timedOutSem = DispatchSemaphore(value: 0) - let semTimedOutOrBlocked = DispatchSemaphore(value: 0) - semTimedOutOrBlocked.signal() - let runLoop = CFRunLoopGetMain() - CFRunLoopPerformBlock(runLoop, CFRunLoopMode.defaultMode.rawValue) { - if semTimedOutOrBlocked.wait(timeout: .now()) == .success { - timedOutSem.signal() - semTimedOutOrBlocked.signal() - if self.promise.resolveResult(.timedOut) { - CFRunLoopStop(CFRunLoopGetMain()) - } - } - } - // potentially interrupt blocking code on run loop to let timeout code run - CFRunLoopStop(runLoop) - let now = DispatchTime.now() + forcefullyAbortTimeout - let didNotTimeOut = timedOutSem.wait(timeout: now) != .success - let timeoutWasNotTriggered = semTimedOutOrBlocked.wait(timeout: .now()) == .success - if didNotTimeOut && timeoutWasNotTriggered { - if self.promise.resolveResult(.blockedRunLoop) { - CFRunLoopStop(CFRunLoopGetMain()) - } - } - } - return self - } - - /// Blocks for an asynchronous result. - /// - /// @discussion - /// This function must be executed on the main thread and cannot be nested. This is because - /// this function (and it's related methods) coordinate through the main run loop. Tampering - /// with the run loop can cause undesireable behavior. - /// - /// This method will return an AwaitResult in the following cases: - /// - /// - The main run loop is blocked by other operations and the async expectation cannot be - /// be stopped. - /// - The async expectation timed out - /// - The async expectation succeeded - /// - The async expectation raised an unexpected exception (objc) - /// - The async expectation raised an unexpected error (swift) - /// - /// The returned AwaitResult will NEVER be .incomplete. - func wait(_ fnName: String = #function, file: FileString = #file, line: UInt = #line) -> AwaitResult { - waitLock.acquireWaitingLock( - fnName, - file: file, - line: line) - - let capture = NMBExceptionCapture(handler: ({ exception in - _ = self.promise.resolveResult(.raisedException(exception)) - }), finally: ({ - self.waitLock.releaseWaitingLock() - })) - capture.tryBlock { - do { - try self.trigger.start() - } catch let error { - _ = self.promise.resolveResult(.errorThrown(error)) - } - self.trigger.timeoutSource.resume() - while self.promise.asyncResult.isIncomplete() { - // Stopping the run loop does not work unless we run only 1 mode - RunLoop.current.run(mode: .defaultRunLoopMode, before: .distantFuture) - } - self.trigger.timeoutSource.suspend() - self.trigger.timeoutSource.cancel() - if let asyncSource = self.trigger.actionSource { - asyncSource.cancel() - } - } - - return promise.asyncResult - } -} - -internal class Awaiter { - let waitLock: WaitLock - let timeoutQueue: DispatchQueue - let asyncQueue: DispatchQueue - - internal init( - waitLock: WaitLock, - asyncQueue: DispatchQueue, - timeoutQueue: DispatchQueue) { - self.waitLock = waitLock - self.asyncQueue = asyncQueue - self.timeoutQueue = timeoutQueue - } - - private func createTimerSource(_ queue: DispatchQueue) -> DispatchSourceTimer { - return DispatchSource.makeTimerSource(flags: .strict, queue: queue) - } - - func performBlock( - _ closure: @escaping (@escaping (T) -> Void) throws -> Void) -> AwaitPromiseBuilder { - let promise = AwaitPromise() - let timeoutSource = createTimerSource(timeoutQueue) - var completionCount = 0 - let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: nil) { - try closure() { - completionCount += 1 - nimblePrecondition( - completionCount < 2, - "InvalidNimbleAPIUsage", - "Done closure's was called multiple times. waitUntil(..) expects its " + - "completion closure to only be called once.") - if promise.resolveResult(.completed($0)) { - CFRunLoopStop(CFRunLoopGetMain()) - } - } - } - - return AwaitPromiseBuilder( - awaiter: self, - waitLock: waitLock, - promise: promise, - trigger: trigger) - } - - func poll(_ pollInterval: TimeInterval, closure: @escaping () throws -> T?) -> AwaitPromiseBuilder { - let promise = AwaitPromise() - let timeoutSource = createTimerSource(timeoutQueue) - let asyncSource = createTimerSource(asyncQueue) - let trigger = AwaitTrigger(timeoutSource: timeoutSource, actionSource: asyncSource) { - let interval = DispatchTimeInterval.nanoseconds(Int(pollInterval * TimeInterval(NSEC_PER_SEC))) - asyncSource.scheduleRepeating(deadline: .now(), interval: interval, leeway: pollLeeway) - asyncSource.setEventHandler() { - do { - if let result = try closure() { - if promise.resolveResult(.completed(result)) { - CFRunLoopStop(CFRunLoopGetCurrent()) - } - } - } catch let error { - if promise.resolveResult(.errorThrown(error)) { - CFRunLoopStop(CFRunLoopGetCurrent()) - } - } - } - asyncSource.resume() - } - - return AwaitPromiseBuilder( - awaiter: self, - waitLock: waitLock, - promise: promise, - trigger: trigger) - } -} - -internal func pollBlock( - pollInterval: TimeInterval, - timeoutInterval: TimeInterval, - file: FileString, - line: UInt, - fnName: String = #function, - expression: @escaping () throws -> Bool) -> AwaitResult { - let awaiter = NimbleEnvironment.activeInstance.awaiter - let result = awaiter.poll(pollInterval) { () throws -> Bool? in - do { - if try expression() { - return true - } - return nil - } catch let error { - throw error - } - }.timeout(timeoutInterval, forcefullyAbortTimeout: timeoutInterval / 2.0).wait(fnName, file: file, line: line) - - return result -} - -#endif diff --git a/Example/Pods/Nimble/Sources/Nimble/Utils/Errors.swift b/Example/Pods/Nimble/Sources/Nimble/Utils/Errors.swift deleted file mode 100644 index 54bed92..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Utils/Errors.swift +++ /dev/null @@ -1,135 +0,0 @@ -import Foundation - -// Generic - -internal func setFailureMessageForError( - _ failureMessage: FailureMessage, - postfixMessageVerb: String = "throw", - actualError: Error?, - error: T? = nil, - errorType: T.Type? = nil, - closure: ((T) -> Void)? = nil) { - failureMessage.postfixMessage = "\(postfixMessageVerb) error" - - if let error = error { - if let error = error as? CustomDebugStringConvertible { - failureMessage.postfixMessage += " <\(error.debugDescription)>" - } else { - failureMessage.postfixMessage += " <\(error)>" - } - } else if errorType != nil || closure != nil { - failureMessage.postfixMessage += " from type <\(T.self)>" - } - if let _ = closure { - failureMessage.postfixMessage += " that satisfies block" - } - if error == nil && errorType == nil && closure == nil { - failureMessage.postfixMessage = "\(postfixMessageVerb) any error" - } - - if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" - } else { - failureMessage.actualValue = "no error" - } -} - -internal func errorMatchesExpectedError( - _ actualError: Error, - expectedError: T) -> Bool { - return actualError._domain == expectedError._domain - && actualError._code == expectedError._code -} - -internal func errorMatchesExpectedError( - _ actualError: Error, - expectedError: T) -> Bool - where T: Equatable -{ - if let actualError = actualError as? T { - return actualError == expectedError - } - return false -} - -internal func errorMatchesNonNilFieldsOrClosure( - _ actualError: Error?, - error: T? = nil, - errorType: T.Type? = nil, - closure: ((T) -> Void)? = nil) -> Bool { - var matches = false - - if let actualError = actualError { - matches = true - - if let error = error { - if !errorMatchesExpectedError(actualError, expectedError: error) { - matches = false - } - } - if let actualError = actualError as? T { - if let closure = closure { - let assertions = gatherFailingExpectations { - closure(actualError as T) - } - let messages = assertions.map { $0.message } - if messages.count > 0 { - matches = false - } - } - } else if errorType != nil && closure != nil { - // The closure expects another ErrorProtocol as argument, so this - // is _supposed_ to fail, so that it becomes more obvious. - let assertions = gatherExpectations { - expect(actualError is T).to(equal(true)) - } - precondition(assertions.map { $0.message }.count > 0) - matches = false - } - } - - return matches -} - -// Non-generic - -internal func setFailureMessageForError( - _ failureMessage: FailureMessage, - actualError: Error?, - closure: ((Error) -> Void)?) { - failureMessage.postfixMessage = "throw error" - - if let _ = closure { - failureMessage.postfixMessage += " that satisfies block" - } else { - failureMessage.postfixMessage = "throw any error" - } - - if let actualError = actualError { - failureMessage.actualValue = "<\(actualError)>" - } else { - failureMessage.actualValue = "no error" - } -} - -internal func errorMatchesNonNilFieldsOrClosure( - _ actualError: Error?, - closure: ((Error) -> Void)?) -> Bool { - var matches = false - - if let actualError = actualError { - matches = true - - if let closure = closure { - let assertions = gatherFailingExpectations { - closure(actualError) - } - let messages = assertions.map { $0.message } - if messages.count > 0 { - matches = false - } - } - } - - return matches -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Utils/Functional.swift b/Example/Pods/Nimble/Sources/Nimble/Utils/Functional.swift deleted file mode 100644 index 6c5126a..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Utils/Functional.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -extension Sequence { - internal func all(_ fn: (Iterator.Element) -> Bool) -> Bool { - for item in self { - if !fn(item) { - return false - } - } - return true - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift b/Example/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift deleted file mode 100644 index a7279aa..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Utils/SourceLocation.swift +++ /dev/null @@ -1,31 +0,0 @@ -import Foundation - -// Ideally we would always use `StaticString` as the type for tracking the file name -// that expectations originate from, for consistency with `assert` etc. from the -// stdlib, and because recent versions of the XCTest overlay require `StaticString` -// when calling `XCTFail`. Under the Objective-C runtime (i.e. building on Mac), we -// have to use `String` instead because StaticString can't be generated from Objective-C -#if _runtime(_ObjC) -public typealias FileString = String -#else -public typealias FileString = StaticString -#endif - -public final class SourceLocation : NSObject { - public let file: FileString - public let line: UInt - - override init() { - file = "Unknown File" - line = 0 - } - - init(file: FileString, line: UInt) { - self.file = file - self.line = line - } - - override public var description: String { - return "\(file):\(line)" - } -} diff --git a/Example/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift b/Example/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift deleted file mode 100644 index 012e1e3..0000000 --- a/Example/Pods/Nimble/Sources/Nimble/Utils/Stringers.swift +++ /dev/null @@ -1,213 +0,0 @@ -import Foundation - - -internal func identityAsString(_ value: Any?) -> String { - let anyObject: AnyObject? -#if os(Linux) - anyObject = value as? AnyObject -#else - anyObject = value as AnyObject? -#endif - if let value = anyObject { - return NSString(format: "<%p>", unsafeBitCast(value, to: Int.self)).description - } else { - return "nil" - } -} - -internal func arrayAsString(_ items: [T], joiner: String = ", ") -> String { - return items.reduce("") { accum, item in - let prefix = (accum.isEmpty ? "" : joiner) - return accum + prefix + "\(stringify(item))" - } -} - -/// A type with a customized test output text representation. -/// -/// This textual representation is produced when values will be -/// printed in test runs, and may be useful when producing -/// error messages in custom matchers. -/// -/// - SeeAlso: `CustomDebugStringConvertible` -public protocol TestOutputStringConvertible { - var testDescription: String { get } -} - -extension Double: TestOutputStringConvertible { - public var testDescription: String { - return NSNumber(value: self).testDescription - } -} - -extension Float: TestOutputStringConvertible { - public var testDescription: String { - return NSNumber(value: self).testDescription - } -} - -extension NSNumber: TestOutputStringConvertible { - // This is using `NSString(format:)` instead of - // `String(format:)` because the latter somehow breaks - // the travis CI build on linux. - public var testDescription: String { - let description = self.description - - if description.contains(".") { - // Travis linux swiftpm build doesn't like casting String to NSString, - // which is why this annoying nested initializer thing is here. - // Maybe this will change in a future snapshot. - let decimalPlaces = NSString(string: NSString(string: description) - .components(separatedBy: ".")[1]) - - // SeeAlso: https://bugs.swift.org/browse/SR-1464 - switch decimalPlaces.length { - case 1: - return NSString(format: "%0.1f", self.doubleValue).description - case 2: - return NSString(format: "%0.2f", self.doubleValue).description - case 3: - return NSString(format: "%0.3f", self.doubleValue).description - default: - return NSString(format: "%0.4f", self.doubleValue).description - } - } - return self.description - } -} - -extension Array: TestOutputStringConvertible { - public var testDescription: String { - let list = self.map(Nimble.stringify).joined(separator: ", ") - return "[\(list)]" - } -} - -extension AnySequence: TestOutputStringConvertible { - public var testDescription: String { - let generator = self.makeIterator() - var strings = [String]() - var value: AnySequence.Iterator.Element? - - repeat { - value = generator.next() - if let value = value { - strings.append(stringify(value)) - } - } while value != nil - - let list = strings.joined(separator: ", ") - return "[\(list)]" - } -} - -extension NSArray: TestOutputStringConvertible { - public var testDescription: String { - let list = Array(self).map(Nimble.stringify).joined(separator: ", ") - return "(\(list))" - } -} - -extension NSIndexSet: TestOutputStringConvertible { - public var testDescription: String { - let list = Array(self).map(Nimble.stringify).joined(separator: ", ") - return "(\(list))" - } -} - -extension String: TestOutputStringConvertible { - public var testDescription: String { - return self - } -} - -extension Data: TestOutputStringConvertible { - public var testDescription: String { - #if os(Linux) - // FIXME: Swift on Linux triggers a segfault when calling NSData's hash() (last checked on 03-11-16) - return "Data" - #else - return "Data" - #endif - } -} - -/// -/// Returns a string appropriate for displaying in test output -/// from the provided value. -/// -/// - parameter value: A value that will show up in a test's output. -/// -/// - returns: The string that is returned can be -/// customized per type by conforming a type to the `TestOutputStringConvertible` -/// protocol. When stringifying a non-`TestOutputStringConvertible` type, this -/// function will return the value's debug description and then its -/// normal description if available and in that order. Otherwise it -/// will return the result of constructing a string from the value. -/// -/// - SeeAlso: `TestOutputStringConvertible` -public func stringify(_ value: T) -> String { - if let value = value as? TestOutputStringConvertible { - return value.testDescription - } - - if let value = value as? CustomDebugStringConvertible { - return value.debugDescription - } - - return String(describing: value) -} - -/// -SeeAlso: `stringify(value: T)` -public func stringify(_ value: T?) -> String { - if let unboxed = value { - return stringify(unboxed) - } - return "nil" -} - -#if _runtime(_ObjC) -@objc public class NMBStringer: NSObject { - @objc public class func stringify(_ obj: Any?) -> String { - return Nimble.stringify(obj) - } -} -#endif - -// MARK: Collection Type Stringers - -/// Attempts to generate a pretty type string for a given value. If the value is of a Objective-C -/// collection type, or a subclass thereof, (e.g. `NSArray`, `NSDictionary`, etc.). -/// This function will return the type name of the root class of the class cluster for better -/// readability (e.g. `NSArray` instead of `__NSArrayI`). -/// -/// For values that don't have a type of an Objective-C collection, this function returns the -/// default type description. -/// -/// - parameter value: A value that will be used to determine a type name. -/// -/// - returns: The name of the class cluster root class for Objective-C collection types, or the -/// the `dynamicType` of the value for values of any other type. -public func prettyCollectionType(_ value: T) -> String { - switch value { - case is NSArray: - return String(describing: NSArray.self) - case is NSDictionary: - return String(describing: NSDictionary.self) - case is NSSet: - return String(describing: NSSet.self) - case is NSIndexSet: - return String(describing: NSIndexSet.self) - default: - return String(describing: value) - } -} - -/// Returns the type name for a given collection type. This overload is used by Swift -/// collection types. -/// -/// - parameter collection: A Swift `CollectionType` value. -/// -/// - returns: A string representing the `dynamicType` of the value. -public func prettyCollectionType(_ collection: T) -> String { - return String(describing: type(of: collection)) -} diff --git a/Example/Pods/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h b/Example/Pods/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h deleted file mode 100644 index 5d416e4..0000000 --- a/Example/Pods/Nimble/Sources/NimbleObjectiveC/CurrentTestCaseTracker.h +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import - -SWIFT_CLASS("_TtC6Nimble22CurrentTestCaseTracker") -@interface CurrentTestCaseTracker : NSObject -+ (CurrentTestCaseTracker *)sharedInstance; -@end - -@interface CurrentTestCaseTracker (Register) @end diff --git a/Example/Pods/Nimble/Sources/NimbleObjectiveC/DSL.h b/Example/Pods/Nimble/Sources/NimbleObjectiveC/DSL.h deleted file mode 100644 index a499059..0000000 --- a/Example/Pods/Nimble/Sources/NimbleObjectiveC/DSL.h +++ /dev/null @@ -1,145 +0,0 @@ -#import - -@class NMBExpectation; -@class NMBObjCBeCloseToMatcher; -@class NMBObjCRaiseExceptionMatcher; -@protocol NMBMatcher; - - -#define NIMBLE_EXPORT FOUNDATION_EXPORT - -#ifdef NIMBLE_DISABLE_SHORT_SYNTAX -#define NIMBLE_SHORT(PROTO, ORIGINAL) -#else -#define NIMBLE_SHORT(PROTO, ORIGINAL) FOUNDATION_STATIC_INLINE PROTO { return (ORIGINAL); } -#endif - -NIMBLE_EXPORT NMBExpectation *NMB_expect(id(^actualBlock)(), NSString *file, NSUInteger line); -NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line); - -NIMBLE_EXPORT id NMB_equal(id expectedValue); -NIMBLE_SHORT(id equal(id expectedValue), - NMB_equal(expectedValue)); - -NIMBLE_EXPORT id NMB_haveCount(id expectedValue); -NIMBLE_SHORT(id haveCount(id expectedValue), - NMB_haveCount(expectedValue)); - -NIMBLE_EXPORT NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue); -NIMBLE_SHORT(NMBObjCBeCloseToMatcher *beCloseTo(id expectedValue), - NMB_beCloseTo(expectedValue)); - -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass); -NIMBLE_SHORT(id beAnInstanceOf(Class expectedClass), - NMB_beAnInstanceOf(expectedClass)); - -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass); -NIMBLE_SHORT(id beAKindOf(Class expectedClass), - NMB_beAKindOf(expectedClass)); - -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring); -NIMBLE_SHORT(id beginWith(id itemElementOrSubstring), - NMB_beginWith(itemElementOrSubstring)); - -NIMBLE_EXPORT id NMB_beGreaterThan(NSNumber *expectedValue); -NIMBLE_SHORT(id beGreaterThan(NSNumber *expectedValue), - NMB_beGreaterThan(expectedValue)); - -NIMBLE_EXPORT id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue); -NIMBLE_SHORT(id beGreaterThanOrEqualTo(NSNumber *expectedValue), - NMB_beGreaterThanOrEqualTo(expectedValue)); - -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance); -NIMBLE_SHORT(id beIdenticalTo(id expectedInstance), - NMB_beIdenticalTo(expectedInstance)); - -NIMBLE_EXPORT id NMB_be(id expectedInstance); -NIMBLE_SHORT(id be(id expectedInstance), - NMB_be(expectedInstance)); - -NIMBLE_EXPORT id NMB_beLessThan(NSNumber *expectedValue); -NIMBLE_SHORT(id beLessThan(NSNumber *expectedValue), - NMB_beLessThan(expectedValue)); - -NIMBLE_EXPORT id NMB_beLessThanOrEqualTo(NSNumber *expectedValue); -NIMBLE_SHORT(id beLessThanOrEqualTo(NSNumber *expectedValue), - NMB_beLessThanOrEqualTo(expectedValue)); - -NIMBLE_EXPORT id NMB_beTruthy(void); -NIMBLE_SHORT(id beTruthy(void), - NMB_beTruthy()); - -NIMBLE_EXPORT id NMB_beFalsy(void); -NIMBLE_SHORT(id beFalsy(void), - NMB_beFalsy()); - -NIMBLE_EXPORT id NMB_beTrue(void); -NIMBLE_SHORT(id beTrue(void), - NMB_beTrue()); - -NIMBLE_EXPORT id NMB_beFalse(void); -NIMBLE_SHORT(id beFalse(void), - NMB_beFalse()); - -NIMBLE_EXPORT id NMB_beNil(void); -NIMBLE_SHORT(id beNil(void), - NMB_beNil()); - -NIMBLE_EXPORT id NMB_beEmpty(void); -NIMBLE_SHORT(id beEmpty(void), - NMB_beEmpty()); - -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) NS_REQUIRES_NIL_TERMINATION; -#define NMB_contain(...) NMB_containWithNilTermination(__VA_ARGS__, nil) -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define contain(...) NMB_contain(__VA_ARGS__) -#endif - -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring); -NIMBLE_SHORT(id endWith(id itemElementOrSubstring), - NMB_endWith(itemElementOrSubstring)); - -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException(void); -NIMBLE_SHORT(NMBObjCRaiseExceptionMatcher *raiseException(void), - NMB_raiseException()); - -NIMBLE_EXPORT id NMB_match(id expectedValue); -NIMBLE_SHORT(id match(id expectedValue), - NMB_match(expectedValue)); - -NIMBLE_EXPORT id NMB_allPass(id matcher); -NIMBLE_SHORT(id allPass(id matcher), - NMB_allPass(matcher)); - -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers); -#define NMB_satisfyAnyOf(...) NMB_satisfyAnyOfWithMatchers(@[__VA_ARGS__]) -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define satisfyAnyOf(...) NMB_satisfyAnyOf(__VA_ARGS__) -#endif - -// In order to preserve breakpoint behavior despite using macros to fill in __FILE__ and __LINE__, -// define a builder that populates __FILE__ and __LINE__, and returns a block that takes timeout -// and action arguments. See https://github.com/Quick/Quick/pull/185 for details. -typedef void (^NMBWaitUntilTimeoutBlock)(NSTimeInterval timeout, void (^action)(void (^)(void))); -typedef void (^NMBWaitUntilBlock)(void (^action)(void (^)(void))); - -NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); - -NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line); -NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line); - -NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line); - -#define NMB_waitUntilTimeout NMB_waitUntilTimeoutBuilder(@(__FILE__), __LINE__) -#define NMB_waitUntil NMB_waitUntilBuilder(@(__FILE__), __LINE__) - -#ifndef NIMBLE_DISABLE_SHORT_SYNTAX -#define expect(...) NMB_expect(^id{ return (__VA_ARGS__); }, @(__FILE__), __LINE__) -#define expectAction(BLOCK) NMB_expectAction((BLOCK), @(__FILE__), __LINE__) -#define failWithMessage(msg) NMB_failWithMessage(msg, @(__FILE__), __LINE__) -#define fail() failWithMessage(@"fail() always fails") - - -#define waitUntilTimeout NMB_waitUntilTimeout -#define waitUntil NMB_waitUntil -#endif diff --git a/Example/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m b/Example/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m deleted file mode 100644 index 2170238..0000000 --- a/Example/Pods/Nimble/Sources/NimbleObjectiveC/DSL.m +++ /dev/null @@ -1,150 +0,0 @@ -#import -#import - -SWIFT_CLASS("_TtC6Nimble7NMBWait") -@interface NMBWait : NSObject - -+ (void)untilTimeout:(NSTimeInterval)timeout file:(NSString *)file line:(NSUInteger)line action:(void(^)())action; -+ (void)untilFile:(NSString *)file line:(NSUInteger)line action:(void(^)())action; - -@end - -NIMBLE_EXPORT NMBExpectation *NMB_expect(id(^actualBlock)(), NSString *file, NSUInteger line) { - return [[NMBExpectation alloc] initWithActualBlock:actualBlock - negative:NO - file:file - line:line]; -} - -NIMBLE_EXPORT NMBExpectation *NMB_expectAction(void(^actualBlock)(), NSString *file, NSUInteger line) { - return NMB_expect(^id{ - actualBlock(); - return nil; - }, file, line); -} - -NIMBLE_EXPORT void NMB_failWithMessage(NSString *msg, NSString *file, NSUInteger line) { - return [NMBExpectation failWithMessage:msg file:file line:line]; -} - -NIMBLE_EXPORT id NMB_beAnInstanceOf(Class expectedClass) { - return [NMBObjCMatcher beAnInstanceOfMatcher:expectedClass]; -} - -NIMBLE_EXPORT id NMB_beAKindOf(Class expectedClass) { - return [NMBObjCMatcher beAKindOfMatcher:expectedClass]; -} - -NIMBLE_EXPORT NMBObjCBeCloseToMatcher *NMB_beCloseTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beCloseToMatcher:expectedValue within:0.001]; -} - -NIMBLE_EXPORT id NMB_beginWith(id itemElementOrSubstring) { - return [NMBObjCMatcher beginWithMatcher:itemElementOrSubstring]; -} - -NIMBLE_EXPORT id NMB_beGreaterThan(NSNumber *expectedValue) { - return [NMBObjCMatcher beGreaterThanMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_beGreaterThanOrEqualTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beGreaterThanOrEqualToMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_beIdenticalTo(id expectedInstance) { - return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; -} - -NIMBLE_EXPORT id NMB_be(id expectedInstance) { - return [NMBObjCMatcher beIdenticalToMatcher:expectedInstance]; -} - -NIMBLE_EXPORT id NMB_beLessThan(NSNumber *expectedValue) { - return [NMBObjCMatcher beLessThanMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_beLessThanOrEqualTo(NSNumber *expectedValue) { - return [NMBObjCMatcher beLessThanOrEqualToMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_beTruthy() { - return [NMBObjCMatcher beTruthyMatcher]; -} - -NIMBLE_EXPORT id NMB_beFalsy() { - return [NMBObjCMatcher beFalsyMatcher]; -} - -NIMBLE_EXPORT id NMB_beTrue() { - return [NMBObjCMatcher beTrueMatcher]; -} - -NIMBLE_EXPORT id NMB_beFalse() { - return [NMBObjCMatcher beFalseMatcher]; -} - -NIMBLE_EXPORT id NMB_beNil() { - return [NMBObjCMatcher beNilMatcher]; -} - -NIMBLE_EXPORT id NMB_beEmpty() { - return [NMBObjCMatcher beEmptyMatcher]; -} - -NIMBLE_EXPORT id NMB_containWithNilTermination(id itemOrSubstring, ...) { - NSMutableArray *itemOrSubstringArray = [NSMutableArray array]; - - if (itemOrSubstring) { - [itemOrSubstringArray addObject:itemOrSubstring]; - - va_list args; - va_start(args, itemOrSubstring); - id next; - while ((next = va_arg(args, id))) { - [itemOrSubstringArray addObject:next]; - } - va_end(args); - } - - return [NMBObjCMatcher containMatcher:itemOrSubstringArray]; -} - -NIMBLE_EXPORT id NMB_endWith(id itemElementOrSubstring) { - return [NMBObjCMatcher endWithMatcher:itemElementOrSubstring]; -} - -NIMBLE_EXPORT id NMB_equal(id expectedValue) { - return [NMBObjCMatcher equalMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_haveCount(id expectedValue) { - return [NMBObjCMatcher haveCountMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_match(id expectedValue) { - return [NMBObjCMatcher matchMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_allPass(id expectedValue) { - return [NMBObjCMatcher allPassMatcher:expectedValue]; -} - -NIMBLE_EXPORT id NMB_satisfyAnyOfWithMatchers(id matchers) { - return [NMBObjCMatcher satisfyAnyOfMatcher:matchers]; -} - -NIMBLE_EXPORT NMBObjCRaiseExceptionMatcher *NMB_raiseException() { - return [NMBObjCMatcher raiseExceptionMatcher]; -} - -NIMBLE_EXPORT NMBWaitUntilTimeoutBlock NMB_waitUntilTimeoutBuilder(NSString *file, NSUInteger line) { - return ^(NSTimeInterval timeout, void (^action)(void (^)(void))) { - [NMBWait untilTimeout:timeout file:file line:line action:action]; - }; -} - -NIMBLE_EXPORT NMBWaitUntilBlock NMB_waitUntilBuilder(NSString *file, NSUInteger line) { - return ^(void (^action)(void (^)(void))) { - [NMBWait untilFile:file line:line action:action]; - }; -} diff --git a/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.h b/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.h deleted file mode 100644 index e0ec05a..0000000 --- a/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.h +++ /dev/null @@ -1,11 +0,0 @@ -#import -#import - -@interface NMBExceptionCapture : NSObject - -- (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)())finally; -- (void)tryBlock:(void(^ _Nonnull)())unsafeBlock NS_SWIFT_NAME(tryBlock(_:)); - -@end - -typedef void(^NMBSourceCallbackBlock)(BOOL successful); diff --git a/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m b/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m deleted file mode 100644 index 0a882b7..0000000 --- a/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBExceptionCapture.m +++ /dev/null @@ -1,35 +0,0 @@ -#import "NMBExceptionCapture.h" - -@interface NMBExceptionCapture () -@property (nonatomic, copy) void(^ _Nullable handler)(NSException * _Nullable); -@property (nonatomic, copy) void(^ _Nullable finally)(); -@end - -@implementation NMBExceptionCapture - -- (nonnull instancetype)initWithHandler:(void(^ _Nullable)(NSException * _Nonnull))handler finally:(void(^ _Nullable)())finally { - self = [super init]; - if (self) { - self.handler = handler; - self.finally = finally; - } - return self; -} - -- (void)tryBlock:(void(^ _Nonnull)())unsafeBlock { - @try { - unsafeBlock(); - } - @catch (NSException *exception) { - if (self.handler) { - self.handler(exception); - } - } - @finally { - if (self.finally) { - self.finally(); - } - } -} - -@end diff --git a/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.h b/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.h deleted file mode 100644 index e5d5ddd..0000000 --- a/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.h +++ /dev/null @@ -1,18 +0,0 @@ -@class NSString; - -/** - * Returns a string appropriate for displaying in test output - * from the provided value. - * - * @param value A value that will show up in a test's output. - * - * @return The string that is returned can be - * customized per type by conforming a type to the `TestOutputStringConvertible` - * protocol. When stringifying a non-`TestOutputStringConvertible` type, this - * function will return the value's debug description and then its - * normal description if available and in that order. Otherwise it - * will return the result of constructing a string from the value. - * - * @see `TestOutputStringConvertible` - */ -extern NSString *_Nonnull NMBStringify(id _Nullable anyObject) __attribute__((warn_unused_result)); diff --git a/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m b/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m deleted file mode 100644 index 329d39a..0000000 --- a/Example/Pods/Nimble/Sources/NimbleObjectiveC/NMBStringify.m +++ /dev/null @@ -1,6 +0,0 @@ -#import "NMBStringify.h" -#import - -NSString *_Nonnull NMBStringify(id _Nullable anyObject) { - return [NMBStringer stringify:anyObject]; -} diff --git a/Example/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m b/Example/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m deleted file mode 100644 index 35f26fd..0000000 --- a/Example/Pods/Nimble/Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m +++ /dev/null @@ -1,78 +0,0 @@ -#import "CurrentTestCaseTracker.h" -#import -#import - -#pragma mark - Method Swizzling - -/// Swaps the implementations between two instance methods. -/// -/// @param class The class containing `originalSelector`. -/// @param originalSelector Original method to replace. -/// @param replacementSelector Replacement method. -void swizzleSelectors(Class class, SEL originalSelector, SEL replacementSelector) { - Method originalMethod = class_getInstanceMethod(class, originalSelector); - Method replacementMethod = class_getInstanceMethod(class, replacementSelector); - - BOOL didAddMethod = - class_addMethod(class, - originalSelector, - method_getImplementation(replacementMethod), - method_getTypeEncoding(replacementMethod)); - - if (didAddMethod) { - class_replaceMethod(class, - replacementSelector, - method_getImplementation(originalMethod), - method_getTypeEncoding(originalMethod)); - } else { - method_exchangeImplementations(originalMethod, replacementMethod); - } -} - -#pragma mark - Private - -@interface XCTestObservationCenter (Private) -- (void)_addLegacyTestObserver:(id)observer; -@end - -@implementation XCTestObservationCenter (Register) - -/// Uses objc method swizzling to register `CurrentTestCaseTracker` as a test observer. This is necessary -/// because Xcode 7.3 introduced timing issues where if a custom `XCTestObservation` is registered too early -/// it suppresses all console output (generated by `XCTestLog`), breaking any tools that depend on this output. -/// This approach waits to register our custom test observer until XCTest adds its first "legacy" observer, -/// falling back to registering after the first normal observer if this private method ever changes. -+ (void)load { - if (class_getInstanceMethod([self class], @selector(_addLegacyTestObserver:))) { - // Swizzle -_addLegacyTestObserver: - swizzleSelectors([self class], @selector(_addLegacyTestObserver:), @selector(NMB_original__addLegacyTestObserver:)); - } else { - // Swizzle -addTestObserver:, only if -_addLegacyTestObserver: is not implemented - swizzleSelectors([self class], @selector(addTestObserver:), @selector(NMB_original_addTestObserver:)); - } -} - -#pragma mark - Replacement Methods - -/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. -- (void)NMB_original__addLegacyTestObserver:(id)observer { - [self NMB_original__addLegacyTestObserver:observer]; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self addTestObserver:[CurrentTestCaseTracker sharedInstance]]; - }); -} - -/// Registers `CurrentTestCaseTracker` as a test observer after `XCTestLog` has been added. -/// This method is only used if `-_addLegacyTestObserver:` is not impelemented. (added in Xcode 7.3) -- (void)NMB_original_addTestObserver:(id)observer { - [self NMB_original_addTestObserver:observer]; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - [self NMB_original_addTestObserver:[CurrentTestCaseTracker sharedInstance]]; - }); -} - -@end diff --git a/Example/Pods/Pods.xcodeproj/project.pbxproj b/Example/Pods/Pods.xcodeproj/project.pbxproj deleted file mode 100644 index 1edb8d3..0000000 --- a/Example/Pods/Pods.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1622 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 00108271735E1EE8FA75113665E19094 /* QuickConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = CD9826D94204E654BF284FABE0DE9080 /* QuickConfiguration.m */; }; - 020490E23A457AA6C5225F987FCD4A11 /* QuickSelectedTestSuiteBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2B3D2A511ABD07C71795094294E77B6 /* QuickSelectedTestSuiteBuilder.swift */; }; - 04A5E25C4F97A20FA1D9F78FD9C600EC /* ExampleMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C4A1DB49FB1E0D3DDF5ACAA8214E142 /* ExampleMetadata.swift */; }; - 099C64CF560DC424DB43BBBEC6370D8F /* ThrowError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BCA8F6E037503D1D1A3BF2AE985DBD4 /* ThrowError.swift */; }; - 0B47A68C46377DBA4202C8E639A09A8F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAC405455F8E20BD0434D9D3E3D2879A /* Foundation.framework */; }; - 0C1B4E9FFB8B81E8833A3BAD537B1990 /* Notifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9AFF2CE688220EC8739E3C7E081AFFFE /* Notifications.swift */; }; - 0F912C0552897372E48E491EE7DA4CD9 /* Example.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED03CE532165C08714B8AF386473C7C3 /* Example.swift */; }; - 12118C354EFA36292F82A8D0CFCE45B2 /* Request.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC14AC486E814663708CBF1BD2183F98 /* Request.swift */; }; - 197C8AB9D9A745366D2B17418DAD1C70 /* Reqres-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 509381936A357FAF39771F01C22197C6 /* Reqres-dummy.m */; }; - 21FCC4B725EAF5F42EDFDA386FF3EC4C /* BeNil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 23624E29201D23741F621FB91ABA61F1 /* BeNil.swift */; }; - 24AE47A6560D6EBB0AFF78BAAAB15E0F /* AsyncMatcherWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33B735E68570E6B4FB37A5E6B0A3197D /* AsyncMatcherWrapper.swift */; }; - 263465A57520B440C99D428CE2E51AE9 /* NimbleEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = E10B2E6B6FAE05CAF11A950BDC432CD0 /* NimbleEnvironment.swift */; }; - 26ED92B1BA35D06041238B9D89531681 /* QuickSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E65D56F7E6E7835B3D25C3F9AE31A19 /* QuickSpec.m */; }; - 2E6617743E0555D2A6C11BFBE3C6AF14 /* QuickConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = DD232A4ECE04A556147CF948C561EDCC /* QuickConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 30C8E85CB7BFBC77354F5422D9DFA9D0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAC405455F8E20BD0434D9D3E3D2879A /* Foundation.framework */; }; - 344BEE9094F8B903BDACA3AB5811436C /* DSL.m in Sources */ = {isa = PBXBuildFile; fileRef = B397AAFB422115DC2D226D9AD136F043 /* DSL.m */; }; - 35E0EBA7AA92E190AB5B4ACFCF0F61C4 /* AssertionDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B8682B68A79F5C29344B74E5D8B59C5 /* AssertionDispatcher.swift */; }; - 39007AD3711A35BCFA1D853E7AB79510 /* BeLessThanOrEqual.swift in Sources */ = {isa = PBXBuildFile; fileRef = 40EEBA222B9A66B5770DA5C21ADC942A /* BeLessThanOrEqual.swift */; }; - 3982B850C43B41BA6D25F440F0412E9B /* Timeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = A882A7F13421DD3C5D5EBB4531F14EBF /* Timeline.swift */; }; - 3B78C4F35C369FBABE62D4622A67E7DF /* DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A15BDDDC13079AF4055E4C64A233235 /* DSL.swift */; }; - 3C5C0BABD550366FB937A5910346E06A /* String+FileName.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E22B9E873270575B23F3393663C4216 /* String+FileName.swift */; }; - 3C918E40C04067FAF57B447C0BC52B04 /* BeGreaterThanOrEqualTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E8ED9279A4C150D3E941ADD0449A55E /* BeGreaterThanOrEqualTo.swift */; }; - 3D7AF86E9032C99357D2ED046461874F /* BeGreaterThan.swift in Sources */ = {isa = PBXBuildFile; fileRef = 827B1D48D3024B63A137B38DD82AEF3A /* BeGreaterThan.swift */; }; - 3D82543008EFDDDF3F5C369C20393F44 /* QuickSpec.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BF85957A29A48D3C698A0FAC6B44CE5 /* QuickSpec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3E2EDFA9F3C98AC672415C4F5A19ACEB /* World+DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AD8CA8D8C6C6B54E4F633CF187DF6CB /* World+DSL.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 403F8AA1758D3813A88FEE96265F6345 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAC405455F8E20BD0434D9D3E3D2879A /* Foundation.framework */; }; - 413EC24D3649EA8C9102CB837C303116 /* World+DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA469805EB84A35F071E54AD4777BBFA /* World+DSL.swift */; }; - 41EE5E3698CC1A17046AC74B36A279E0 /* RaisesException.swift in Sources */ = {isa = PBXBuildFile; fileRef = 536EDB7EA0B0CB18BB271C7D03B18955 /* RaisesException.swift */; }; - 421C068CCF276223CD76D9875DB0C537 /* DSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D4DC56E7E27742D48B967898EA7509F /* DSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 4299889F289E0AD046591E54E1E7A092 /* QuickTestSuite.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9BC97CD3D0911838C1503618B39A12 /* QuickTestSuite.swift */; }; - 43B99F06587ACD844A4D09A0ED9FB66B /* Stringers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C6A2DA9B883B186EBEDE0D8603F43C4 /* Stringers.swift */; }; - 43E00A0BC15929DC049263BB18D1A174 /* Closures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6D27828E711F1F98C5573E4C8183CCCB /* Closures.swift */; }; - 45A59CE9EF13570DF800D9D7A655639A /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = C8F4C33A066630DF2DB96F35A264414A /* XCTestSuite+QuickTestSuiteBuilder.m */; }; - 522E7C454877ACD8AB3D06601E7770AE /* CurrentTestCaseTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E9689D18BF7A0DDDD527189CB7F62F9 /* CurrentTestCaseTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 52BE965EEAE95A49CBCD52A8B98883DD /* World.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F517A2122E499608F7637877D5882EB /* World.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 56CA153033917F08CCDD22E94806C873 /* MatchError.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9B73355601BF456F877EC6849C246E7 /* MatchError.swift */; }; - 58443B34A20492445C9A3FAFC3FC73C4 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAC405455F8E20BD0434D9D3E3D2879A /* Foundation.framework */; }; - 5982AF99D452796006EA3EA5FA74D5EF /* Pods-Reqres_Example-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B73D17573C73C936A7932B22CE48C5BB /* Pods-Reqres_Example-dummy.m */; }; - 59A4C06B57864AA9BBFAE0B762DAE871 /* BeLessThan.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB413599E15246AD4C188D96C26CF818 /* BeLessThan.swift */; }; - 59AFC17D744CDEED360B4DF8876295BF /* Errors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B8A31854AF673C0A03DA8A7F7D0B680 /* Errors.swift */; }; - 5A4AC5619A05687E5EB0A4BBDC8AF154 /* AllPass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6BAFD97050B825756746D041C76E1C58 /* AllPass.swift */; }; - 5B21B2BBADCCEB5AC51E0A0C99BA5B93 /* Expression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09437B78959EAC9C806BAEB14A6B7 /* Expression.swift */; }; - 5B5708F7FC8AAB9F39B807AA9FC9A6ED /* NSBundle+CurrentTestBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6620081B0B86AE39437EB606A63CB77 /* NSBundle+CurrentTestBundle.swift */; }; - 602B5CEB21CA60AFA67B508D13282E94 /* BeCloseTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89DF4D1D462D663A4333AFA482E86D58 /* BeCloseTo.swift */; }; - 62143065F94E53F437DCE5D7A998D66D /* AFError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93FA7052FC9C69BB15A90CBD08DB442D /* AFError.swift */; }; - 6445B28465C1A7900E895709BC333C23 /* Contain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 438F3C460B93515CDC816086C38AE814 /* Contain.swift */; }; - 684A7E4C24ADAAB1B497B5F658036FC2 /* Functional.swift in Sources */ = {isa = PBXBuildFile; fileRef = EFE95968E20FB7BA3DD7C445F0D6F486 /* Functional.swift */; }; - 6ED1391B5926E46DB0D7B6E70A130519 /* Quick.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F56727F0C8108AF020246DF08D61062 /* Quick.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7070E1BDFFD9D6D40C6ED465BD5C58CB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAC405455F8E20BD0434D9D3E3D2879A /* Foundation.framework */; }; - 73B8C261F61C81EE16432ADB071322D9 /* Quick-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D1FB5CE89C2EFA5D18A75B04D6F03983 /* Quick-dummy.m */; }; - 74C0C955A968122899AB6E0DA79D3FA0 /* NMBObjCMatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 011C62CD7B0A0767543DC78391033A80 /* NMBObjCMatcher.swift */; }; - 7A902FFCC4C64E9AE4C5F09E7A4846FD /* QCKDSL.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F1C7C6284D9A0C72B0027FE2D0BF854 /* QCKDSL.m */; }; - 7ABCA22102C314C0532B5D43A404C3EF /* ReqresLogging.swift in Sources */ = {isa = PBXBuildFile; fileRef = F59C456EE0D76A865A5351ADD79B0FEB /* ReqresLogging.swift */; }; - 7AC642E623A0CA5BDCA914E92C09D683 /* SuiteHooks.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6CF6EE532D517FB4D5829438880944D /* SuiteHooks.swift */; }; - 7B55996F605148A8E6522A2B35E08B2A /* Reqres.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C33B81911D1009EF9E91DD9FADB8D83 /* Reqres.swift */; }; - 7CA5A9BA5246FDA8227233E310029392 /* Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CA3147B1C3F1FA21625EA19787BE85E /* Alamofire.swift */; }; - 7F8AC53F92F56C3319DD733CAFB9DD58 /* BeAKindOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0EE7CA1BC958B207B403A5AC1EDA117 /* BeAKindOf.swift */; }; - 8069F3240BE1630BA9FB19C2855CCC55 /* Filter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18E7DC6EF401C7D13449F62E46003B70 /* Filter.swift */; }; - 8074ABFADF57E7226E3155F19EDFCFFA /* Pods-Reqres_Tests-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = F5365670C4DA05846171136BE77EC90E /* Pods-Reqres_Tests-dummy.m */; }; - 86ED08F33B7D357932A9AB743E9D9EA7 /* Response.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7EBE34C479162E17359581DA87EE649A /* Response.swift */; }; - 88F266C0380D5FF237FFED90265AAF5B /* Reqres-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 6432806E4D5140C58B0C2266EC22C76F /* Reqres-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 8D463A0A4C65C02FDD5211F0F3C6F8B8 /* Alamofire-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 348BC5D7CB7F214F7E39BD515B6C0FE9 /* Alamofire-dummy.m */; }; - 8D5E37F86BD198B14C9BF123BC92875E /* NSString+QCKSelectorName.h in Headers */ = {isa = PBXBuildFile; fileRef = DBF741D48F4C7BCE38188CF01544F039 /* NSString+QCKSelectorName.h */; settings = {ATTRIBUTES = (Project, ); }; }; - 8DFE23F2C7973BC8A159168AFC2FB8C3 /* MatcherFunc.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7FAA325E3DA2878A1D1C57E79AE7BD93 /* MatcherFunc.swift */; }; - 9039C8F5B4FA67C3B3ADFB56D7D54567 /* DSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE81928F6AB4FA2FA2DDE0507024E256 /* DSL.swift */; }; - 907AB123FBC8BC9340D5B7350CE828DF /* SessionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 380AFE42EC98D656EFB7DE5FE0010BFD /* SessionDelegate.swift */; }; - 91C09AC2A52ED69A27C8D923139A006F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AAC405455F8E20BD0434D9D3E3D2879A /* Foundation.framework */; }; - 9296C7ABDE9E5894D47CD74E7F78F968 /* Match.swift in Sources */ = {isa = PBXBuildFile; fileRef = 60EF124DAF6834754E3F6397EEB28CFA /* Match.swift */; }; - 92BC58B0158D9DFE7D59C341A85D4359 /* Async.swift in Sources */ = {isa = PBXBuildFile; fileRef = A385E24A9B923F13EDB0A1D427285D7E /* Async.swift */; }; - 9469DF81ECB494E84675969B5E13374C /* Alamofire-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A1C572CBAB6A811E96A2D1E5208B27D /* Alamofire-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 95F54B9537875729AE90B472EA5D39BF /* Expectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18E6EE47FD109AA2905CFE4757830155 /* Expectation.swift */; }; - 9D904B7EAD0EC56AD12E704757CAA640 /* SourceLocation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81289DA09CBA359C3905A3D057FDF5C2 /* SourceLocation.swift */; }; - 9DBED967731DE53C22AD17C3E09079FD /* XCTestObservationCenter+Register.m in Sources */ = {isa = PBXBuildFile; fileRef = 79CE7159A832DBAE73AD0E580A2E8F70 /* XCTestObservationCenter+Register.m */; }; - 9EFD3EE819EB1FAA5EDE26E8DAA483CD /* EndWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAFD198C1C9B13792B7B6B9DB3102B17 /* EndWith.swift */; }; - 9FAF834689D1089199EA4071D647268D /* ErrorUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEB28E0C7E40D2DE1F89347BC36B04F2 /* ErrorUtility.swift */; }; - A18E791645056D5563206104A3E3AD87 /* PostNotification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8D1D9F1723C37AAEFF685CF7BFFDA3BB /* PostNotification.swift */; }; - A1F69DD3961B60955EFD28E2BDF446E8 /* Nimble.h in Headers */ = {isa = PBXBuildFile; fileRef = 8E94146DC960A9B79BA42CB37C9ECD49 /* Nimble.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A65D1DDAA198374D4E35F6565803CB0B /* Callsite.swift in Sources */ = {isa = PBXBuildFile; fileRef = A63BD734476C31962386D9ABE590E0E9 /* Callsite.swift */; }; - A79AC30123B0C2177D67F6ED6A1B3215 /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = CFBE8D4251B6D9900CADB2B55AB7A2F0 /* SessionManager.swift */; }; - A9DA3829FA747E599023EF1394CD2EB5 /* BeVoid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A3F4DB1A0182CEDD285BEC987C49507 /* BeVoid.swift */; }; - AB2B63BFFD7A11E6871B472150F7984B /* NMBExceptionCapture.m in Sources */ = {isa = PBXBuildFile; fileRef = 20C41C7628694A85F9B9F8F5909E0341 /* NMBExceptionCapture.m */; }; - AF158CAAF4DD319009AFC855DC995D90 /* ParameterEncoding.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3594B1EB58F4348F9E443538D216961 /* ParameterEncoding.swift */; }; - B09B3461D9467BA8A230048F95C26E0F /* NimbleXCTestHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9FB45D07752B274B3FFBF71F3829E427 /* NimbleXCTestHandler.swift */; }; - B1E123D009901914E290395975B21D61 /* QCKDSL.h in Headers */ = {isa = PBXBuildFile; fileRef = 350EFC34480AD3054351A5CA57623634 /* QCKDSL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B47F2B1F7F5FEC4CE62F09832392E842 /* Nimble-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 9D18ED0653F3821FD714D45C3FB2C9DD /* Nimble-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B78A3DF47B5FEF7D9BE0B7660500211B /* Equal.swift in Sources */ = {isa = PBXBuildFile; fileRef = 17C09B83DF2DBC7FD3094515D932A48D /* Equal.swift */; }; - B8154C96802336E5DDA5CEE97C3180A0 /* ResponseSerialization.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF19EB840B758BFC7604F2FA8A40C011 /* ResponseSerialization.swift */; }; - BA7362188C5D17958A5080EE299A90FC /* BeginWith.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDA61155F4E87FF643DFB417D575F6A7 /* BeginWith.swift */; }; - BBF88FA3F28C0906DBB78314A8E50A01 /* AssertionRecorder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0EC8493AF8092C8BA937646E829E9FA8 /* AssertionRecorder.swift */; }; - BD0445E39C97A49EAFD877DCA85EF8EA /* NMBExceptionCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = EFA10BA559AB2D9ED52A3348E33B0B08 /* NMBExceptionCapture.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BEA76FA499D5899BD98DBD891FF921D4 /* SatisfyAnyOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B9401B08D42F8010332D7E712D761FA /* SatisfyAnyOf.swift */; }; - BEEBF86D5A86D3AF060556475FBC87DB /* World.swift in Sources */ = {isa = PBXBuildFile; fileRef = 535F4001D4C7D7D3DEE49454E32A1CB9 /* World.swift */; }; - C0AEA97E7684DDAD56998C0AE198A433 /* ServerTrustPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D2F6BDA1F7108E5C967E6388B9A5CB9 /* ServerTrustPolicy.swift */; }; - C10896B1EEB0291A92FBA848007CD7CF /* NMBExpectation.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADFB631202F8CD3CF8A189DBB31303B2 /* NMBExpectation.swift */; }; - C50DC29835E621BFA328E34EF0CC1C19 /* NSString+QCKSelectorName.m in Sources */ = {isa = PBXBuildFile; fileRef = D740AE071DADA2F77CF024B34C3DA9D7 /* NSString+QCKSelectorName.m */; }; - C755136BFCDFA000C44C8BBCA065E4BE /* HaveCount.swift in Sources */ = {isa = PBXBuildFile; fileRef = DA8BC2064846E6835BEE7A96F75024FC /* HaveCount.swift */; }; - C7A3408350643ADE1018826C766EE356 /* MultipartFormData.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5DF3C93FA14E423FB00142564445985 /* MultipartFormData.swift */; }; - C81BEDE79545C013BEBBA0363480FD47 /* DSL+Wait.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35542D7DAE5C35C3180A80222D76E2A9 /* DSL+Wait.swift */; }; - C8396B338542FDF76B0C5129DFD07BF6 /* ExampleGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 848F7BDA9D3EC0F0194594E7D8A19075 /* ExampleGroup.swift */; }; - CEDDDCD36A6FEDB9DD89E6C36C263315 /* ExampleHooks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB4A66982D9D001C082F99ED4D2295F6 /* ExampleHooks.swift */; }; - D211AA615955C84CC367E80EF98A07D6 /* ReqresDefaultLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1563AF60A7B613FD141721F12061D1E /* ReqresDefaultLogger.swift */; }; - D45096E61E72E772AF46C3BECA03583B /* BeLogical.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71FC5E1095ACE2444EA32F49F09F587D /* BeLogical.swift */; }; - D7C35CAE9CCF826D82BD5A331266A765 /* HooksPhase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 052B62C812385AEB80BFB241FA64D9AD /* HooksPhase.swift */; }; - D8E0C72DDE130D4471BB48D2081FD235 /* Nimble-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BC830ABCB90AAFC81A9667A6E90367 /* Nimble-dummy.m */; }; - DE5F3C28CC8C40B8031C784835B3577D /* MatcherProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0646552C78F2637DC856FC99AB181B67 /* MatcherProtocols.swift */; }; - DF1BBF94997A2F4248B42B25EA919EC2 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 368597BA3F3F81400163FED6DFFF2FD3 /* Result.swift */; }; - E008736F5514F44C0E07DD052A7B6D67 /* AdapterProtocols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A915885A77D0F65EB3ECD3A165AC05 /* AdapterProtocols.swift */; }; - E17FEDC343D98DFC9C0182C3DAF4E223 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0744C199F8F5598E4454D6DC99394C01 /* Configuration.swift */; }; - E1F583CB4A68A928CD197250AA752926 /* TaskDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A62862C6D6AF6C83298CFAFE0306DA6D /* TaskDelegate.swift */; }; - E2A1C34237B4E928E5F85C097F4C2551 /* DispatchQueue+Alamofire.swift in Sources */ = {isa = PBXBuildFile; fileRef = EEAAE4F716A05610F6E3AF6389C46438 /* DispatchQueue+Alamofire.swift */; }; - E59BF19C0AFA68B741552319FC478C7B /* NetworkReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74D88BBEF05F7D16545F0602917785A /* NetworkReachabilityManager.swift */; }; - E8A2419F0043F23E2B45D3777FD00B7A /* Pods-Reqres_Example-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = AA4EFEAEC705D23E13D685DF060AEB53 /* Pods-Reqres_Example-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - E8DE03684C234604E472C27ECD8F6B70 /* BeAnInstanceOf.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C33235D630E3A4FD28090344D7F30AA /* BeAnInstanceOf.swift */; }; - EF87716A59442E302F4BF389CAD3B51F /* Pods-Reqres_Tests-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 20C730E21CFC123F0B9793F18EB9B272 /* Pods-Reqres_Tests-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - EFE20ADE81CBE47F13D76267285C4A35 /* FailureMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50875E5EBA8B7F36B0DEEF5A46B447D4 /* FailureMessage.swift */; }; - F2B9936EB479CD49E43B1FD09BDB3787 /* Quick-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = C135A7CE43E332C0C137A84D69D63D20 /* Quick-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - F33721E9B755D9444D470DF133E62563 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B89BF7315BAB3516AF2A51041DC39C3B /* XCTest.framework */; }; - F35657C05DC39E78A33D79BDD92ECA64 /* NMBStringify.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA8F72A19EFA0084D9879A261B009A6 /* NMBStringify.m */; }; - F614EFDFC958434F53DC770F8887170B /* NMBStringify.h in Headers */ = {isa = PBXBuildFile; fileRef = 8EEEB961C9C210C0ED760190DE95B0AD /* NMBStringify.h */; settings = {ATTRIBUTES = (Public, ); }; }; - FA145DCE313D583C0431D178FB32C96F /* BeEmpty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C480202B63222F9DD647A1551E5A95D /* BeEmpty.swift */; }; - FF0366DFC597745127A6D92AB83F0D60 /* BeIdenticalTo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A1E220DE9581AF46897774CF6E805AB /* BeIdenticalTo.swift */; }; - FFFDD494EE6D1B83DDAF5F2721F685A6 /* Validation.swift in Sources */ = {isa = PBXBuildFile; fileRef = F70EB743847946626531E64F9EE4EFC5 /* Validation.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 1BFB69C537F649F1311D9022FBD205F7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 79C040AFDDCE1BCBF6D8B5EB0B85887F; - remoteInfo = Alamofire; - }; - 6E9B59F90D71C9DAF6F966749D3C85DD /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 40FF1C77152F384080A1A02E90A36DA9; - remoteInfo = Nimble; - }; - B03DDDD7FF9D1CEB60ABF96EC1DBDB60 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = C6166AF3164DCCCE00BD8CD1E34FC140; - remoteInfo = Quick; - }; - D985CC6FC55D0CE08D0AB3822BCDE47C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; - proxyType = 1; - remoteGlobalIDString = 7E2461CA3FD3FBFB1776E2F07F628BE5; - remoteInfo = Reqres; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 011C62CD7B0A0767543DC78391033A80 /* NMBObjCMatcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NMBObjCMatcher.swift; path = Sources/Nimble/Adapters/NMBObjCMatcher.swift; sourceTree = ""; }; - 052B62C812385AEB80BFB241FA64D9AD /* HooksPhase.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HooksPhase.swift; path = Sources/Quick/Hooks/HooksPhase.swift; sourceTree = ""; }; - 0646552C78F2637DC856FC99AB181B67 /* MatcherProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatcherProtocols.swift; path = Sources/Nimble/Matchers/MatcherProtocols.swift; sourceTree = ""; }; - 0744C199F8F5598E4454D6DC99394C01 /* Configuration.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Configuration.swift; path = Sources/Quick/Configuration/Configuration.swift; sourceTree = ""; }; - 09D09437B78959EAC9C806BAEB14A6B7 /* Expression.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expression.swift; path = Sources/Nimble/Expression.swift; sourceTree = ""; }; - 0A15BDDDC13079AF4055E4C64A233235 /* DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DSL.swift; path = Sources/Nimble/DSL.swift; sourceTree = ""; }; - 0BF85957A29A48D3C698A0FAC6B44CE5 /* QuickSpec.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QuickSpec.h; path = Sources/QuickObjectiveC/QuickSpec.h; sourceTree = ""; }; - 0C33235D630E3A4FD28090344D7F30AA /* BeAnInstanceOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeAnInstanceOf.swift; path = Sources/Nimble/Matchers/BeAnInstanceOf.swift; sourceTree = ""; }; - 0CBAE2690AAFC9BF21AE7DFA57FE5B76 /* Alamofire-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-prefix.pch"; sourceTree = ""; }; - 0E8ED9279A4C150D3E941ADD0449A55E /* BeGreaterThanOrEqualTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeGreaterThanOrEqualTo.swift; path = Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift; sourceTree = ""; }; - 0EC8493AF8092C8BA937646E829E9FA8 /* AssertionRecorder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssertionRecorder.swift; path = Sources/Nimble/Adapters/AssertionRecorder.swift; sourceTree = ""; }; - 1049A85D4A41AE95C1088280A58DFED2 /* Quick.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Quick.modulemap; sourceTree = ""; }; - 13FA9DF6F16A7AEDE4F81DBFD9C816A7 /* Pods-Reqres_Example-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Reqres_Example-acknowledgements.plist"; sourceTree = ""; }; - 17C09B83DF2DBC7FD3094515D932A48D /* Equal.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Equal.swift; path = Sources/Nimble/Matchers/Equal.swift; sourceTree = ""; }; - 18E6EE47FD109AA2905CFE4757830155 /* Expectation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Expectation.swift; path = Sources/Nimble/Expectation.swift; sourceTree = ""; }; - 18E7DC6EF401C7D13449F62E46003B70 /* Filter.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Filter.swift; path = Sources/Quick/Filter.swift; sourceTree = ""; }; - 1B8682B68A79F5C29344B74E5D8B59C5 /* AssertionDispatcher.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AssertionDispatcher.swift; path = Sources/Nimble/Adapters/AssertionDispatcher.swift; sourceTree = ""; }; - 1B962A73B0D26E9D892B273B5583AFA7 /* Pods-Reqres_Tests-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Reqres_Tests-resources.sh"; sourceTree = ""; }; - 1BCA8F6E037503D1D1A3BF2AE985DBD4 /* ThrowError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ThrowError.swift; path = Sources/Nimble/Matchers/ThrowError.swift; sourceTree = ""; }; - 1C6A2DA9B883B186EBEDE0D8603F43C4 /* Stringers.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Stringers.swift; path = Sources/Nimble/Utils/Stringers.swift; sourceTree = ""; }; - 1E10BF32DB921AC4E744D39B0CFF0665 /* Pods_Reqres_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Reqres_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 1F1C7C6284D9A0C72B0027FE2D0BF854 /* QCKDSL.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QCKDSL.m; path = Sources/QuickObjectiveC/DSL/QCKDSL.m; sourceTree = ""; }; - 20C41C7628694A85F9B9F8F5909E0341 /* NMBExceptionCapture.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NMBExceptionCapture.m; path = Sources/NimbleObjectiveC/NMBExceptionCapture.m; sourceTree = ""; }; - 20C730E21CFC123F0B9793F18EB9B272 /* Pods-Reqres_Tests-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Reqres_Tests-umbrella.h"; sourceTree = ""; }; - 23624E29201D23741F621FB91ABA61F1 /* BeNil.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeNil.swift; path = Sources/Nimble/Matchers/BeNil.swift; sourceTree = ""; }; - 29D0E34D3A7D2020393E312E87C49A50 /* Pods-Reqres_Tests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Reqres_Tests.modulemap"; sourceTree = ""; }; - 2A1C572CBAB6A811E96A2D1E5208B27D /* Alamofire-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Alamofire-umbrella.h"; sourceTree = ""; }; - 2CA3147B1C3F1FA21625EA19787BE85E /* Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Alamofire.swift; path = Source/Alamofire.swift; sourceTree = ""; }; - 2DF851721CCA6A9AA93B25B8F010C814 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 2E0DC43D94EB370B78C454F93C650030 /* Pods-Reqres_Example-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Reqres_Example-frameworks.sh"; sourceTree = ""; }; - 31ECCD275C14FF0EF21391C33402A34B /* Reqres.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Reqres.modulemap; sourceTree = ""; }; - 33B735E68570E6B4FB37A5E6B0A3197D /* AsyncMatcherWrapper.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AsyncMatcherWrapper.swift; path = Sources/Nimble/Matchers/AsyncMatcherWrapper.swift; sourceTree = ""; }; - 348BC5D7CB7F214F7E39BD515B6C0FE9 /* Alamofire-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Alamofire-dummy.m"; sourceTree = ""; }; - 350EFC34480AD3054351A5CA57623634 /* QCKDSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QCKDSL.h; path = Sources/QuickObjectiveC/DSL/QCKDSL.h; sourceTree = ""; }; - 351A1D547CA278148166D916892C0059 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 35542D7DAE5C35C3180A80222D76E2A9 /* DSL+Wait.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DSL+Wait.swift"; path = "Sources/Nimble/DSL+Wait.swift"; sourceTree = ""; }; - 368597BA3F3F81400163FED6DFFF2FD3 /* Result.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Source/Result.swift; sourceTree = ""; }; - 380AFE42EC98D656EFB7DE5FE0010BFD /* SessionDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionDelegate.swift; path = Source/SessionDelegate.swift; sourceTree = ""; }; - 3AD8CA8D8C6C6B54E4F633CF187DF6CB /* World+DSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "World+DSL.h"; path = "Sources/QuickObjectiveC/DSL/World+DSL.h"; sourceTree = ""; }; - 3B3452B767CEF00DE5D813027E2AE913 /* Quick.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Quick.xcconfig; sourceTree = ""; }; - 3B9401B08D42F8010332D7E712D761FA /* SatisfyAnyOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SatisfyAnyOf.swift; path = Sources/Nimble/Matchers/SatisfyAnyOf.swift; sourceTree = ""; }; - 3C480202B63222F9DD647A1551E5A95D /* BeEmpty.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeEmpty.swift; path = Sources/Nimble/Matchers/BeEmpty.swift; sourceTree = ""; }; - 3D2F6BDA1F7108E5C967E6388B9A5CB9 /* ServerTrustPolicy.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ServerTrustPolicy.swift; path = Source/ServerTrustPolicy.swift; sourceTree = ""; }; - 40EEBA222B9A66B5770DA5C21ADC942A /* BeLessThanOrEqual.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLessThanOrEqual.swift; path = Sources/Nimble/Matchers/BeLessThanOrEqual.swift; sourceTree = ""; }; - 438F3C460B93515CDC816086C38AE814 /* Contain.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Contain.swift; path = Sources/Nimble/Matchers/Contain.swift; sourceTree = ""; }; - 4425057AEAD7C7511AAAA0EF0CB5D9D6 /* Nimble.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Nimble.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 4A7F4C5487ECE8FFD80A171C3ACF9ACA /* Quick.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Quick.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 4B9BC97CD3D0911838C1503618B39A12 /* QuickTestSuite.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuickTestSuite.swift; path = Sources/Quick/QuickTestSuite.swift; sourceTree = ""; }; - 50875E5EBA8B7F36B0DEEF5A46B447D4 /* FailureMessage.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FailureMessage.swift; path = Sources/Nimble/FailureMessage.swift; sourceTree = ""; }; - 509381936A357FAF39771F01C22197C6 /* Reqres-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Reqres-dummy.m"; sourceTree = ""; }; - 535F4001D4C7D7D3DEE49454E32A1CB9 /* World.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = World.swift; path = Sources/Quick/World.swift; sourceTree = ""; }; - 536EDB7EA0B0CB18BB271C7D03B18955 /* RaisesException.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = RaisesException.swift; path = Sources/Nimble/Matchers/RaisesException.swift; sourceTree = ""; }; - 56A915885A77D0F65EB3ECD3A165AC05 /* AdapterProtocols.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AdapterProtocols.swift; path = Sources/Nimble/Adapters/AdapterProtocols.swift; sourceTree = ""; }; - 5EA8F72A19EFA0084D9879A261B009A6 /* NMBStringify.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NMBStringify.m; path = Sources/NimbleObjectiveC/NMBStringify.m; sourceTree = ""; }; - 60EF124DAF6834754E3F6397EEB28CFA /* Match.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Match.swift; path = Sources/Nimble/Matchers/Match.swift; sourceTree = ""; }; - 6432806E4D5140C58B0C2266EC22C76F /* Reqres-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Reqres-umbrella.h"; sourceTree = ""; }; - 64B9DBD632CEB08E825D2F25C2EE416B /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 6BAFD97050B825756746D041C76E1C58 /* AllPass.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AllPass.swift; path = Sources/Nimble/Matchers/AllPass.swift; sourceTree = ""; }; - 6D27828E711F1F98C5573E4C8183CCCB /* Closures.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Closures.swift; path = Sources/Quick/Hooks/Closures.swift; sourceTree = ""; }; - 6D84D21BE44632BDC99AEC4370A0B377 /* Pods-Reqres_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Reqres_Tests.debug.xcconfig"; sourceTree = ""; }; - 6F994F987A3005C6E1A76D69C54A5B01 /* Pods-Reqres_Tests-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Reqres_Tests-frameworks.sh"; sourceTree = ""; }; - 71FC5E1095ACE2444EA32F49F09F587D /* BeLogical.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLogical.swift; path = Sources/Nimble/Matchers/BeLogical.swift; sourceTree = ""; }; - 74BC32CA01B289BF0123B694A5E6ED3B /* Pods_Reqres_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Reqres_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 761470A899327CC29BE3AEE979E544E0 /* Alamofire.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Alamofire.xcconfig; sourceTree = ""; }; - 79CE7159A832DBAE73AD0E580A2E8F70 /* XCTestObservationCenter+Register.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "XCTestObservationCenter+Register.m"; path = "Sources/NimbleObjectiveC/XCTestObservationCenter+Register.m"; sourceTree = ""; }; - 7A1E220DE9581AF46897774CF6E805AB /* BeIdenticalTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeIdenticalTo.swift; path = Sources/Nimble/Matchers/BeIdenticalTo.swift; sourceTree = ""; }; - 7D4DC56E7E27742D48B967898EA7509F /* DSL.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = DSL.h; path = Sources/NimbleObjectiveC/DSL.h; sourceTree = ""; }; - 7E22B9E873270575B23F3393663C4216 /* String+FileName.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "String+FileName.swift"; path = "Sources/Quick/String+FileName.swift"; sourceTree = ""; }; - 7EBE34C479162E17359581DA87EE649A /* Response.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Response.swift; path = Source/Response.swift; sourceTree = ""; }; - 7FA9CEEEDD4AFE34C5F22F7650EF3588 /* Nimble.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Nimble.modulemap; sourceTree = ""; }; - 7FAA325E3DA2878A1D1C57E79AE7BD93 /* MatcherFunc.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatcherFunc.swift; path = Sources/Nimble/Matchers/MatcherFunc.swift; sourceTree = ""; }; - 81289DA09CBA359C3905A3D057FDF5C2 /* SourceLocation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SourceLocation.swift; path = Sources/Nimble/Utils/SourceLocation.swift; sourceTree = ""; }; - 827B1D48D3024B63A137B38DD82AEF3A /* BeGreaterThan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeGreaterThan.swift; path = Sources/Nimble/Matchers/BeGreaterThan.swift; sourceTree = ""; }; - 848F7BDA9D3EC0F0194594E7D8A19075 /* ExampleGroup.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleGroup.swift; path = Sources/Quick/ExampleGroup.swift; sourceTree = ""; }; - 86F03CF502A5B7989712CFBAC135C218 /* Alamofire.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Alamofire.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 89DF4D1D462D663A4333AFA482E86D58 /* BeCloseTo.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeCloseTo.swift; path = Sources/Nimble/Matchers/BeCloseTo.swift; sourceTree = ""; }; - 8CD6205BB4DFED23571EA388BA7FEB5A /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 8D1D9F1723C37AAEFF685CF7BFFDA3BB /* PostNotification.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = PostNotification.swift; path = Sources/Nimble/Matchers/PostNotification.swift; sourceTree = ""; }; - 8E21DCB24B38D0C73ED1B58462D1839D /* Reqres-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Reqres-prefix.pch"; sourceTree = ""; }; - 8E94146DC960A9B79BA42CB37C9ECD49 /* Nimble.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Nimble.h; path = Sources/Nimble/Nimble.h; sourceTree = ""; }; - 8E9689D18BF7A0DDDD527189CB7F62F9 /* CurrentTestCaseTracker.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = CurrentTestCaseTracker.h; path = Sources/NimbleObjectiveC/CurrentTestCaseTracker.h; sourceTree = ""; }; - 8EEEB961C9C210C0ED760190DE95B0AD /* NMBStringify.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NMBStringify.h; path = Sources/NimbleObjectiveC/NMBStringify.h; sourceTree = ""; }; - 8F517A2122E499608F7637877D5882EB /* World.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = World.h; path = Sources/QuickObjectiveC/World.h; sourceTree = ""; }; - 8F56727F0C8108AF020246DF08D61062 /* Quick.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = Quick.h; path = Sources/QuickObjectiveC/Quick.h; sourceTree = ""; }; - 913053FFCBE8CE53308695E8D73F6B36 /* Alamofire.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = Alamofire.modulemap; sourceTree = ""; }; - 91DF3E165A4618BE917060531BADB9C4 /* Pods-Reqres_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Reqres_Example.release.xcconfig"; sourceTree = ""; }; - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - 93FA7052FC9C69BB15A90CBD08DB442D /* AFError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = AFError.swift; path = Source/AFError.swift; sourceTree = ""; }; - 9A3F4DB1A0182CEDD285BEC987C49507 /* BeVoid.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeVoid.swift; path = Sources/Nimble/Matchers/BeVoid.swift; sourceTree = ""; }; - 9AFF2CE688220EC8739E3C7E081AFFFE /* Notifications.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Notifications.swift; path = Source/Notifications.swift; sourceTree = ""; }; - 9B8A31854AF673C0A03DA8A7F7D0B680 /* Errors.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Errors.swift; path = Sources/Nimble/Utils/Errors.swift; sourceTree = ""; }; - 9C33B81911D1009EF9E91DD9FADB8D83 /* Reqres.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = Reqres.swift; sourceTree = ""; }; - 9C4A1DB49FB1E0D3DDF5ACAA8214E142 /* ExampleMetadata.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleMetadata.swift; path = Sources/Quick/ExampleMetadata.swift; sourceTree = ""; }; - 9D18ED0653F3821FD714D45C3FB2C9DD /* Nimble-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Nimble-umbrella.h"; sourceTree = ""; }; - 9E65D56F7E6E7835B3D25C3F9AE31A19 /* QuickSpec.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QuickSpec.m; path = Sources/QuickObjectiveC/QuickSpec.m; sourceTree = ""; }; - 9E737E4D1D6A5AEF222B05ABCD2E694A /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 9FB45D07752B274B3FFBF71F3829E427 /* NimbleXCTestHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleXCTestHandler.swift; path = Sources/Nimble/Adapters/NimbleXCTestHandler.swift; sourceTree = ""; }; - A385E24A9B923F13EDB0A1D427285D7E /* Async.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Async.swift; path = Sources/Nimble/Utils/Async.swift; sourceTree = ""; }; - A621FCB4BAE493F349519D6AE9ED476E /* Nimble-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Nimble-prefix.pch"; sourceTree = ""; }; - A62862C6D6AF6C83298CFAFE0306DA6D /* TaskDelegate.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = TaskDelegate.swift; path = Source/TaskDelegate.swift; sourceTree = ""; }; - A63BD734476C31962386D9ABE590E0E9 /* Callsite.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Callsite.swift; path = Sources/Quick/Callsite.swift; sourceTree = ""; }; - A882A7F13421DD3C5D5EBB4531F14EBF /* Timeline.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Timeline.swift; path = Source/Timeline.swift; sourceTree = ""; }; - AA4EFEAEC705D23E13D685DF060AEB53 /* Pods-Reqres_Example-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-Reqres_Example-umbrella.h"; sourceTree = ""; }; - AAC405455F8E20BD0434D9D3E3D2879A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - ADFB631202F8CD3CF8A189DBB31303B2 /* NMBExpectation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NMBExpectation.swift; path = Sources/Nimble/Adapters/NMBExpectation.swift; sourceTree = ""; }; - AE8491FA4F08FAFECE57A0092500A02E /* Nimble.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Nimble.xcconfig; sourceTree = ""; }; - AED4C2010B9FEBEE4146044B885A6938 /* Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - B397AAFB422115DC2D226D9AD136F043 /* DSL.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = DSL.m; path = Sources/NimbleObjectiveC/DSL.m; sourceTree = ""; }; - B4D37271003EA5DD0618FACBB27DF4C3 /* Pods-Reqres_Example.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "sourcecode.module-map"; path = "Pods-Reqres_Example.modulemap"; sourceTree = ""; }; - B73D17573C73C936A7932B22CE48C5BB /* Pods-Reqres_Example-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Reqres_Example-dummy.m"; sourceTree = ""; }; - B89BF7315BAB3516AF2A51041DC39C3B /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/System/Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; - BB413599E15246AD4C188D96C26CF818 /* BeLessThan.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeLessThan.swift; path = Sources/Nimble/Matchers/BeLessThan.swift; sourceTree = ""; }; - BB4A66982D9D001C082F99ED4D2295F6 /* ExampleHooks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ExampleHooks.swift; path = Sources/Quick/Hooks/ExampleHooks.swift; sourceTree = ""; }; - BC1CAEF379BE313D15F3707035B895CC /* Reqres.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Reqres.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BC5583418614A9AE0899F304FB1D6C96 /* Reqres.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Reqres.xcconfig; sourceTree = ""; }; - BD1C0F4C2938B4A76360F5929F8C949F /* Pods-Reqres_Example-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Reqres_Example-resources.sh"; sourceTree = ""; }; - BF9F7210F7851463BC33A8D21666AC1D /* Pods-Reqres_Tests-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Reqres_Tests-acknowledgements.plist"; sourceTree = ""; }; - C135A7CE43E332C0C137A84D69D63D20 /* Quick-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Quick-umbrella.h"; sourceTree = ""; }; - C3594B1EB58F4348F9E443538D216961 /* ParameterEncoding.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ParameterEncoding.swift; path = Source/ParameterEncoding.swift; sourceTree = ""; }; - C5DF3C93FA14E423FB00142564445985 /* MultipartFormData.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MultipartFormData.swift; path = Source/MultipartFormData.swift; sourceTree = ""; }; - C8F4C33A066630DF2DB96F35A264414A /* XCTestSuite+QuickTestSuiteBuilder.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "XCTestSuite+QuickTestSuiteBuilder.m"; path = "Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m"; sourceTree = ""; }; - C9B73355601BF456F877EC6849C246E7 /* MatchError.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = MatchError.swift; path = Sources/Nimble/Matchers/MatchError.swift; sourceTree = ""; }; - CAA4913ABEDF41638D0D8272F59CE1F5 /* Pods-Reqres_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Reqres_Tests.release.xcconfig"; sourceTree = ""; }; - CD9826D94204E654BF284FABE0DE9080 /* QuickConfiguration.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = QuickConfiguration.m; path = Sources/QuickObjectiveC/Configuration/QuickConfiguration.m; sourceTree = ""; }; - CDA61155F4E87FF643DFB417D575F6A7 /* BeginWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeginWith.swift; path = Sources/Nimble/Matchers/BeginWith.swift; sourceTree = ""; }; - CE83B3057761C4B126DF978CC4148242 /* Pods-Reqres_Tests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Reqres_Tests-acknowledgements.markdown"; sourceTree = ""; }; - CEB28E0C7E40D2DE1F89347BC36B04F2 /* ErrorUtility.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ErrorUtility.swift; path = Sources/Quick/ErrorUtility.swift; sourceTree = ""; }; - CFBE8D4251B6D9900CADB2B55AB7A2F0 /* SessionManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SessionManager.swift; path = Source/SessionManager.swift; sourceTree = ""; }; - D1FB5CE89C2EFA5D18A75B04D6F03983 /* Quick-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Quick-dummy.m"; sourceTree = ""; }; - D3BC830ABCB90AAFC81A9667A6E90367 /* Nimble-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Nimble-dummy.m"; sourceTree = ""; }; - D6620081B0B86AE39437EB606A63CB77 /* NSBundle+CurrentTestBundle.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "NSBundle+CurrentTestBundle.swift"; path = "Sources/Quick/NSBundle+CurrentTestBundle.swift"; sourceTree = ""; }; - D740AE071DADA2F77CF024B34C3DA9D7 /* NSString+QCKSelectorName.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSString+QCKSelectorName.m"; path = "Sources/QuickObjectiveC/NSString+QCKSelectorName.m"; sourceTree = ""; }; - D74D88BBEF05F7D16545F0602917785A /* NetworkReachabilityManager.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NetworkReachabilityManager.swift; path = Source/NetworkReachabilityManager.swift; sourceTree = ""; }; - D926CE9E510B82F5889CA430D907A5EF /* Pods-Reqres_Example-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Reqres_Example-acknowledgements.markdown"; sourceTree = ""; }; - DA469805EB84A35F071E54AD4777BBFA /* World+DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "World+DSL.swift"; path = "Sources/Quick/DSL/World+DSL.swift"; sourceTree = ""; }; - DA8BC2064846E6835BEE7A96F75024FC /* HaveCount.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = HaveCount.swift; path = Sources/Nimble/Matchers/HaveCount.swift; sourceTree = ""; }; - DBF741D48F4C7BCE38188CF01544F039 /* NSString+QCKSelectorName.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSString+QCKSelectorName.h"; path = "Sources/QuickObjectiveC/NSString+QCKSelectorName.h"; sourceTree = ""; }; - DD232A4ECE04A556147CF948C561EDCC /* QuickConfiguration.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = QuickConfiguration.h; path = Sources/QuickObjectiveC/Configuration/QuickConfiguration.h; sourceTree = ""; }; - E0EE7CA1BC958B207B403A5AC1EDA117 /* BeAKindOf.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = BeAKindOf.swift; path = Sources/Nimble/Matchers/BeAKindOf.swift; sourceTree = ""; }; - E10B2E6B6FAE05CAF11A950BDC432CD0 /* NimbleEnvironment.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = NimbleEnvironment.swift; path = Sources/Nimble/Adapters/NimbleEnvironment.swift; sourceTree = ""; }; - E5611AFA8C33F8967785FDBE449A83E5 /* Pods-Reqres_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Reqres_Example.debug.xcconfig"; sourceTree = ""; }; - EAE1CB3CB8301B0A30E953C566A1B65B /* Quick-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Quick-prefix.pch"; sourceTree = ""; }; - EAFD198C1C9B13792B7B6B9DB3102B17 /* EndWith.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = EndWith.swift; path = Sources/Nimble/Matchers/EndWith.swift; sourceTree = ""; }; - EC14AC486E814663708CBF1BD2183F98 /* Request.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Request.swift; path = Source/Request.swift; sourceTree = ""; }; - ED03CE532165C08714B8AF386473C7C3 /* Example.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Example.swift; path = Sources/Quick/Example.swift; sourceTree = ""; }; - EEAAE4F716A05610F6E3AF6389C46438 /* DispatchQueue+Alamofire.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "DispatchQueue+Alamofire.swift"; path = "Source/DispatchQueue+Alamofire.swift"; sourceTree = ""; }; - EFA10BA559AB2D9ED52A3348E33B0B08 /* NMBExceptionCapture.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = NMBExceptionCapture.h; path = Sources/NimbleObjectiveC/NMBExceptionCapture.h; sourceTree = ""; }; - EFE95968E20FB7BA3DD7C445F0D6F486 /* Functional.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Functional.swift; path = Sources/Nimble/Utils/Functional.swift; sourceTree = ""; }; - F1563AF60A7B613FD141721F12061D1E /* ReqresDefaultLogger.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ReqresDefaultLogger.swift; sourceTree = ""; }; - F2B3D2A511ABD07C71795094294E77B6 /* QuickSelectedTestSuiteBuilder.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = QuickSelectedTestSuiteBuilder.swift; path = Sources/Quick/QuickSelectedTestSuiteBuilder.swift; sourceTree = ""; }; - F5365670C4DA05846171136BE77EC90E /* Pods-Reqres_Tests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Reqres_Tests-dummy.m"; sourceTree = ""; }; - F59C456EE0D76A865A5351ADD79B0FEB /* ReqresLogging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ReqresLogging.swift; sourceTree = ""; }; - F6CF6EE532D517FB4D5829438880944D /* SuiteHooks.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SuiteHooks.swift; path = Sources/Quick/Hooks/SuiteHooks.swift; sourceTree = ""; }; - F70EB743847946626531E64F9EE4EFC5 /* Validation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Validation.swift; path = Source/Validation.swift; sourceTree = ""; }; - FE81928F6AB4FA2FA2DDE0507024E256 /* DSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = DSL.swift; path = Sources/Quick/DSL/DSL.swift; sourceTree = ""; }; - FF19EB840B758BFC7604F2FA8A40C011 /* ResponseSerialization.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ResponseSerialization.swift; path = Source/ResponseSerialization.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 050B68EC615B591FDA5D0B855E697228 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 7070E1BDFFD9D6D40C6ED465BD5C58CB /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 210F3A660CDCF30C17117B9ACF5F2083 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 403F8AA1758D3813A88FEE96265F6345 /* Foundation.framework in Frameworks */, - F33721E9B755D9444D470DF133E62563 /* XCTest.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 56F8416351FBDDB87272BCEF68368A20 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 0B47A68C46377DBA4202C8E639A09A8F /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 6C4F3AFC1106125E254688DA2E57EEBE /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 30C8E85CB7BFBC77354F5422D9DFA9D0 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - B1729F851F648EC60EE93CDB3C8BAEAD /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 91C09AC2A52ED69A27C8D923139A006F /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EB7BD448A07EB7906902E0D4AB4FC699 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 58443B34A20492445C9A3FAFC3FC73C4 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 13E3C6624F7C8DF25DA935C3E1D5000A /* Support Files */ = { - isa = PBXGroup; - children = ( - 913053FFCBE8CE53308695E8D73F6B36 /* Alamofire.modulemap */, - 761470A899327CC29BE3AEE979E544E0 /* Alamofire.xcconfig */, - 348BC5D7CB7F214F7E39BD515B6C0FE9 /* Alamofire-dummy.m */, - 0CBAE2690AAFC9BF21AE7DFA57FE5B76 /* Alamofire-prefix.pch */, - 2A1C572CBAB6A811E96A2D1E5208B27D /* Alamofire-umbrella.h */, - 64B9DBD632CEB08E825D2F25C2EE416B /* Info.plist */, - ); - name = "Support Files"; - path = "../Target Support Files/Alamofire"; - sourceTree = ""; - }; - 14025FE1A2E7C32134E5AB2981F32224 /* Pods-Reqres_Tests */ = { - isa = PBXGroup; - children = ( - 2DF851721CCA6A9AA93B25B8F010C814 /* Info.plist */, - 29D0E34D3A7D2020393E312E87C49A50 /* Pods-Reqres_Tests.modulemap */, - CE83B3057761C4B126DF978CC4148242 /* Pods-Reqres_Tests-acknowledgements.markdown */, - BF9F7210F7851463BC33A8D21666AC1D /* Pods-Reqres_Tests-acknowledgements.plist */, - F5365670C4DA05846171136BE77EC90E /* Pods-Reqres_Tests-dummy.m */, - 6F994F987A3005C6E1A76D69C54A5B01 /* Pods-Reqres_Tests-frameworks.sh */, - 1B962A73B0D26E9D892B273B5583AFA7 /* Pods-Reqres_Tests-resources.sh */, - 20C730E21CFC123F0B9793F18EB9B272 /* Pods-Reqres_Tests-umbrella.h */, - 6D84D21BE44632BDC99AEC4370A0B377 /* Pods-Reqres_Tests.debug.xcconfig */, - CAA4913ABEDF41638D0D8272F59CE1F5 /* Pods-Reqres_Tests.release.xcconfig */, - ); - name = "Pods-Reqres_Tests"; - path = "Target Support Files/Pods-Reqres_Tests"; - sourceTree = ""; - }; - 299B67F68F5CB8F408DE4760AD371C5C /* Alamofire */ = { - isa = PBXGroup; - children = ( - 93FA7052FC9C69BB15A90CBD08DB442D /* AFError.swift */, - 2CA3147B1C3F1FA21625EA19787BE85E /* Alamofire.swift */, - EEAAE4F716A05610F6E3AF6389C46438 /* DispatchQueue+Alamofire.swift */, - C5DF3C93FA14E423FB00142564445985 /* MultipartFormData.swift */, - D74D88BBEF05F7D16545F0602917785A /* NetworkReachabilityManager.swift */, - 9AFF2CE688220EC8739E3C7E081AFFFE /* Notifications.swift */, - C3594B1EB58F4348F9E443538D216961 /* ParameterEncoding.swift */, - EC14AC486E814663708CBF1BD2183F98 /* Request.swift */, - 7EBE34C479162E17359581DA87EE649A /* Response.swift */, - FF19EB840B758BFC7604F2FA8A40C011 /* ResponseSerialization.swift */, - 368597BA3F3F81400163FED6DFFF2FD3 /* Result.swift */, - 3D2F6BDA1F7108E5C967E6388B9A5CB9 /* ServerTrustPolicy.swift */, - 380AFE42EC98D656EFB7DE5FE0010BFD /* SessionDelegate.swift */, - CFBE8D4251B6D9900CADB2B55AB7A2F0 /* SessionManager.swift */, - A62862C6D6AF6C83298CFAFE0306DA6D /* TaskDelegate.swift */, - A882A7F13421DD3C5D5EBB4531F14EBF /* Timeline.swift */, - F70EB743847946626531E64F9EE4EFC5 /* Validation.swift */, - 13E3C6624F7C8DF25DA935C3E1D5000A /* Support Files */, - ); - path = Alamofire; - sourceTree = ""; - }; - 2D14181BFDF0D09E63A345F6529A1EDB /* Nimble */ = { - isa = PBXGroup; - children = ( - 56A915885A77D0F65EB3ECD3A165AC05 /* AdapterProtocols.swift */, - 6BAFD97050B825756746D041C76E1C58 /* AllPass.swift */, - 1B8682B68A79F5C29344B74E5D8B59C5 /* AssertionDispatcher.swift */, - 0EC8493AF8092C8BA937646E829E9FA8 /* AssertionRecorder.swift */, - A385E24A9B923F13EDB0A1D427285D7E /* Async.swift */, - 33B735E68570E6B4FB37A5E6B0A3197D /* AsyncMatcherWrapper.swift */, - E0EE7CA1BC958B207B403A5AC1EDA117 /* BeAKindOf.swift */, - 0C33235D630E3A4FD28090344D7F30AA /* BeAnInstanceOf.swift */, - 89DF4D1D462D663A4333AFA482E86D58 /* BeCloseTo.swift */, - 3C480202B63222F9DD647A1551E5A95D /* BeEmpty.swift */, - CDA61155F4E87FF643DFB417D575F6A7 /* BeginWith.swift */, - 827B1D48D3024B63A137B38DD82AEF3A /* BeGreaterThan.swift */, - 0E8ED9279A4C150D3E941ADD0449A55E /* BeGreaterThanOrEqualTo.swift */, - 7A1E220DE9581AF46897774CF6E805AB /* BeIdenticalTo.swift */, - BB413599E15246AD4C188D96C26CF818 /* BeLessThan.swift */, - 40EEBA222B9A66B5770DA5C21ADC942A /* BeLessThanOrEqual.swift */, - 71FC5E1095ACE2444EA32F49F09F587D /* BeLogical.swift */, - 23624E29201D23741F621FB91ABA61F1 /* BeNil.swift */, - 9A3F4DB1A0182CEDD285BEC987C49507 /* BeVoid.swift */, - 438F3C460B93515CDC816086C38AE814 /* Contain.swift */, - 8E9689D18BF7A0DDDD527189CB7F62F9 /* CurrentTestCaseTracker.h */, - 7D4DC56E7E27742D48B967898EA7509F /* DSL.h */, - B397AAFB422115DC2D226D9AD136F043 /* DSL.m */, - 0A15BDDDC13079AF4055E4C64A233235 /* DSL.swift */, - 35542D7DAE5C35C3180A80222D76E2A9 /* DSL+Wait.swift */, - EAFD198C1C9B13792B7B6B9DB3102B17 /* EndWith.swift */, - 17C09B83DF2DBC7FD3094515D932A48D /* Equal.swift */, - 9B8A31854AF673C0A03DA8A7F7D0B680 /* Errors.swift */, - 18E6EE47FD109AA2905CFE4757830155 /* Expectation.swift */, - 09D09437B78959EAC9C806BAEB14A6B7 /* Expression.swift */, - 50875E5EBA8B7F36B0DEEF5A46B447D4 /* FailureMessage.swift */, - EFE95968E20FB7BA3DD7C445F0D6F486 /* Functional.swift */, - DA8BC2064846E6835BEE7A96F75024FC /* HaveCount.swift */, - 60EF124DAF6834754E3F6397EEB28CFA /* Match.swift */, - 7FAA325E3DA2878A1D1C57E79AE7BD93 /* MatcherFunc.swift */, - 0646552C78F2637DC856FC99AB181B67 /* MatcherProtocols.swift */, - C9B73355601BF456F877EC6849C246E7 /* MatchError.swift */, - 8E94146DC960A9B79BA42CB37C9ECD49 /* Nimble.h */, - E10B2E6B6FAE05CAF11A950BDC432CD0 /* NimbleEnvironment.swift */, - 9FB45D07752B274B3FFBF71F3829E427 /* NimbleXCTestHandler.swift */, - EFA10BA559AB2D9ED52A3348E33B0B08 /* NMBExceptionCapture.h */, - 20C41C7628694A85F9B9F8F5909E0341 /* NMBExceptionCapture.m */, - ADFB631202F8CD3CF8A189DBB31303B2 /* NMBExpectation.swift */, - 011C62CD7B0A0767543DC78391033A80 /* NMBObjCMatcher.swift */, - 8EEEB961C9C210C0ED760190DE95B0AD /* NMBStringify.h */, - 5EA8F72A19EFA0084D9879A261B009A6 /* NMBStringify.m */, - 8D1D9F1723C37AAEFF685CF7BFFDA3BB /* PostNotification.swift */, - 536EDB7EA0B0CB18BB271C7D03B18955 /* RaisesException.swift */, - 3B9401B08D42F8010332D7E712D761FA /* SatisfyAnyOf.swift */, - 81289DA09CBA359C3905A3D057FDF5C2 /* SourceLocation.swift */, - 1C6A2DA9B883B186EBEDE0D8603F43C4 /* Stringers.swift */, - 1BCA8F6E037503D1D1A3BF2AE985DBD4 /* ThrowError.swift */, - 79CE7159A832DBAE73AD0E580A2E8F70 /* XCTestObservationCenter+Register.m */, - 3C61C518074CD43ACA333D12EC97ECA0 /* Support Files */, - ); - path = Nimble; - sourceTree = ""; - }; - 2D499DEE8ADA726A47F5ED485591CA82 /* Classes */ = { - isa = PBXGroup; - children = ( - 9C33B81911D1009EF9E91DD9FADB8D83 /* Reqres.swift */, - F1563AF60A7B613FD141721F12061D1E /* ReqresDefaultLogger.swift */, - F59C456EE0D76A865A5351ADD79B0FEB /* ReqresLogging.swift */, - ); - path = Classes; - sourceTree = ""; - }; - 3BEE88735A929B29148F6E4A7F2A4304 /* Products */ = { - isa = PBXGroup; - children = ( - 86F03CF502A5B7989712CFBAC135C218 /* Alamofire.framework */, - 4425057AEAD7C7511AAAA0EF0CB5D9D6 /* Nimble.framework */, - 1E10BF32DB921AC4E744D39B0CFF0665 /* Pods_Reqres_Example.framework */, - 74BC32CA01B289BF0123B694A5E6ED3B /* Pods_Reqres_Tests.framework */, - 4A7F4C5487ECE8FFD80A171C3ACF9ACA /* Quick.framework */, - BC1CAEF379BE313D15F3707035B895CC /* Reqres.framework */, - ); - name = Products; - sourceTree = ""; - }; - 3C61C518074CD43ACA333D12EC97ECA0 /* Support Files */ = { - isa = PBXGroup; - children = ( - 351A1D547CA278148166D916892C0059 /* Info.plist */, - 7FA9CEEEDD4AFE34C5F22F7650EF3588 /* Nimble.modulemap */, - AE8491FA4F08FAFECE57A0092500A02E /* Nimble.xcconfig */, - D3BC830ABCB90AAFC81A9667A6E90367 /* Nimble-dummy.m */, - A621FCB4BAE493F349519D6AE9ED476E /* Nimble-prefix.pch */, - 9D18ED0653F3821FD714D45C3FB2C9DD /* Nimble-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/Nimble"; - sourceTree = ""; - }; - 433CD3331B6C3787F473C941B61FC68F /* Frameworks */ = { - isa = PBXGroup; - children = ( - D24B2EA016AE4FABDB5AF17F3FD9C222 /* iOS */, - ); - name = Frameworks; - sourceTree = ""; - }; - 7DB346D0F39D3F0E887471402A8071AB = { - isa = PBXGroup; - children = ( - 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, - BB92328798C6362FBF84764A89CE19A9 /* Development Pods */, - 433CD3331B6C3787F473C941B61FC68F /* Frameworks */, - 92DF3693857BB380C19FD26C1A16134B /* Pods */, - 3BEE88735A929B29148F6E4A7F2A4304 /* Products */, - C09030EF4926AE5F99510BA64FB1EFDF /* Targets Support Files */, - ); - sourceTree = ""; - }; - 88C10A1BBC760AD309FBFF5B42DF9F63 /* Pods-Reqres_Example */ = { - isa = PBXGroup; - children = ( - AED4C2010B9FEBEE4146044B885A6938 /* Info.plist */, - B4D37271003EA5DD0618FACBB27DF4C3 /* Pods-Reqres_Example.modulemap */, - D926CE9E510B82F5889CA430D907A5EF /* Pods-Reqres_Example-acknowledgements.markdown */, - 13FA9DF6F16A7AEDE4F81DBFD9C816A7 /* Pods-Reqres_Example-acknowledgements.plist */, - B73D17573C73C936A7932B22CE48C5BB /* Pods-Reqres_Example-dummy.m */, - 2E0DC43D94EB370B78C454F93C650030 /* Pods-Reqres_Example-frameworks.sh */, - BD1C0F4C2938B4A76360F5929F8C949F /* Pods-Reqres_Example-resources.sh */, - AA4EFEAEC705D23E13D685DF060AEB53 /* Pods-Reqres_Example-umbrella.h */, - E5611AFA8C33F8967785FDBE449A83E5 /* Pods-Reqres_Example.debug.xcconfig */, - 91DF3E165A4618BE917060531BADB9C4 /* Pods-Reqres_Example.release.xcconfig */, - ); - name = "Pods-Reqres_Example"; - path = "Target Support Files/Pods-Reqres_Example"; - sourceTree = ""; - }; - 90E1A627E221E2C2782BBA9B15C9AD28 /* Support Files */ = { - isa = PBXGroup; - children = ( - 8CD6205BB4DFED23571EA388BA7FEB5A /* Info.plist */, - 1049A85D4A41AE95C1088280A58DFED2 /* Quick.modulemap */, - 3B3452B767CEF00DE5D813027E2AE913 /* Quick.xcconfig */, - D1FB5CE89C2EFA5D18A75B04D6F03983 /* Quick-dummy.m */, - EAE1CB3CB8301B0A30E953C566A1B65B /* Quick-prefix.pch */, - C135A7CE43E332C0C137A84D69D63D20 /* Quick-umbrella.h */, - ); - name = "Support Files"; - path = "../Target Support Files/Quick"; - sourceTree = ""; - }; - 92DF3693857BB380C19FD26C1A16134B /* Pods */ = { - isa = PBXGroup; - children = ( - 299B67F68F5CB8F408DE4760AD371C5C /* Alamofire */, - 2D14181BFDF0D09E63A345F6529A1EDB /* Nimble */, - DD5BE5CD9F88E772EAA6F3D1ED2158C5 /* Quick */, - ); - name = Pods; - sourceTree = ""; - }; - 9A1B432B591088597353BAB849A2237A /* Reqres */ = { - isa = PBXGroup; - children = ( - C3E4AD321702096261374CE8F8D1073F /* Reqres */, - A4A6935FAD18F37D9219A83A4031E87D /* Support Files */, - ); - name = Reqres; - path = ../..; - sourceTree = ""; - }; - A4A6935FAD18F37D9219A83A4031E87D /* Support Files */ = { - isa = PBXGroup; - children = ( - 9E737E4D1D6A5AEF222B05ABCD2E694A /* Info.plist */, - 31ECCD275C14FF0EF21391C33402A34B /* Reqres.modulemap */, - BC5583418614A9AE0899F304FB1D6C96 /* Reqres.xcconfig */, - 509381936A357FAF39771F01C22197C6 /* Reqres-dummy.m */, - 8E21DCB24B38D0C73ED1B58462D1839D /* Reqres-prefix.pch */, - 6432806E4D5140C58B0C2266EC22C76F /* Reqres-umbrella.h */, - ); - name = "Support Files"; - path = "Example/Pods/Target Support Files/Reqres"; - sourceTree = ""; - }; - BB92328798C6362FBF84764A89CE19A9 /* Development Pods */ = { - isa = PBXGroup; - children = ( - 9A1B432B591088597353BAB849A2237A /* Reqres */, - ); - name = "Development Pods"; - sourceTree = ""; - }; - C09030EF4926AE5F99510BA64FB1EFDF /* Targets Support Files */ = { - isa = PBXGroup; - children = ( - 88C10A1BBC760AD309FBFF5B42DF9F63 /* Pods-Reqres_Example */, - 14025FE1A2E7C32134E5AB2981F32224 /* Pods-Reqres_Tests */, - ); - name = "Targets Support Files"; - sourceTree = ""; - }; - C3E4AD321702096261374CE8F8D1073F /* Reqres */ = { - isa = PBXGroup; - children = ( - 2D499DEE8ADA726A47F5ED485591CA82 /* Classes */, - ); - path = Reqres; - sourceTree = ""; - }; - D24B2EA016AE4FABDB5AF17F3FD9C222 /* iOS */ = { - isa = PBXGroup; - children = ( - AAC405455F8E20BD0434D9D3E3D2879A /* Foundation.framework */, - B89BF7315BAB3516AF2A51041DC39C3B /* XCTest.framework */, - ); - name = iOS; - sourceTree = ""; - }; - DD5BE5CD9F88E772EAA6F3D1ED2158C5 /* Quick */ = { - isa = PBXGroup; - children = ( - A63BD734476C31962386D9ABE590E0E9 /* Callsite.swift */, - 6D27828E711F1F98C5573E4C8183CCCB /* Closures.swift */, - 0744C199F8F5598E4454D6DC99394C01 /* Configuration.swift */, - FE81928F6AB4FA2FA2DDE0507024E256 /* DSL.swift */, - CEB28E0C7E40D2DE1F89347BC36B04F2 /* ErrorUtility.swift */, - ED03CE532165C08714B8AF386473C7C3 /* Example.swift */, - 848F7BDA9D3EC0F0194594E7D8A19075 /* ExampleGroup.swift */, - BB4A66982D9D001C082F99ED4D2295F6 /* ExampleHooks.swift */, - 9C4A1DB49FB1E0D3DDF5ACAA8214E142 /* ExampleMetadata.swift */, - 18E7DC6EF401C7D13449F62E46003B70 /* Filter.swift */, - 052B62C812385AEB80BFB241FA64D9AD /* HooksPhase.swift */, - D6620081B0B86AE39437EB606A63CB77 /* NSBundle+CurrentTestBundle.swift */, - DBF741D48F4C7BCE38188CF01544F039 /* NSString+QCKSelectorName.h */, - D740AE071DADA2F77CF024B34C3DA9D7 /* NSString+QCKSelectorName.m */, - 350EFC34480AD3054351A5CA57623634 /* QCKDSL.h */, - 1F1C7C6284D9A0C72B0027FE2D0BF854 /* QCKDSL.m */, - 8F56727F0C8108AF020246DF08D61062 /* Quick.h */, - DD232A4ECE04A556147CF948C561EDCC /* QuickConfiguration.h */, - CD9826D94204E654BF284FABE0DE9080 /* QuickConfiguration.m */, - F2B3D2A511ABD07C71795094294E77B6 /* QuickSelectedTestSuiteBuilder.swift */, - 0BF85957A29A48D3C698A0FAC6B44CE5 /* QuickSpec.h */, - 9E65D56F7E6E7835B3D25C3F9AE31A19 /* QuickSpec.m */, - 4B9BC97CD3D0911838C1503618B39A12 /* QuickTestSuite.swift */, - 7E22B9E873270575B23F3393663C4216 /* String+FileName.swift */, - F6CF6EE532D517FB4D5829438880944D /* SuiteHooks.swift */, - 8F517A2122E499608F7637877D5882EB /* World.h */, - 535F4001D4C7D7D3DEE49454E32A1CB9 /* World.swift */, - 3AD8CA8D8C6C6B54E4F633CF187DF6CB /* World+DSL.h */, - DA469805EB84A35F071E54AD4777BBFA /* World+DSL.swift */, - C8F4C33A066630DF2DB96F35A264414A /* XCTestSuite+QuickTestSuiteBuilder.m */, - 90E1A627E221E2C2782BBA9B15C9AD28 /* Support Files */, - ); - path = Quick; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 1D2ED83C9303903A669D3ABD46DFE067 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - E8A2419F0043F23E2B45D3777FD00B7A /* Pods-Reqres_Example-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - C9CAD1C0891D5863FF8627A68CC68ECA /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 522E7C454877ACD8AB3D06601E7770AE /* CurrentTestCaseTracker.h in Headers */, - 421C068CCF276223CD76D9875DB0C537 /* DSL.h in Headers */, - B47F2B1F7F5FEC4CE62F09832392E842 /* Nimble-umbrella.h in Headers */, - A1F69DD3961B60955EFD28E2BDF446E8 /* Nimble.h in Headers */, - BD0445E39C97A49EAFD877DCA85EF8EA /* NMBExceptionCapture.h in Headers */, - F614EFDFC958434F53DC770F8887170B /* NMBStringify.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - CA547AC8CBBF7827CD90260359152FD8 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D5E37F86BD198B14C9BF123BC92875E /* NSString+QCKSelectorName.h in Headers */, - B1E123D009901914E290395975B21D61 /* QCKDSL.h in Headers */, - F2B9936EB479CD49E43B1FD09BDB3787 /* Quick-umbrella.h in Headers */, - 6ED1391B5926E46DB0D7B6E70A130519 /* Quick.h in Headers */, - 2E6617743E0555D2A6C11BFBE3C6AF14 /* QuickConfiguration.h in Headers */, - 3D82543008EFDDDF3F5C369C20393F44 /* QuickSpec.h in Headers */, - 3E2EDFA9F3C98AC672415C4F5A19ACEB /* World+DSL.h in Headers */, - 52BE965EEAE95A49CBCD52A8B98883DD /* World.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - CF6170C879FC9FDFD36519FAF76AA27E /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 88F266C0380D5FF237FFED90265AAF5B /* Reqres-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - EFDF3B631BBB965A372347705CA14854 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 9469DF81ECB494E84675969B5E13374C /* Alamofire-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F50142711583890403012B4493474C0B /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - EF87716A59442E302F4BF389CAD3B51F /* Pods-Reqres_Tests-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 40FF1C77152F384080A1A02E90A36DA9 /* Nimble */ = { - isa = PBXNativeTarget; - buildConfigurationList = A4964CB88DC1058EA701972205BBB4A0 /* Build configuration list for PBXNativeTarget "Nimble" */; - buildPhases = ( - 48AE5F6A6BC1CC0328D35EC2621B440C /* Sources */, - 050B68EC615B591FDA5D0B855E697228 /* Frameworks */, - C9CAD1C0891D5863FF8627A68CC68ECA /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Nimble; - productName = Nimble; - productReference = 4425057AEAD7C7511AAAA0EF0CB5D9D6 /* Nimble.framework */; - productType = "com.apple.product-type.framework"; - }; - 42F6321A9A0C7E2337B59DEBEC22EBAA /* Pods-Reqres_Example */ = { - isa = PBXNativeTarget; - buildConfigurationList = F6278050973A9E842CA841FD883F2660 /* Build configuration list for PBXNativeTarget "Pods-Reqres_Example" */; - buildPhases = ( - 96F9CC35A1E5D4E420EB5E2932908B66 /* Sources */, - EB7BD448A07EB7906902E0D4AB4FC699 /* Frameworks */, - 1D2ED83C9303903A669D3ABD46DFE067 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 4877DFF4C6C42D6CC711D11DAFFBF334 /* PBXTargetDependency */, - 6800AF1947002734DE36AFBC695725C5 /* PBXTargetDependency */, - ); - name = "Pods-Reqres_Example"; - productName = "Pods-Reqres_Example"; - productReference = 1E10BF32DB921AC4E744D39B0CFF0665 /* Pods_Reqres_Example.framework */; - productType = "com.apple.product-type.framework"; - }; - 79C040AFDDCE1BCBF6D8B5EB0B85887F /* Alamofire */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3CFB42910790CF0BDBCCEBAACD6B9367 /* Build configuration list for PBXNativeTarget "Alamofire" */; - buildPhases = ( - 120C4E824DDCCA024C170A491FF221A5 /* Sources */, - B1729F851F648EC60EE93CDB3C8BAEAD /* Frameworks */, - EFDF3B631BBB965A372347705CA14854 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Alamofire; - productName = Alamofire; - productReference = 86F03CF502A5B7989712CFBAC135C218 /* Alamofire.framework */; - productType = "com.apple.product-type.framework"; - }; - 7E2461CA3FD3FBFB1776E2F07F628BE5 /* Reqres */ = { - isa = PBXNativeTarget; - buildConfigurationList = A4B530461A0B2CC3E0C3497E859644D3 /* Build configuration list for PBXNativeTarget "Reqres" */; - buildPhases = ( - 49188034AADFCD55FA5BCE9FA716C2F6 /* Sources */, - 6C4F3AFC1106125E254688DA2E57EEBE /* Frameworks */, - CF6170C879FC9FDFD36519FAF76AA27E /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Reqres; - productName = Reqres; - productReference = BC1CAEF379BE313D15F3707035B895CC /* Reqres.framework */; - productType = "com.apple.product-type.framework"; - }; - 81841A8293CE85214B9B30E4BF50BF7A /* Pods-Reqres_Tests */ = { - isa = PBXNativeTarget; - buildConfigurationList = 99BC59CBFC59343ABAF30E2BD4DDEDC9 /* Build configuration list for PBXNativeTarget "Pods-Reqres_Tests" */; - buildPhases = ( - 3E292F7CD8BD3BA666BA6C6DECC23353 /* Sources */, - 56F8416351FBDDB87272BCEF68368A20 /* Frameworks */, - F50142711583890403012B4493474C0B /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - 60D0B2EAA7CB155AA543627788BAD8BE /* PBXTargetDependency */, - 30F605A54A337F551B309C396802069A /* PBXTargetDependency */, - ); - name = "Pods-Reqres_Tests"; - productName = "Pods-Reqres_Tests"; - productReference = 74BC32CA01B289BF0123B694A5E6ED3B /* Pods_Reqres_Tests.framework */; - productType = "com.apple.product-type.framework"; - }; - C6166AF3164DCCCE00BD8CD1E34FC140 /* Quick */ = { - isa = PBXNativeTarget; - buildConfigurationList = A632C42FEA37AB97776556CE8FCBBF77 /* Build configuration list for PBXNativeTarget "Quick" */; - buildPhases = ( - 3FC62525EF4AF2E088AEAB97F44682A5 /* Sources */, - 210F3A660CDCF30C17117B9ACF5F2083 /* Frameworks */, - CA547AC8CBBF7827CD90260359152FD8 /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Quick; - productName = Quick; - productReference = 4A7F4C5487ECE8FFD80A171C3ACF9ACA /* Quick.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 0730; - LastUpgradeCheck = 0700; - }; - buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 7DB346D0F39D3F0E887471402A8071AB; - productRefGroup = 3BEE88735A929B29148F6E4A7F2A4304 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 79C040AFDDCE1BCBF6D8B5EB0B85887F /* Alamofire */, - 40FF1C77152F384080A1A02E90A36DA9 /* Nimble */, - 42F6321A9A0C7E2337B59DEBEC22EBAA /* Pods-Reqres_Example */, - 81841A8293CE85214B9B30E4BF50BF7A /* Pods-Reqres_Tests */, - C6166AF3164DCCCE00BD8CD1E34FC140 /* Quick */, - 7E2461CA3FD3FBFB1776E2F07F628BE5 /* Reqres */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 120C4E824DDCCA024C170A491FF221A5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 62143065F94E53F437DCE5D7A998D66D /* AFError.swift in Sources */, - 8D463A0A4C65C02FDD5211F0F3C6F8B8 /* Alamofire-dummy.m in Sources */, - 7CA5A9BA5246FDA8227233E310029392 /* Alamofire.swift in Sources */, - E2A1C34237B4E928E5F85C097F4C2551 /* DispatchQueue+Alamofire.swift in Sources */, - C7A3408350643ADE1018826C766EE356 /* MultipartFormData.swift in Sources */, - E59BF19C0AFA68B741552319FC478C7B /* NetworkReachabilityManager.swift in Sources */, - 0C1B4E9FFB8B81E8833A3BAD537B1990 /* Notifications.swift in Sources */, - AF158CAAF4DD319009AFC855DC995D90 /* ParameterEncoding.swift in Sources */, - 12118C354EFA36292F82A8D0CFCE45B2 /* Request.swift in Sources */, - 86ED08F33B7D357932A9AB743E9D9EA7 /* Response.swift in Sources */, - B8154C96802336E5DDA5CEE97C3180A0 /* ResponseSerialization.swift in Sources */, - DF1BBF94997A2F4248B42B25EA919EC2 /* Result.swift in Sources */, - C0AEA97E7684DDAD56998C0AE198A433 /* ServerTrustPolicy.swift in Sources */, - 907AB123FBC8BC9340D5B7350CE828DF /* SessionDelegate.swift in Sources */, - A79AC30123B0C2177D67F6ED6A1B3215 /* SessionManager.swift in Sources */, - E1F583CB4A68A928CD197250AA752926 /* TaskDelegate.swift in Sources */, - 3982B850C43B41BA6D25F440F0412E9B /* Timeline.swift in Sources */, - FFFDD494EE6D1B83DDAF5F2721F685A6 /* Validation.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3E292F7CD8BD3BA666BA6C6DECC23353 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8074ABFADF57E7226E3155F19EDFCFFA /* Pods-Reqres_Tests-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 3FC62525EF4AF2E088AEAB97F44682A5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - A65D1DDAA198374D4E35F6565803CB0B /* Callsite.swift in Sources */, - 43E00A0BC15929DC049263BB18D1A174 /* Closures.swift in Sources */, - E17FEDC343D98DFC9C0182C3DAF4E223 /* Configuration.swift in Sources */, - 9039C8F5B4FA67C3B3ADFB56D7D54567 /* DSL.swift in Sources */, - 9FAF834689D1089199EA4071D647268D /* ErrorUtility.swift in Sources */, - 0F912C0552897372E48E491EE7DA4CD9 /* Example.swift in Sources */, - C8396B338542FDF76B0C5129DFD07BF6 /* ExampleGroup.swift in Sources */, - CEDDDCD36A6FEDB9DD89E6C36C263315 /* ExampleHooks.swift in Sources */, - 04A5E25C4F97A20FA1D9F78FD9C600EC /* ExampleMetadata.swift in Sources */, - 8069F3240BE1630BA9FB19C2855CCC55 /* Filter.swift in Sources */, - D7C35CAE9CCF826D82BD5A331266A765 /* HooksPhase.swift in Sources */, - 5B5708F7FC8AAB9F39B807AA9FC9A6ED /* NSBundle+CurrentTestBundle.swift in Sources */, - C50DC29835E621BFA328E34EF0CC1C19 /* NSString+QCKSelectorName.m in Sources */, - 7A902FFCC4C64E9AE4C5F09E7A4846FD /* QCKDSL.m in Sources */, - 73B8C261F61C81EE16432ADB071322D9 /* Quick-dummy.m in Sources */, - 00108271735E1EE8FA75113665E19094 /* QuickConfiguration.m in Sources */, - 020490E23A457AA6C5225F987FCD4A11 /* QuickSelectedTestSuiteBuilder.swift in Sources */, - 26ED92B1BA35D06041238B9D89531681 /* QuickSpec.m in Sources */, - 4299889F289E0AD046591E54E1E7A092 /* QuickTestSuite.swift in Sources */, - 3C5C0BABD550366FB937A5910346E06A /* String+FileName.swift in Sources */, - 7AC642E623A0CA5BDCA914E92C09D683 /* SuiteHooks.swift in Sources */, - 413EC24D3649EA8C9102CB837C303116 /* World+DSL.swift in Sources */, - BEEBF86D5A86D3AF060556475FBC87DB /* World.swift in Sources */, - 45A59CE9EF13570DF800D9D7A655639A /* XCTestSuite+QuickTestSuiteBuilder.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 48AE5F6A6BC1CC0328D35EC2621B440C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E008736F5514F44C0E07DD052A7B6D67 /* AdapterProtocols.swift in Sources */, - 5A4AC5619A05687E5EB0A4BBDC8AF154 /* AllPass.swift in Sources */, - 35E0EBA7AA92E190AB5B4ACFCF0F61C4 /* AssertionDispatcher.swift in Sources */, - BBF88FA3F28C0906DBB78314A8E50A01 /* AssertionRecorder.swift in Sources */, - 92BC58B0158D9DFE7D59C341A85D4359 /* Async.swift in Sources */, - 24AE47A6560D6EBB0AFF78BAAAB15E0F /* AsyncMatcherWrapper.swift in Sources */, - 7F8AC53F92F56C3319DD733CAFB9DD58 /* BeAKindOf.swift in Sources */, - E8DE03684C234604E472C27ECD8F6B70 /* BeAnInstanceOf.swift in Sources */, - 602B5CEB21CA60AFA67B508D13282E94 /* BeCloseTo.swift in Sources */, - FA145DCE313D583C0431D178FB32C96F /* BeEmpty.swift in Sources */, - BA7362188C5D17958A5080EE299A90FC /* BeginWith.swift in Sources */, - 3D7AF86E9032C99357D2ED046461874F /* BeGreaterThan.swift in Sources */, - 3C918E40C04067FAF57B447C0BC52B04 /* BeGreaterThanOrEqualTo.swift in Sources */, - FF0366DFC597745127A6D92AB83F0D60 /* BeIdenticalTo.swift in Sources */, - 59A4C06B57864AA9BBFAE0B762DAE871 /* BeLessThan.swift in Sources */, - 39007AD3711A35BCFA1D853E7AB79510 /* BeLessThanOrEqual.swift in Sources */, - D45096E61E72E772AF46C3BECA03583B /* BeLogical.swift in Sources */, - 21FCC4B725EAF5F42EDFDA386FF3EC4C /* BeNil.swift in Sources */, - A9DA3829FA747E599023EF1394CD2EB5 /* BeVoid.swift in Sources */, - 6445B28465C1A7900E895709BC333C23 /* Contain.swift in Sources */, - C81BEDE79545C013BEBBA0363480FD47 /* DSL+Wait.swift in Sources */, - 344BEE9094F8B903BDACA3AB5811436C /* DSL.m in Sources */, - 3B78C4F35C369FBABE62D4622A67E7DF /* DSL.swift in Sources */, - 9EFD3EE819EB1FAA5EDE26E8DAA483CD /* EndWith.swift in Sources */, - B78A3DF47B5FEF7D9BE0B7660500211B /* Equal.swift in Sources */, - 59AFC17D744CDEED360B4DF8876295BF /* Errors.swift in Sources */, - 95F54B9537875729AE90B472EA5D39BF /* Expectation.swift in Sources */, - 5B21B2BBADCCEB5AC51E0A0C99BA5B93 /* Expression.swift in Sources */, - EFE20ADE81CBE47F13D76267285C4A35 /* FailureMessage.swift in Sources */, - 684A7E4C24ADAAB1B497B5F658036FC2 /* Functional.swift in Sources */, - C755136BFCDFA000C44C8BBCA065E4BE /* HaveCount.swift in Sources */, - 9296C7ABDE9E5894D47CD74E7F78F968 /* Match.swift in Sources */, - 8DFE23F2C7973BC8A159168AFC2FB8C3 /* MatcherFunc.swift in Sources */, - DE5F3C28CC8C40B8031C784835B3577D /* MatcherProtocols.swift in Sources */, - 56CA153033917F08CCDD22E94806C873 /* MatchError.swift in Sources */, - D8E0C72DDE130D4471BB48D2081FD235 /* Nimble-dummy.m in Sources */, - 263465A57520B440C99D428CE2E51AE9 /* NimbleEnvironment.swift in Sources */, - B09B3461D9467BA8A230048F95C26E0F /* NimbleXCTestHandler.swift in Sources */, - AB2B63BFFD7A11E6871B472150F7984B /* NMBExceptionCapture.m in Sources */, - C10896B1EEB0291A92FBA848007CD7CF /* NMBExpectation.swift in Sources */, - 74C0C955A968122899AB6E0DA79D3FA0 /* NMBObjCMatcher.swift in Sources */, - F35657C05DC39E78A33D79BDD92ECA64 /* NMBStringify.m in Sources */, - A18E791645056D5563206104A3E3AD87 /* PostNotification.swift in Sources */, - 41EE5E3698CC1A17046AC74B36A279E0 /* RaisesException.swift in Sources */, - BEA76FA499D5899BD98DBD891FF921D4 /* SatisfyAnyOf.swift in Sources */, - 9D904B7EAD0EC56AD12E704757CAA640 /* SourceLocation.swift in Sources */, - 43B99F06587ACD844A4D09A0ED9FB66B /* Stringers.swift in Sources */, - 099C64CF560DC424DB43BBBEC6370D8F /* ThrowError.swift in Sources */, - 9DBED967731DE53C22AD17C3E09079FD /* XCTestObservationCenter+Register.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 49188034AADFCD55FA5BCE9FA716C2F6 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 197C8AB9D9A745366D2B17418DAD1C70 /* Reqres-dummy.m in Sources */, - 7B55996F605148A8E6522A2B35E08B2A /* Reqres.swift in Sources */, - D211AA615955C84CC367E80EF98A07D6 /* ReqresDefaultLogger.swift in Sources */, - 7ABCA22102C314C0532B5D43A404C3EF /* ReqresLogging.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 96F9CC35A1E5D4E420EB5E2932908B66 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5982AF99D452796006EA3EA5FA74D5EF /* Pods-Reqres_Example-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 30F605A54A337F551B309C396802069A /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Quick; - target = C6166AF3164DCCCE00BD8CD1E34FC140 /* Quick */; - targetProxy = B03DDDD7FF9D1CEB60ABF96EC1DBDB60 /* PBXContainerItemProxy */; - }; - 4877DFF4C6C42D6CC711D11DAFFBF334 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Alamofire; - target = 79C040AFDDCE1BCBF6D8B5EB0B85887F /* Alamofire */; - targetProxy = 1BFB69C537F649F1311D9022FBD205F7 /* PBXContainerItemProxy */; - }; - 60D0B2EAA7CB155AA543627788BAD8BE /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Nimble; - target = 40FF1C77152F384080A1A02E90A36DA9 /* Nimble */; - targetProxy = 6E9B59F90D71C9DAF6F966749D3C85DD /* PBXContainerItemProxy */; - }; - 6800AF1947002734DE36AFBC695725C5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = Reqres; - target = 7E2461CA3FD3FBFB1776E2F07F628BE5 /* Reqres */; - targetProxy = D985CC6FC55D0CE08D0AB3822BCDE47C /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 153BCB8FE7EAF4D30912413A52690C73 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 91DF3E165A4618BE917060531BADB9C4 /* Pods-Reqres_Example.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-Reqres_Example/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_Reqres_Example; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 54374547FF3533A5646787202885D156 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 6D84D21BE44632BDC99AEC4370A0B377 /* Pods-Reqres_Tests.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-Reqres_Tests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_Reqres_Tests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 54EDB3C38632578B298D2E086487C752 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3B3452B767CEF00DE5D813027E2AE913 /* Quick.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Quick/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/Quick/Quick.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = Quick; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 59B042A655B7C20CBAB90E385BF4E4C7 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGNING_REQUIRED = NO; - COPY_PHASE_STRIP = NO; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_DEBUG=1", - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - ONLY_ACTIVE_ARCH = YES; - PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; - STRIP_INSTALLED_PRODUCT = NO; - SYMROOT = "${SRCROOT}/../build"; - }; - name = Debug; - }; - 63663DD1CE90207E256F6B286C04A32A /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3B3452B767CEF00DE5D813027E2AE913 /* Quick.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Quick/Quick-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Quick/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/Quick/Quick.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = Quick; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 7F93EF234CD87F7448472375CC1EFA96 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 761470A899327CC29BE3AEE979E544E0 /* Alamofire.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Alamofire/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = Alamofire; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - A4430C9A172B825D8C3897B6DC93C8D4 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = AE8491FA4F08FAFECE57A0092500A02E /* Nimble.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Nimble/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/Nimble/Nimble.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = Nimble; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - B7324857C38B065FEB1EEE3105C2367A /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGNING_REQUIRED = NO; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_RELEASE=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; - STRIP_INSTALLED_PRODUCT = NO; - SYMROOT = "${SRCROOT}/../build"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - CBC2654DF47C3056FED8672985C00D10 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BC5583418614A9AE0899F304FB1D6C96 /* Reqres.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Reqres/Reqres-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Reqres/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/Reqres/Reqres.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = Reqres; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - DDA5A606A0B7062DEA5E47CD9FA65A3D /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 761470A899327CC29BE3AEE979E544E0 /* Alamofire.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Alamofire/Alamofire-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Alamofire/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MODULEMAP_FILE = "Target Support Files/Alamofire/Alamofire.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - PRODUCT_NAME = Alamofire; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - E1D7FA5E8F224B121D0ECBD7ED084C38 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = AE8491FA4F08FAFECE57A0092500A02E /* Nimble.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Nimble/Nimble-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Nimble/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/Nimble/Nimble.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = Nimble; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - ECC67D82B32D5B442264AF5445DD3DCE /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = CAA4913ABEDF41638D0D8272F59CE1F5 /* Pods-Reqres_Tests.release.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-Reqres_Tests/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.modulemap"; - MTL_ENABLE_DEBUG_INFO = NO; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_Reqres_Tests; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - FB22F781C101320470238E16E6E5D777 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = BC5583418614A9AE0899F304FB1D6C96 /* Reqres.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_PREFIX_HEADER = "Target Support Files/Reqres/Reqres-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/Reqres/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/Reqres/Reqres.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - PRODUCT_NAME = Reqres; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - FB359386816FF8CD0307FB25274B0994 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = E5611AFA8C33F8967785FDBE449A83E5 /* Pods-Reqres_Example.debug.xcconfig */; - buildSettings = { - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEBUG_INFORMATION_FORMAT = dwarf; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_NO_COMMON_BLOCKS = YES; - INFOPLIST_FILE = "Target Support Files/Pods-Reqres_Example/Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.modulemap"; - MTL_ENABLE_DEBUG_INFO = YES; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = Pods_Reqres_Example; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 59B042A655B7C20CBAB90E385BF4E4C7 /* Debug */, - B7324857C38B065FEB1EEE3105C2367A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 3CFB42910790CF0BDBCCEBAACD6B9367 /* Build configuration list for PBXNativeTarget "Alamofire" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7F93EF234CD87F7448472375CC1EFA96 /* Debug */, - DDA5A606A0B7062DEA5E47CD9FA65A3D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 99BC59CBFC59343ABAF30E2BD4DDEDC9 /* Build configuration list for PBXNativeTarget "Pods-Reqres_Tests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 54374547FF3533A5646787202885D156 /* Debug */, - ECC67D82B32D5B442264AF5445DD3DCE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A4964CB88DC1058EA701972205BBB4A0 /* Build configuration list for PBXNativeTarget "Nimble" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E1D7FA5E8F224B121D0ECBD7ED084C38 /* Debug */, - A4430C9A172B825D8C3897B6DC93C8D4 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A4B530461A0B2CC3E0C3497E859644D3 /* Build configuration list for PBXNativeTarget "Reqres" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - FB22F781C101320470238E16E6E5D777 /* Debug */, - CBC2654DF47C3056FED8672985C00D10 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - A632C42FEA37AB97776556CE8FCBBF77 /* Build configuration list for PBXNativeTarget "Quick" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 54EDB3C38632578B298D2E086487C752 /* Debug */, - 63663DD1CE90207E256F6B286C04A32A /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F6278050973A9E842CA841FD883F2660 /* Build configuration list for PBXNativeTarget "Pods-Reqres_Example" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - FB359386816FF8CD0307FB25274B0994 /* Debug */, - 153BCB8FE7EAF4D30912413A52690C73 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; -} diff --git a/Example/Pods/Quick/LICENSE b/Example/Pods/Quick/LICENSE deleted file mode 100644 index e900165..0000000 --- a/Example/Pods/Quick/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014, Quick Team - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Example/Pods/Quick/README.md b/Example/Pods/Quick/README.md deleted file mode 100644 index 5c94cef..0000000 --- a/Example/Pods/Quick/README.md +++ /dev/null @@ -1,69 +0,0 @@ -![](http://f.cl.ly/items/0r1E192C1R0b2g2Q3h2w/QuickLogo_Color.png) - -[![Build Status](https://travis-ci.org/Quick/Quick.svg?branch=master)](https://travis-ci.org/Quick/Quick) - -Quick is a behavior-driven development framework for Swift and Objective-C. -Inspired by [RSpec](https://github.com/rspec/rspec), [Specta](https://github.com/specta/specta), and [Ginkgo](https://github.com/onsi/ginkgo). - -![](https://raw.githubusercontent.com/Quick/Assets/master/Screenshots/QuickSpec%20screenshot.png) - -```swift -// Swift - -import Quick -import Nimble - -class TableOfContentsSpec: QuickSpec { - override func spec() { - describe("the 'Documentation' directory") { - it("has everything you need to get started") { - let sections = Directory("Documentation").sections - expect(sections).to(contain("Organized Tests with Quick Examples and Example Groups")) - expect(sections).to(contain("Installing Quick")) - } - - context("if it doesn't have what you're looking for") { - it("needs to be updated") { - let you = You(awesome: true) - expect{you.submittedAnIssue}.toEventually(beTruthy()) - } - } - } - } -} -``` -#### Nimble -Quick comes together with [Nimble](https://github.com/Quick/Nimble) — a matcher framework for your tests. You can learn why `XCTAssert()` statements make your expectations unclear and how to fix that using Nimble assertions [here](./Documentation/en-us/NimbleAssertions.md). - -## Documentation - -All documentation can be found in the [Documentation folder](./Documentation), including [detailed installation instructions](./Documentation/en-us/InstallingQuick.md) for CocoaPods, Carthage, Git submodules, and more. For example, you can install Quick and [Nimble](https://github.com/Quick/Nimble) using CocoaPods by adding the following to your Podfile: - -```rb -# Podfile - -use_frameworks! - -def testing_pods - pod 'Quick' - pod 'Nimble' -end - -target 'MyTests' do - testing_pods -end - -target 'MyUITests' do - testing_pods -end -``` - -## Projects using Quick - -Many apps use both Quick and Nimble however, as they are not included in the app binary, neither appear in “Top Used Libraries” blog posts. Therefore, it would be greatly appreciated to remind contributors that their efforts are valued by compiling a list of organizations and projects that use them. - -Does your organization or project use Quick and Nimble? If yes, [please add your project to the list](https://github.com/Quick/Quick/wiki/Projects-using-Quick). - -## License - -Apache 2.0 license. See the [`LICENSE`](LICENSE) file for details. diff --git a/Example/Pods/Quick/Sources/Quick/Callsite.swift b/Example/Pods/Quick/Sources/Quick/Callsite.swift deleted file mode 100644 index 53496cd..0000000 --- a/Example/Pods/Quick/Sources/Quick/Callsite.swift +++ /dev/null @@ -1,30 +0,0 @@ -import Foundation - -/** - An object encapsulating the file and line number at which - a particular example is defined. -*/ -final public class Callsite: NSObject { - /** - The absolute path of the file in which an example is defined. - */ - public let file: String - - /** - The line number on which an example is defined. - */ - public let line: UInt - - internal init(file: String, line: UInt) { - self.file = file - self.line = line - } -} - -/** - Returns a boolean indicating whether two Callsite objects are equal. - If two callsites are in the same file and on the same line, they must be equal. -*/ -public func ==(lhs: Callsite, rhs: Callsite) -> Bool { - return lhs.file == rhs.file && lhs.line == rhs.line -} diff --git a/Example/Pods/Quick/Sources/Quick/Configuration/Configuration.swift b/Example/Pods/Quick/Sources/Quick/Configuration/Configuration.swift deleted file mode 100644 index 9836fef..0000000 --- a/Example/Pods/Quick/Sources/Quick/Configuration/Configuration.swift +++ /dev/null @@ -1,161 +0,0 @@ -import Foundation - -/** - A closure that temporarily exposes a Configuration object within - the scope of the closure. -*/ -public typealias QuickConfigurer = (_ configuration: Configuration) -> () - -/** - A closure that, given metadata about an example, returns a boolean value - indicating whether that example should be run. -*/ -public typealias ExampleFilter = (_ example: Example) -> Bool - -/** - A configuration encapsulates various options you can use - to configure Quick's behavior. -*/ -final public class Configuration: NSObject { - internal let exampleHooks = ExampleHooks() - internal let suiteHooks = SuiteHooks() - internal var exclusionFilters: [ExampleFilter] = [{ example in - if let pending = example.filterFlags[Filter.pending] { - return pending - } else { - return false - } - }] - internal var inclusionFilters: [ExampleFilter] = [{ example in - if let focused = example.filterFlags[Filter.focused] { - return focused - } else { - return false - } - }] - - /** - Run all examples if none match the configured filters. True by default. - */ - public var runAllWhenEverythingFiltered = true - - /** - Registers an inclusion filter. - - All examples are filtered using all inclusion filters. - The remaining examples are run. If no examples remain, all examples are run. - - - parameter filter: A filter that, given an example, returns a value indicating - whether that example should be included in the examples - that are run. - */ - public func include(_ filter: @escaping ExampleFilter) { - inclusionFilters.append(filter) - } - - /** - Registers an exclusion filter. - - All examples that remain after being filtered by the inclusion filters are - then filtered via all exclusion filters. - - - parameter filter: A filter that, given an example, returns a value indicating - whether that example should be excluded from the examples - that are run. - */ - public func exclude(_ filter: @escaping ExampleFilter) { - exclusionFilters.append(filter) - } - - /** - Identical to Quick.Configuration.beforeEach, except the closure is - provided with metadata on the example that the closure is being run - prior to. - */ -#if _runtime(_ObjC) - @objc(beforeEachWithMetadata:) - public func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure) { - exampleHooks.appendBefore(closure) - } -#else - public func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure) { - exampleHooks.appendBefore(closure) - } -#endif - - /** - Like Quick.DSL.beforeEach, this configures Quick to execute the - given closure before each example that is run. The closure - passed to this method is executed before each example Quick runs, - globally across the test suite. You may call this method multiple - times across mulitple +[QuickConfigure configure:] methods in order - to define several closures to run before each example. - - Note that, since Quick makes no guarantee as to the order in which - +[QuickConfiguration configure:] methods are evaluated, there is no - guarantee as to the order in which beforeEach closures are evaluated - either. Mulitple beforeEach defined on a single configuration, however, - will be executed in the order they're defined. - - - parameter closure: The closure to be executed before each example - in the test suite. - */ - public func beforeEach(_ closure: @escaping BeforeExampleClosure) { - exampleHooks.appendBefore(closure) - } - - /** - Identical to Quick.Configuration.afterEach, except the closure - is provided with metadata on the example that the closure is being - run after. - */ -#if _runtime(_ObjC) - @objc(afterEachWithMetadata:) - public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) { - exampleHooks.appendAfter(closure) - } -#else - public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) { - exampleHooks.appendAfter(closure) - } -#endif - - /** - Like Quick.DSL.afterEach, this configures Quick to execute the - given closure after each example that is run. The closure - passed to this method is executed after each example Quick runs, - globally across the test suite. You may call this method multiple - times across mulitple +[QuickConfigure configure:] methods in order - to define several closures to run after each example. - - Note that, since Quick makes no guarantee as to the order in which - +[QuickConfiguration configure:] methods are evaluated, there is no - guarantee as to the order in which afterEach closures are evaluated - either. Mulitple afterEach defined on a single configuration, however, - will be executed in the order they're defined. - - - parameter closure: The closure to be executed before each example - in the test suite. - */ - public func afterEach(_ closure: @escaping AfterExampleClosure) { - exampleHooks.appendAfter(closure) - } - - /** - Like Quick.DSL.beforeSuite, this configures Quick to execute - the given closure prior to any and all examples that are run. - The two methods are functionally equivalent. - */ - public func beforeSuite(_ closure: @escaping BeforeSuiteClosure) { - suiteHooks.appendBefore(closure) - } - - /** - Like Quick.DSL.afterSuite, this configures Quick to execute - the given closure after all examples have been run. - The two methods are functionally equivalent. - */ - public func afterSuite(_ closure: @escaping AfterSuiteClosure) { - suiteHooks.appendAfter(closure) - } -} diff --git a/Example/Pods/Quick/Sources/Quick/DSL/DSL.swift b/Example/Pods/Quick/Sources/Quick/DSL/DSL.swift deleted file mode 100644 index b514b82..0000000 --- a/Example/Pods/Quick/Sources/Quick/DSL/DSL.swift +++ /dev/null @@ -1,227 +0,0 @@ -/** - Defines a closure to be run prior to any examples in the test suite. - You may define an unlimited number of these closures, but there is no - guarantee as to the order in which they're run. - - If the test suite crashes before the first example is run, this closure - will not be executed. - - - parameter closure: The closure to be run prior to any examples in the test suite. -*/ -public func beforeSuite(_ closure: @escaping BeforeSuiteClosure) { - World.sharedWorld.beforeSuite(closure) -} - -/** - Defines a closure to be run after all of the examples in the test suite. - You may define an unlimited number of these closures, but there is no - guarantee as to the order in which they're run. - - If the test suite crashes before all examples are run, this closure - will not be executed. - - - parameter closure: The closure to be run after all of the examples in the test suite. -*/ -public func afterSuite(_ closure: @escaping AfterSuiteClosure) { - World.sharedWorld.afterSuite(closure) -} - -/** - Defines a group of shared examples. These examples can be re-used in several locations - by using the `itBehavesLike` function. - - - parameter name: The name of the shared example group. This must be unique across all shared example - groups defined in a test suite. - - parameter closure: A closure containing the examples. This behaves just like an example group defined - using `describe` or `context`--the closure may contain any number of `beforeEach` - and `afterEach` closures, as well as any number of examples (defined using `it`). -*/ -public func sharedExamples(_ name: String, closure: @escaping () -> ()) { - World.sharedWorld.sharedExamples(name, closure: { (NSDictionary) in closure() }) -} - -/** - Defines a group of shared examples. These examples can be re-used in several locations - by using the `itBehavesLike` function. - - - parameter name: The name of the shared example group. This must be unique across all shared example - groups defined in a test suite. - - parameter closure: A closure containing the examples. This behaves just like an example group defined - using `describe` or `context`--the closure may contain any number of `beforeEach` - and `afterEach` closures, as well as any number of examples (defined using `it`). - - The closure takes a SharedExampleContext as an argument. This context is a function - that can be executed to retrieve parameters passed in via an `itBehavesLike` function. -*/ -public func sharedExamples(_ name: String, closure: @escaping SharedExampleClosure) { - World.sharedWorld.sharedExamples(name, closure: closure) -} - -/** - Defines an example group. Example groups are logical groupings of examples. - Example groups can share setup and teardown code. - - - parameter description: An arbitrary string describing the example group. - - parameter closure: A closure that can contain other examples. - - parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups. -*/ -public func describe(_ description: String, flags: FilterFlags = [:], closure: () -> ()) { - World.sharedWorld.describe(description, flags: flags, closure: closure) -} - -/** - Defines an example group. Equivalent to `describe`. -*/ -public func context(_ description: String, flags: FilterFlags = [:], closure: () -> ()) { - World.sharedWorld.context(description, flags: flags, closure: closure) -} - -/** - Defines a closure to be run prior to each example in the current example - group. This closure is not run for pending or otherwise disabled examples. - An example group may contain an unlimited number of beforeEach. They'll be - run in the order they're defined, but you shouldn't rely on that behavior. - - - parameter closure: The closure to be run prior to each example. -*/ -public func beforeEach(_ closure: @escaping BeforeExampleClosure) { - World.sharedWorld.beforeEach(closure) -} - -/** - Identical to Quick.DSL.beforeEach, except the closure is provided with - metadata on the example that the closure is being run prior to. -*/ -public func beforeEach(_ closure: @escaping BeforeExampleWithMetadataClosure) { - World.sharedWorld.beforeEach(closure: closure) -} - -/** - Defines a closure to be run after each example in the current example - group. This closure is not run for pending or otherwise disabled examples. - An example group may contain an unlimited number of afterEach. They'll be - run in the order they're defined, but you shouldn't rely on that behavior. - - - parameter closure: The closure to be run after each example. -*/ -public func afterEach(_ closure: @escaping AfterExampleClosure) { - World.sharedWorld.afterEach(closure) -} - -/** - Identical to Quick.DSL.afterEach, except the closure is provided with - metadata on the example that the closure is being run after. -*/ -public func afterEach(_ closure: @escaping AfterExampleWithMetadataClosure) { - World.sharedWorld.afterEach(closure: closure) -} - -/** - Defines an example. Examples use assertions to demonstrate how code should - behave. These are like "tests" in XCTest. - - - parameter description: An arbitrary string describing what the example is meant to specify. - - parameter closure: A closure that can contain assertions. - - parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups. - Empty by default. - - parameter file: The absolute path to the file containing the example. A sensible default is provided. - - parameter line: The line containing the example. A sensible default is provided. -*/ -public func it(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> ()) { - World.sharedWorld.it(description, flags: flags, file: file, line: line, closure: closure) -} - -/** - Inserts the examples defined using a `sharedExamples` function into the current example group. - The shared examples are executed at this location, as if they were written out manually. - - - parameter name: The name of the shared examples group to be executed. This must be identical to the - name of a shared examples group defined using `sharedExamples`. If there are no shared - examples that match the name given, an exception is thrown and the test suite will crash. - - parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups. - Empty by default. - - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. - - parameter line: The line containing the current example group. A sensible default is provided. -*/ -public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line) { - itBehavesLike(name, flags: flags, file: file, line: line, sharedExampleContext: { return [:] }) -} - -/** - Inserts the examples defined using a `sharedExamples` function into the current example group. - The shared examples are executed at this location, as if they were written out manually. - This function also passes those shared examples a context that can be evaluated to give the shared - examples extra information on the subject of the example. - - - parameter name: The name of the shared examples group to be executed. This must be identical to the - name of a shared examples group defined using `sharedExamples`. If there are no shared - examples that match the name given, an exception is thrown and the test suite will crash. - - parameter sharedExampleContext: A closure that, when evaluated, returns key-value pairs that provide the - shared examples with extra information on the subject of the example. - - parameter flags: A mapping of string keys to booleans that can be used to filter examples or example groups. - Empty by default. - - parameter file: The absolute path to the file containing the current example group. A sensible default is provided. - - parameter line: The line containing the current example group. A sensible default is provided. -*/ -public func itBehavesLike(_ name: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, sharedExampleContext: @escaping SharedExampleContext) { - World.sharedWorld.itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) -} - -/** - Defines an example or example group that should not be executed. Use `pending` to temporarily disable - examples or groups that should not be run yet. - - - parameter description: An arbitrary string describing the example or example group. - - parameter closure: A closure that will not be evaluated. -*/ -public func pending(_ description: String, closure: () -> ()) { - World.sharedWorld.pending(description, closure: closure) -} - -/** - Use this to quickly mark a `describe` closure as pending. - This disables all examples within the closure. -*/ -public func xdescribe(_ description: String, flags: FilterFlags, closure: () -> ()) { - World.sharedWorld.xdescribe(description, flags: flags, closure: closure) -} - -/** - Use this to quickly mark a `context` closure as pending. - This disables all examples within the closure. -*/ -public func xcontext(_ description: String, flags: FilterFlags, closure: () -> ()) { - xdescribe(description, flags: flags, closure: closure) -} - -/** - Use this to quickly mark an `it` closure as pending. - This disables the example and ensures the code within the closure is never run. -*/ -public func xit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> ()) { - World.sharedWorld.xit(description, flags: flags, file: file, line: line, closure: closure) -} - -/** - Use this to quickly focus a `describe` closure, focusing the examples in the closure. - If any examples in the test suite are focused, only those examples are executed. - This trumps any explicitly focused or unfocused examples within the closure--they are all treated as focused. -*/ -public func fdescribe(_ description: String, flags: FilterFlags = [:], closure: () -> ()) { - World.sharedWorld.fdescribe(description, flags: flags, closure: closure) -} - -/** - Use this to quickly focus a `context` closure. Equivalent to `fdescribe`. -*/ -public func fcontext(_ description: String, flags: FilterFlags = [:], closure: () -> ()) { - fdescribe(description, flags: flags, closure: closure) -} - -/** - Use this to quickly focus an `it` closure, focusing the example. - If any examples in the test suite are focused, only those examples are executed. -*/ -public func fit(_ description: String, flags: FilterFlags = [:], file: String = #file, line: UInt = #line, closure: @escaping () -> ()) { - World.sharedWorld.fit(description, flags: flags, file: file, line: line, closure: closure) -} diff --git a/Example/Pods/Quick/Sources/Quick/DSL/World+DSL.swift b/Example/Pods/Quick/Sources/Quick/DSL/World+DSL.swift deleted file mode 100644 index ab35341..0000000 --- a/Example/Pods/Quick/Sources/Quick/DSL/World+DSL.swift +++ /dev/null @@ -1,169 +0,0 @@ -import Foundation - -/** - Adds methods to World to support top-level DSL functions (Swift) and - macros (Objective-C). These functions map directly to the DSL that test - writers use in their specs. -*/ -extension World { - internal func beforeSuite(_ closure: @escaping BeforeSuiteClosure) { - suiteHooks.appendBefore(closure) - } - - internal func afterSuite(_ closure: @escaping AfterSuiteClosure) { - suiteHooks.appendAfter(closure) - } - - internal func sharedExamples(_ name: String, closure: @escaping SharedExampleClosure) { - registerSharedExample(name, closure: closure) - } - - internal func describe(_ description: String, flags: FilterFlags, closure: () -> ()) { - guard currentExampleMetadata == nil else { - raiseError("'describe' cannot be used inside '\(currentPhase)', 'describe' may only be used inside 'context' or 'describe'. ") - } - guard currentExampleGroup != nil else { - raiseError("Error: example group was not created by its parent QuickSpec spec. Check that describe() or context() was used in QuickSpec.spec() and not a more general context (i.e. an XCTestCase test)") - } - let group = ExampleGroup(description: description, flags: flags) - currentExampleGroup.appendExampleGroup(group) - performWithCurrentExampleGroup(group, closure: closure) - } - - internal func context(_ description: String, flags: FilterFlags, closure: () -> ()) { - guard currentExampleMetadata == nil else { - raiseError("'context' cannot be used inside '\(currentPhase)', 'context' may only be used inside 'context' or 'describe'. ") - } - self.describe(description, flags: flags, closure: closure) - } - - internal func fdescribe(_ description: String, flags: FilterFlags, closure: () -> ()) { - var focusedFlags = flags - focusedFlags[Filter.focused] = true - self.describe(description, flags: focusedFlags, closure: closure) - } - - internal func xdescribe(_ description: String, flags: FilterFlags, closure: () -> ()) { - var pendingFlags = flags - pendingFlags[Filter.pending] = true - self.describe(description, flags: pendingFlags, closure: closure) - } - - internal func beforeEach(_ closure: @escaping BeforeExampleClosure) { - guard currentExampleMetadata == nil else { - raiseError("'beforeEach' cannot be used inside '\(currentPhase)', 'beforeEach' may only be used inside 'context' or 'describe'. ") - } - currentExampleGroup.hooks.appendBefore(closure) - } - -#if _runtime(_ObjC) - @objc(beforeEachWithMetadata:) - internal func beforeEach(closure: @escaping BeforeExampleWithMetadataClosure) { - currentExampleGroup.hooks.appendBefore(closure) - } -#else - internal func beforeEach(closure: @escaping BeforeExampleWithMetadataClosure) { - currentExampleGroup.hooks.appendBefore(closure) - } -#endif - - internal func afterEach(_ closure: @escaping AfterExampleClosure) { - guard currentExampleMetadata == nil else { - raiseError("'afterEach' cannot be used inside '\(currentPhase)', 'afterEach' may only be used inside 'context' or 'describe'. ") - } - currentExampleGroup.hooks.appendAfter(closure) - } - -#if _runtime(_ObjC) - @objc(afterEachWithMetadata:) - internal func afterEach(closure: @escaping AfterExampleWithMetadataClosure) { - currentExampleGroup.hooks.appendAfter(closure) - } -#else - internal func afterEach(closure: @escaping AfterExampleWithMetadataClosure) { - currentExampleGroup.hooks.appendAfter(closure) - } -#endif - - internal func it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) { - if beforesCurrentlyExecuting { - raiseError("'it' cannot be used inside 'beforeEach', 'it' may only be used inside 'context' or 'describe'. ") - } - if aftersCurrentlyExecuting { - raiseError("'it' cannot be used inside 'afterEach', 'it' may only be used inside 'context' or 'describe'. ") - } - guard currentExampleMetadata == nil else { - raiseError("'it' cannot be used inside 'it', 'it' may only be used inside 'context' or 'describe'. ") - } - let callsite = Callsite(file: file, line: line) - let example = Example(description: description, callsite: callsite, flags: flags, closure: closure) - currentExampleGroup.appendExample(example) - } - - internal func fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) { - var focusedFlags = flags - focusedFlags[Filter.focused] = true - self.it(description, flags: focusedFlags, file: file, line: line, closure: closure) - } - - internal func xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) { - var pendingFlags = flags - pendingFlags[Filter.pending] = true - self.it(description, flags: pendingFlags, file: file, line: line, closure: closure) - } - - internal func itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { - guard currentExampleMetadata == nil else { - raiseError("'itBehavesLike' cannot be used inside '\(currentPhase)', 'itBehavesLike' may only be used inside 'context' or 'describe'. ") - } - let callsite = Callsite(file: file, line: line) - let closure = World.sharedWorld.sharedExample(name) - - let group = ExampleGroup(description: name, flags: flags) - currentExampleGroup.appendExampleGroup(group) - performWithCurrentExampleGroup(group) { - closure(sharedExampleContext) - } - - group.walkDownExamples { (example: Example) in - example.isSharedExample = true - example.callsite = callsite - } - } - -#if _runtime(_ObjC) - @objc(itWithDescription:flags:file:line:closure:) - private func objc_it(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) { - it(description, flags: flags, file: file, line: line, closure: closure) - } - - @objc(fitWithDescription:flags:file:line:closure:) - private func objc_fit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) { - fit(description, flags: flags, file: file, line: line, closure: closure) - } - - @objc(xitWithDescription:flags:file:line:closure:) - private func objc_xit(_ description: String, flags: FilterFlags, file: String, line: UInt, closure: @escaping () -> ()) { - xit(description, flags: flags, file: file, line: line, closure: closure) - } - - @objc(itBehavesLikeSharedExampleNamed:sharedExampleContext:flags:file:line:) - private func objc_itBehavesLike(_ name: String, sharedExampleContext: @escaping SharedExampleContext, flags: FilterFlags, file: String, line: UInt) { - itBehavesLike(name, sharedExampleContext: sharedExampleContext, flags: flags, file: file, line: line) - } -#endif - - internal func pending(_ description: String, closure: () -> ()) { - print("Pending: \(description)") - } - - private var currentPhase: String { - if beforesCurrentlyExecuting { - return "beforeEach" - } else if aftersCurrentlyExecuting { - return "afterEach" - } - - return "it" - } -} diff --git a/Example/Pods/Quick/Sources/Quick/ErrorUtility.swift b/Example/Pods/Quick/Sources/Quick/ErrorUtility.swift deleted file mode 100644 index 8405a81..0000000 --- a/Example/Pods/Quick/Sources/Quick/ErrorUtility.swift +++ /dev/null @@ -1,10 +0,0 @@ -import Foundation - -internal func raiseError(_ message: String) -> Never { -#if _runtime(_ObjC) - NSException(name: .internalInconsistencyException, reason: message, userInfo: nil).raise() -#endif - - // This won't be reached when ObjC is available and the exception above is raisd - fatalError(message) -} diff --git a/Example/Pods/Quick/Sources/Quick/Example.swift b/Example/Pods/Quick/Sources/Quick/Example.swift deleted file mode 100644 index 844bf3f..0000000 --- a/Example/Pods/Quick/Sources/Quick/Example.swift +++ /dev/null @@ -1,111 +0,0 @@ -import Foundation - -private var numberOfExamplesRun = 0 - -/** - Examples, defined with the `it` function, use assertions to - demonstrate how code should behave. These are like "tests" in XCTest. -*/ -final public class Example: NSObject { - /** - A boolean indicating whether the example is a shared example; - i.e.: whether it is an example defined with `itBehavesLike`. - */ - public var isSharedExample = false - - /** - The site at which the example is defined. - This must be set correctly in order for Xcode to highlight - the correct line in red when reporting a failure. - */ - public var callsite: Callsite - - weak internal var group: ExampleGroup? - - private let internalDescription: String - private let closure: () -> () - private let flags: FilterFlags - - internal init(description: String, callsite: Callsite, flags: FilterFlags, closure: @escaping () -> ()) { - self.internalDescription = description - self.closure = closure - self.callsite = callsite - self.flags = flags - } - - public override var description: String { - return internalDescription - } - - /** - The example name. A name is a concatenation of the name of - the example group the example belongs to, followed by the - description of the example itself. - - The example name is used to generate a test method selector - to be displayed in Xcode's test navigator. - */ - public var name: String { - guard let groupName = group?.name else { return description } - return "\(groupName), \(description)" - } - - /** - Executes the example closure, as well as all before and after - closures defined in the its surrounding example groups. - */ - public func run() { - let world = World.sharedWorld - - if numberOfExamplesRun == 0 { - world.suiteHooks.executeBefores() - } - - let exampleMetadata = ExampleMetadata(example: self, exampleIndex: numberOfExamplesRun) - world.currentExampleMetadata = exampleMetadata - - world.exampleHooks.executeBefores(exampleMetadata) - group!.phase = .beforesExecuting - for before in group!.befores { - before(exampleMetadata) - } - group!.phase = .beforesFinished - - closure() - - group!.phase = .aftersExecuting - for after in group!.afters { - after(exampleMetadata) - } - group!.phase = .aftersFinished - world.exampleHooks.executeAfters(exampleMetadata) - - numberOfExamplesRun += 1 - - if !world.isRunningAdditionalSuites && numberOfExamplesRun >= world.includedExampleCount { - world.suiteHooks.executeAfters() - } - } - - /** - Evaluates the filter flags set on this example and on the example groups - this example belongs to. Flags set on the example are trumped by flags on - the example group it belongs to. Flags on inner example groups are trumped - by flags on outer example groups. - */ - internal var filterFlags: FilterFlags { - var aggregateFlags = flags - for (key, value) in group!.filterFlags { - aggregateFlags[key] = value - } - return aggregateFlags - } -} - -/** - Returns a boolean indicating whether two Example objects are equal. - If two examples are defined at the exact same callsite, they must be equal. -*/ -public func ==(lhs: Example, rhs: Example) -> Bool { - return lhs.callsite == rhs.callsite -} diff --git a/Example/Pods/Quick/Sources/Quick/ExampleGroup.swift b/Example/Pods/Quick/Sources/Quick/ExampleGroup.swift deleted file mode 100644 index b0b8be4..0000000 --- a/Example/Pods/Quick/Sources/Quick/ExampleGroup.swift +++ /dev/null @@ -1,103 +0,0 @@ -import Foundation - -/** - Example groups are logical groupings of examples, defined with - the `describe` and `context` functions. Example groups can share - setup and teardown code. -*/ -final public class ExampleGroup: NSObject { - weak internal var parent: ExampleGroup? - internal let hooks = ExampleHooks() - - internal var phase: HooksPhase = .nothingExecuted - - private let internalDescription: String - private let flags: FilterFlags - private let isInternalRootExampleGroup: Bool - private var childGroups = [ExampleGroup]() - private var childExamples = [Example]() - - internal init(description: String, flags: FilterFlags, isInternalRootExampleGroup: Bool = false) { - self.internalDescription = description - self.flags = flags - self.isInternalRootExampleGroup = isInternalRootExampleGroup - } - - public override var description: String { - return internalDescription - } - - /** - Returns a list of examples that belong to this example group, - or to any of its descendant example groups. - */ - public var examples: [Example] { - var examples = childExamples - for group in childGroups { - examples.append(contentsOf: group.examples) - } - return examples - } - - internal var name: String? { - if let parent = parent { - guard let name = parent.name else { return description } - return "\(name), \(description)" - } else { - return isInternalRootExampleGroup ? nil : description - } - } - - internal var filterFlags: FilterFlags { - var aggregateFlags = flags - walkUp() { (group: ExampleGroup) -> () in - for (key, value) in group.flags { - aggregateFlags[key] = value - } - } - return aggregateFlags - } - - internal var befores: [BeforeExampleWithMetadataClosure] { - var closures = Array(hooks.befores.reversed()) - walkUp() { (group: ExampleGroup) -> () in - closures.append(contentsOf: Array(group.hooks.befores.reversed())) - } - return Array(closures.reversed()) - } - - internal var afters: [AfterExampleWithMetadataClosure] { - var closures = hooks.afters - walkUp() { (group: ExampleGroup) -> () in - closures.append(contentsOf: group.hooks.afters) - } - return closures - } - - internal func walkDownExamples(_ callback: (_ example: Example) -> ()) { - for example in childExamples { - callback(example) - } - for group in childGroups { - group.walkDownExamples(callback) - } - } - - internal func appendExampleGroup(_ group: ExampleGroup) { - group.parent = self - childGroups.append(group) - } - - internal func appendExample(_ example: Example) { - example.group = self - childExamples.append(example) - } - - private func walkUp(_ callback: (_ group: ExampleGroup) -> ()) { - var group = self - while let parent = group.parent { - callback(parent) - group = parent - } - } -} diff --git a/Example/Pods/Quick/Sources/Quick/ExampleMetadata.swift b/Example/Pods/Quick/Sources/Quick/ExampleMetadata.swift deleted file mode 100644 index e7510f7..0000000 --- a/Example/Pods/Quick/Sources/Quick/ExampleMetadata.swift +++ /dev/null @@ -1,24 +0,0 @@ -import Foundation - -/** - A class that encapsulates information about an example, - including the index at which the example was executed, as - well as the example itself. -*/ -final public class ExampleMetadata: NSObject { - /** - The example for which this metadata was collected. - */ - public let example: Example - - /** - The index at which this example was executed in the - test suite. - */ - public let exampleIndex: Int - - internal init(example: Example, exampleIndex: Int) { - self.example = example - self.exampleIndex = exampleIndex - } -} diff --git a/Example/Pods/Quick/Sources/Quick/Filter.swift b/Example/Pods/Quick/Sources/Quick/Filter.swift deleted file mode 100644 index d452efe..0000000 --- a/Example/Pods/Quick/Sources/Quick/Filter.swift +++ /dev/null @@ -1,31 +0,0 @@ -import Foundation - -/** - A mapping of string keys to booleans that can be used to - filter examples or example groups. For example, a "focused" - example would have the flags [Focused: true]. -*/ -public typealias FilterFlags = [String: Bool] - -/** - A namespace for filter flag keys, defined primarily to make the - keys available in Objective-C. -*/ -final public class Filter: NSObject { - /** - Example and example groups with [Focused: true] are included in test runs, - excluding all other examples without this flag. Use this to only run one or - two tests that you're currently focusing on. - */ - public class var focused: String { - return "focused" - } - - /** - Example and example groups with [Pending: true] are excluded from test runs. - Use this to temporarily suspend examples that you know do not pass yet. - */ - public class var pending: String { - return "pending" - } -} diff --git a/Example/Pods/Quick/Sources/Quick/Hooks/Closures.swift b/Example/Pods/Quick/Sources/Quick/Hooks/Closures.swift deleted file mode 100644 index a241b33..0000000 --- a/Example/Pods/Quick/Sources/Quick/Hooks/Closures.swift +++ /dev/null @@ -1,35 +0,0 @@ -// MARK: Example Hooks - -/** - A closure executed before an example is run. -*/ -public typealias BeforeExampleClosure = () -> () - -/** - A closure executed before an example is run. The closure is given example metadata, - which contains information about the example that is about to be run. -*/ -public typealias BeforeExampleWithMetadataClosure = (_ exampleMetadata: ExampleMetadata) -> () - -/** - A closure executed after an example is run. -*/ -public typealias AfterExampleClosure = BeforeExampleClosure - -/** - A closure executed after an example is run. The closure is given example metadata, - which contains information about the example that has just finished running. -*/ -public typealias AfterExampleWithMetadataClosure = BeforeExampleWithMetadataClosure - -// MARK: Suite Hooks - -/** - A closure executed before any examples are run. -*/ -public typealias BeforeSuiteClosure = () -> () - -/** - A closure executed after all examples have finished running. -*/ -public typealias AfterSuiteClosure = BeforeSuiteClosure diff --git a/Example/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift b/Example/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift deleted file mode 100644 index ef6d53e..0000000 --- a/Example/Pods/Quick/Sources/Quick/Hooks/ExampleHooks.swift +++ /dev/null @@ -1,42 +0,0 @@ -/** - A container for closures to be executed before and after each example. -*/ -final internal class ExampleHooks { - internal var befores: [BeforeExampleWithMetadataClosure] = [] - internal var afters: [AfterExampleWithMetadataClosure] = [] - internal var phase: HooksPhase = .nothingExecuted - - internal func appendBefore(_ closure: @escaping BeforeExampleWithMetadataClosure) { - befores.append(closure) - } - - internal func appendBefore(_ closure: @escaping BeforeExampleClosure) { - befores.append { (exampleMetadata: ExampleMetadata) in closure() } - } - - internal func appendAfter(_ closure: @escaping AfterExampleWithMetadataClosure) { - afters.append(closure) - } - - internal func appendAfter(_ closure: @escaping AfterExampleClosure) { - afters.append { (exampleMetadata: ExampleMetadata) in closure() } - } - - internal func executeBefores(_ exampleMetadata: ExampleMetadata) { - phase = .beforesExecuting - for before in befores { - before(exampleMetadata) - } - - phase = .beforesFinished - } - - internal func executeAfters(_ exampleMetadata: ExampleMetadata) { - phase = .aftersExecuting - for after in afters { - after(exampleMetadata) - } - - phase = .aftersFinished - } -} diff --git a/Example/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift b/Example/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift deleted file mode 100644 index 2440158..0000000 --- a/Example/Pods/Quick/Sources/Quick/Hooks/HooksPhase.swift +++ /dev/null @@ -1,11 +0,0 @@ -/** - A description of the execution cycle of the current example with - respect to the hooks of that example. - */ -internal enum HooksPhase { - case nothingExecuted - case beforesExecuting - case beforesFinished - case aftersExecuting - case aftersFinished -} diff --git a/Example/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift b/Example/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift deleted file mode 100644 index b39292b..0000000 --- a/Example/Pods/Quick/Sources/Quick/Hooks/SuiteHooks.swift +++ /dev/null @@ -1,32 +0,0 @@ -/** - A container for closures to be executed before and after all examples. -*/ -final internal class SuiteHooks { - internal var befores: [BeforeSuiteClosure] = [] - internal var afters: [AfterSuiteClosure] = [] - internal var phase: HooksPhase = .nothingExecuted - - internal func appendBefore(_ closure: @escaping BeforeSuiteClosure) { - befores.append(closure) - } - - internal func appendAfter(_ closure: @escaping AfterSuiteClosure) { - afters.append(closure) - } - - internal func executeBefores() { - phase = .beforesExecuting - for before in befores { - before() - } - phase = .beforesFinished - } - - internal func executeAfters() { - phase = .aftersExecuting - for after in afters { - after() - } - phase = .aftersFinished - } -} diff --git a/Example/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift b/Example/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift deleted file mode 100644 index 730843e..0000000 --- a/Example/Pods/Quick/Sources/Quick/NSBundle+CurrentTestBundle.swift +++ /dev/null @@ -1,16 +0,0 @@ -#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) - -import Foundation - -extension Bundle { - - /** - Locates the first bundle with a '.xctest' file extension. - */ - internal static var currentTestBundle: Bundle? { - return allBundles.first { $0.bundlePath.hasSuffix(".xctest") } - } - -} - -#endif diff --git a/Example/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift b/Example/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift deleted file mode 100644 index 63b55e1..0000000 --- a/Example/Pods/Quick/Sources/Quick/QuickSelectedTestSuiteBuilder.swift +++ /dev/null @@ -1,74 +0,0 @@ -#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) -import Foundation - -/** - Responsible for building a "Selected tests" suite. This corresponds to a single - spec, and all its examples. - */ -internal class QuickSelectedTestSuiteBuilder: QuickTestSuiteBuilder { - - /** - The test spec class to run. - */ - let testCaseClass: AnyClass! - - /** - For Objective-C classes, returns the class name. For Swift classes without, - an explicit Objective-C name, returns a module-namespaced class name - (e.g., "FooTests.FooSpec"). - */ - var testSuiteClassName: String { - return NSStringFromClass(testCaseClass) - } - - /** - Given a test case name: - - FooSpec/testFoo - - Optionally constructs a test suite builder for the named test case class - in the running test bundle. - - If no test bundle can be found, or the test case class can't be found, - initialization fails and returns `nil`. - */ - init?(forTestCaseWithName name: String) { - guard let testCaseClass = testCaseClassForTestCaseWithName(name) else { - self.testCaseClass = nil - return nil - } - - self.testCaseClass = testCaseClass - } - - /** - Returns a `QuickTestSuite` that runs the associated test case class. - */ - func buildTestSuite() -> QuickTestSuite { - return QuickTestSuite(forTestCaseClass: testCaseClass) - } - -} - -/** - Searches `Bundle.allBundles()` for an xctest bundle, then looks up the named - test case class in that bundle. - - Returns `nil` if a bundle or test case class cannot be found. - */ -private func testCaseClassForTestCaseWithName(_ name: String) -> AnyClass? { - func extractClassName(_ name: String) -> String? { - return name.components(separatedBy: "/").first - } - - guard let className = extractClassName(name) else { return nil } - guard let bundle = Bundle.currentTestBundle else { return nil } - - if let testCaseClass = bundle.classNamed(className) { return testCaseClass } - - guard let moduleName = bundle.bundlePath.fileName else { return nil } - - return NSClassFromString("\(moduleName).\(className)") -} - -#endif diff --git a/Example/Pods/Quick/Sources/Quick/QuickTestSuite.swift b/Example/Pods/Quick/Sources/Quick/QuickTestSuite.swift deleted file mode 100644 index 0cb5187..0000000 --- a/Example/Pods/Quick/Sources/Quick/QuickTestSuite.swift +++ /dev/null @@ -1,52 +0,0 @@ -#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS) - -import XCTest - -/** - This protocol defines the role of an object that builds test suites. - */ -internal protocol QuickTestSuiteBuilder { - - /** - Construct a `QuickTestSuite` instance with the appropriate test cases added as tests. - - Subsequent calls to this method should return equivalent test suites. - */ - func buildTestSuite() -> QuickTestSuite - -} - -/** - A base class for a class cluster of Quick test suites, that should correctly - build dynamic test suites for XCTest to execute. - */ -public class QuickTestSuite: XCTestSuite { - - private static var builtTestSuites: Set = Set() - - /** - Construct a test suite for a specific, selected subset of test cases (rather - than the default, which as all test cases). - - If this method is called multiple times for the same test case class, e.g.. - - FooSpec/testFoo - FooSpec/testBar - - It is expected that the first call should return a valid test suite, and - all subsequent calls should return `nil`. - */ - public static func selectedTestSuite(forTestCaseWithName name: String) -> QuickTestSuite? { - guard let builder = QuickSelectedTestSuiteBuilder(forTestCaseWithName: name) else { return nil } - - if builtTestSuites.contains(builder.testSuiteClassName) { - return nil - } else { - builtTestSuites.insert(builder.testSuiteClassName) - return builder.buildTestSuite() - } - } - -} - -#endif diff --git a/Example/Pods/Quick/Sources/Quick/String+FileName.swift b/Example/Pods/Quick/Sources/Quick/String+FileName.swift deleted file mode 100644 index 83cdfcf..0000000 --- a/Example/Pods/Quick/Sources/Quick/String+FileName.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -extension String { - - /** - If the receiver represents a path, returns its file name with a file extension. - */ - var fileName: String? { - return NSURL(string: self)?.deletingPathExtension?.lastPathComponent - } - -} diff --git a/Example/Pods/Quick/Sources/Quick/World.swift b/Example/Pods/Quick/Sources/Quick/World.swift deleted file mode 100644 index 56dae51..0000000 --- a/Example/Pods/Quick/Sources/Quick/World.swift +++ /dev/null @@ -1,232 +0,0 @@ -import Foundation - -/** - A closure that, when evaluated, returns a dictionary of key-value - pairs that can be accessed from within a group of shared examples. -*/ -public typealias SharedExampleContext = () -> (NSDictionary) - -/** - A closure that is used to define a group of shared examples. This - closure may contain any number of example and example groups. -*/ -public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> () - -/** - A collection of state Quick builds up in order to work its magic. - World is primarily responsible for maintaining a mapping of QuickSpec - classes to root example groups for those classes. - - It also maintains a mapping of shared example names to shared - example closures. - - You may configure how Quick behaves by calling the -[World configure:] - method from within an overridden +[QuickConfiguration configure:] method. -*/ -final internal class World: NSObject { - /** - The example group that is currently being run. - The DSL requires that this group is correctly set in order to build a - correct hierarchy of example groups and their examples. - */ - internal var currentExampleGroup: ExampleGroup! - - /** - The example metadata of the test that is currently being run. - This is useful for using the Quick test metadata (like its name) at - runtime. - */ - - internal var currentExampleMetadata: ExampleMetadata? - - /** - A flag that indicates whether additional test suites are being run - within this test suite. This is only true within the context of Quick - functional tests. - */ -#if _runtime(_ObjC) - // Convention of generating Objective-C selector has been changed on Swift 3 - @objc(isRunningAdditionalSuites) - internal var isRunningAdditionalSuites = false -#else - internal var isRunningAdditionalSuites = false -#endif - - private var specs: Dictionary = [:] - private var sharedExamples: [String: SharedExampleClosure] = [:] - private let configuration = Configuration() - private var isConfigurationFinalized = false - - internal var exampleHooks: ExampleHooks {return configuration.exampleHooks } - internal var suiteHooks: SuiteHooks { return configuration.suiteHooks } - - // MARK: Singleton Constructor - - private override init() {} - static let sharedWorld = World() - - // MARK: Public Interface - - /** - Exposes the World's Configuration object within the scope of the closure - so that it may be configured. This method must not be called outside of - an overridden +[QuickConfiguration configure:] method. - - - parameter closure: A closure that takes a Configuration object that can - be mutated to change Quick's behavior. - */ - internal func configure(_ closure: QuickConfigurer) { - assert(!isConfigurationFinalized, - "Quick cannot be configured outside of a +[QuickConfiguration configure:] method. You should not call -[World configure:] directly. Instead, subclass QuickConfiguration and override the +[QuickConfiguration configure:] method.") - closure(configuration) - } - - /** - Finalizes the World's configuration. - Any subsequent calls to World.configure() will raise. - */ - internal func finalizeConfiguration() { - isConfigurationFinalized = true - } - - /** - Returns an internally constructed root example group for the given - QuickSpec class. - - A root example group with the description "root example group" is lazily - initialized for each QuickSpec class. This root example group wraps the - top level of a -[QuickSpec spec] method--it's thanks to this group that - users can define beforeEach and it closures at the top level, like so: - - override func spec() { - // These belong to the root example group - beforeEach {} - it("is at the top level") {} - } - - - parameter cls: The QuickSpec class for which to retrieve the root example group. - - returns: The root example group for the class. - */ - internal func rootExampleGroupForSpecClass(_ cls: AnyClass) -> ExampleGroup { - let name = String(describing: cls) - - if let group = specs[name] { - return group - } else { - let group = ExampleGroup( - description: "root example group", - flags: [:], - isInternalRootExampleGroup: true - ) - specs[name] = group - return group - } - } - - /** - Returns all examples that should be run for a given spec class. - There are two filtering passes that occur when determining which examples should be run. - That is, these examples are the ones that are included by inclusion filters, and are - not excluded by exclusion filters. - - - parameter specClass: The QuickSpec subclass for which examples are to be returned. - - returns: A list of examples to be run as test invocations. - */ - internal func examples(_ specClass: AnyClass) -> [Example] { - // 1. Grab all included examples. - let included = includedExamples - // 2. Grab the intersection of (a) examples for this spec, and (b) included examples. - let spec = rootExampleGroupForSpecClass(specClass).examples.filter { included.contains($0) } - // 3. Remove all excluded examples. - return spec.filter { example in - !self.configuration.exclusionFilters.reduce(false) { $0 || $1(example) } - } - } - -#if _runtime(_ObjC) - @objc(examplesForSpecClass:) - private func objc_examples(_ specClass: AnyClass) -> [Example] { - return examples(specClass) - } -#endif - - // MARK: Internal - - internal func registerSharedExample(_ name: String, closure: @escaping SharedExampleClosure) { - raiseIfSharedExampleAlreadyRegistered(name) - sharedExamples[name] = closure - } - - internal func sharedExample(_ name: String) -> SharedExampleClosure { - raiseIfSharedExampleNotRegistered(name) - return sharedExamples[name]! - } - - internal var includedExampleCount: Int { - return includedExamples.count - } - - internal var beforesCurrentlyExecuting: Bool { - let suiteBeforesExecuting = suiteHooks.phase == .beforesExecuting - let exampleBeforesExecuting = exampleHooks.phase == .beforesExecuting - var groupBeforesExecuting = false - if let runningExampleGroup = currentExampleMetadata?.example.group { - groupBeforesExecuting = runningExampleGroup.phase == .beforesExecuting - } - - return suiteBeforesExecuting || exampleBeforesExecuting || groupBeforesExecuting - } - - internal var aftersCurrentlyExecuting: Bool { - let suiteAftersExecuting = suiteHooks.phase == .aftersExecuting - let exampleAftersExecuting = exampleHooks.phase == .aftersExecuting - var groupAftersExecuting = false - if let runningExampleGroup = currentExampleMetadata?.example.group { - groupAftersExecuting = runningExampleGroup.phase == .aftersExecuting - } - - return suiteAftersExecuting || exampleAftersExecuting || groupAftersExecuting - } - - internal func performWithCurrentExampleGroup(_ group: ExampleGroup, closure: () -> Void) { - let previousExampleGroup = currentExampleGroup - currentExampleGroup = group - - closure() - - currentExampleGroup = previousExampleGroup - } - - private var allExamples: [Example] { - var all: [Example] = [] - for (_, group) in specs { - group.walkDownExamples { all.append($0) } - } - return all - } - - private var includedExamples: [Example] { - let all = allExamples - let included = all.filter { example in - return self.configuration.inclusionFilters.reduce(false) { $0 || $1(example) } - } - - if included.isEmpty && configuration.runAllWhenEverythingFiltered { - return all - } else { - return included - } - } - - private func raiseIfSharedExampleAlreadyRegistered(_ name: String) { - if sharedExamples[name] != nil { - raiseError("A shared example named '\(name)' has already been registered.") - } - } - - private func raiseIfSharedExampleNotRegistered(_ name: String) { - if sharedExamples[name] == nil { - raiseError("No shared example named '\(name)' has been registered. Registered shared examples: '\(Array(sharedExamples.keys))'") - } - } -} diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h b/Example/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h deleted file mode 100644 index 5646199..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.h +++ /dev/null @@ -1,30 +0,0 @@ -#import - -@class Configuration; - -/** - Subclass QuickConfiguration and override the +[QuickConfiguration configure:] - method in order to configure how Quick behaves when running specs, or to define - shared examples that are used across spec files. - */ -@interface QuickConfiguration : NSObject - -/** - This method is executed on each subclass of this class before Quick runs - any examples. You may override this method on as many subclasses as you like, but - there is no guarantee as to the order in which these methods are executed. - - You can override this method in order to: - - 1. Configure how Quick behaves, by modifying properties on the Configuration object. - Setting the same properties in several methods has undefined behavior. - - 2. Define shared examples using `sharedExamples`. - - @param configuration A mutable object that is used to configure how Quick behaves on - a framework level. For details on all the options, see the - documentation in Configuration.swift. - */ -+ (void)configure:(Configuration *)configuration; - -@end diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m b/Example/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m deleted file mode 100644 index 937b818..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/Configuration/QuickConfiguration.m +++ /dev/null @@ -1,83 +0,0 @@ -#import "QuickConfiguration.h" -#import "World.h" -#import - -typedef void (^QCKClassEnumerationBlock)(Class klass); - -/** - Finds all direct subclasses of the given class and passes them to the block provided. - The classes are iterated over in the order that objc_getClassList returns them. - - @param klass The base class to find subclasses of. - @param block A block that takes a Class. This block will be executed once for each subclass of klass. - */ -void qck_enumerateSubclasses(Class klass, QCKClassEnumerationBlock block) { - Class *classes = NULL; - int classesCount = objc_getClassList(NULL, 0); - - if (classesCount > 0) { - classes = (Class *)calloc(sizeof(Class), classesCount); - classesCount = objc_getClassList(classes, classesCount); - - Class subclass, superclass; - for(int i = 0; i < classesCount; i++) { - subclass = classes[i]; - superclass = class_getSuperclass(subclass); - if (superclass == klass && block) { - block(subclass); - } - } - - free(classes); - } -} - -@implementation QuickConfiguration - -#pragma mark - Object Lifecycle - -/** - QuickConfiguration is not meant to be instantiated; it merely provides a hook - for users to configure how Quick behaves. Raise an exception if an instance of - QuickConfiguration is created. - */ -- (instancetype)init { - NSString *className = NSStringFromClass([self class]); - NSString *selectorName = NSStringFromSelector(@selector(configure:)); - [NSException raise:NSInternalInconsistencyException - format:@"%@ is not meant to be instantiated; " - @"subclass %@ and override %@ to configure Quick.", - className, className, selectorName]; - return nil; -} - -#pragma mark - NSObject Overrides - -/** - Hook into when QuickConfiguration is initialized in the runtime in order to - call +[QuickConfiguration configure:] on each of its subclasses. - */ -+ (void)initialize { - // Only enumerate over the subclasses of QuickConfiguration, not any of its subclasses. - if ([self class] == [QuickConfiguration class]) { - - // Only enumerate over subclasses once, even if +[QuickConfiguration initialize] - // were to be called several times. This is necessary because +[QuickSpec initialize] - // manually calls +[QuickConfiguration initialize]. - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - qck_enumerateSubclasses([QuickConfiguration class], ^(__unsafe_unretained Class klass) { - [[World sharedWorld] configure:^(Configuration *configuration) { - [klass configure:configuration]; - }]; - }); - [[World sharedWorld] finalizeConfiguration]; - }); - } -} - -#pragma mark - Public Interface - -+ (void)configure:(Configuration *)configuration { } - -@end diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h b/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h deleted file mode 100644 index c5f3152..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.h +++ /dev/null @@ -1,234 +0,0 @@ -#import - -@class ExampleMetadata; - -/** - Provides a hook for Quick to be configured before any examples are run. - Within this scope, override the +[QuickConfiguration configure:] method - to set properties on a configuration object to customize Quick behavior. - For details, see the documentation for Configuraiton.swift. - - @param name The name of the configuration class. Like any Objective-C - class name, this must be unique to the current runtime - environment. - */ -#define QuickConfigurationBegin(name) \ - @interface name : QuickConfiguration; @end \ - @implementation name \ - - -/** - Marks the end of a Quick configuration. - Make sure you put this after `QuickConfigurationBegin`. - */ -#define QuickConfigurationEnd \ - @end \ - - -/** - Defines a new QuickSpec. Define examples and example groups within the space - between this and `QuickSpecEnd`. - - @param name The name of the spec class. Like any Objective-C class name, this - must be unique to the current runtime environment. - */ -#define QuickSpecBegin(name) \ - @interface name : QuickSpec; @end \ - @implementation name \ - - (void)spec { \ - - -/** - Marks the end of a QuickSpec. Make sure you put this after `QuickSpecBegin`. - */ -#define QuickSpecEnd \ - } \ - @end \ - -typedef NSDictionary *(^QCKDSLSharedExampleContext)(void); -typedef void (^QCKDSLSharedExampleBlock)(QCKDSLSharedExampleContext); -typedef void (^QCKDSLEmptyBlock)(void); -typedef void (^QCKDSLExampleMetadataBlock)(ExampleMetadata *exampleMetadata); - -#define QUICK_EXPORT FOUNDATION_EXPORT - -QUICK_EXPORT void qck_beforeSuite(QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_afterSuite(QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure); -QUICK_EXPORT void qck_describe(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_context(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_beforeEach(QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure); -QUICK_EXPORT void qck_afterEach(QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure); -QUICK_EXPORT void qck_pending(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_xdescribe(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_xcontext(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure); -QUICK_EXPORT void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure); - -#ifndef QUICK_DISABLE_SHORT_SYNTAX -/** - Defines a closure to be run prior to any examples in the test suite. - You may define an unlimited number of these closures, but there is no - guarantee as to the order in which they're run. - - If the test suite crashes before the first example is run, this closure - will not be executed. - - @param closure The closure to be run prior to any examples in the test suite. - */ -static inline void beforeSuite(QCKDSLEmptyBlock closure) { - qck_beforeSuite(closure); -} - - -/** - Defines a closure to be run after all of the examples in the test suite. - You may define an unlimited number of these closures, but there is no - guarantee as to the order in which they're run. - - If the test suite crashes before all examples are run, this closure - will not be executed. - - @param closure The closure to be run after all of the examples in the test suite. - */ -static inline void afterSuite(QCKDSLEmptyBlock closure) { - qck_afterSuite(closure); -} - -/** - Defines a group of shared examples. These examples can be re-used in several locations - by using the `itBehavesLike` function. - - @param name The name of the shared example group. This must be unique across all shared example - groups defined in a test suite. - @param closure A closure containing the examples. This behaves just like an example group defined - using `describe` or `context`--the closure may contain any number of `beforeEach` - and `afterEach` closures, as well as any number of examples (defined using `it`). - */ -static inline void sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) { - qck_sharedExamples(name, closure); -} - -/** - Defines an example group. Example groups are logical groupings of examples. - Example groups can share setup and teardown code. - - @param description An arbitrary string describing the example group. - @param closure A closure that can contain other examples. - */ -static inline void describe(NSString *description, QCKDSLEmptyBlock closure) { - qck_describe(description, closure); -} - -/** - Defines an example group. Equivalent to `describe`. - */ -static inline void context(NSString *description, QCKDSLEmptyBlock closure) { - qck_context(description, closure); -} - -/** - Defines a closure to be run prior to each example in the current example - group. This closure is not run for pending or otherwise disabled examples. - An example group may contain an unlimited number of beforeEach. They'll be - run in the order they're defined, but you shouldn't rely on that behavior. - - @param closure The closure to be run prior to each example. - */ -static inline void beforeEach(QCKDSLEmptyBlock closure) { - qck_beforeEach(closure); -} - -/** - Identical to QCKDSL.beforeEach, except the closure is provided with - metadata on the example that the closure is being run prior to. - */ -static inline void beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) { - qck_beforeEachWithMetadata(closure); -} - -/** - Defines a closure to be run after each example in the current example - group. This closure is not run for pending or otherwise disabled examples. - An example group may contain an unlimited number of afterEach. They'll be - run in the order they're defined, but you shouldn't rely on that behavior. - - @param closure The closure to be run after each example. - */ -static inline void afterEach(QCKDSLEmptyBlock closure) { - qck_afterEach(closure); -} - -/** - Identical to QCKDSL.afterEach, except the closure is provided with - metadata on the example that the closure is being run after. - */ -static inline void afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) { - qck_afterEachWithMetadata(closure); -} - -/** - Defines an example or example group that should not be executed. Use `pending` to temporarily disable - examples or groups that should not be run yet. - - @param description An arbitrary string describing the example or example group. - @param closure A closure that will not be evaluated. - */ -static inline void pending(NSString *description, QCKDSLEmptyBlock closure) { - qck_pending(description, closure); -} - -/** - Use this to quickly mark a `describe` block as pending. - This disables all examples within the block. - */ -static inline void xdescribe(NSString *description, QCKDSLEmptyBlock closure) { - qck_xdescribe(description, closure); -} - -/** - Use this to quickly mark a `context` block as pending. - This disables all examples within the block. - */ -static inline void xcontext(NSString *description, QCKDSLEmptyBlock closure) { - qck_xcontext(description, closure); -} - -/** - Use this to quickly focus a `describe` block, focusing the examples in the block. - If any examples in the test suite are focused, only those examples are executed. - This trumps any explicitly focused or unfocused examples within the block--they are all treated as focused. - */ -static inline void fdescribe(NSString *description, QCKDSLEmptyBlock closure) { - qck_fdescribe(description, closure); -} - -/** - Use this to quickly focus a `context` block. Equivalent to `fdescribe`. - */ -static inline void fcontext(NSString *description, QCKDSLEmptyBlock closure) { - qck_fcontext(description, closure); -} - -#define it qck_it -#define xit qck_xit -#define fit qck_fit -#define itBehavesLike qck_itBehavesLike -#define xitBehavesLike qck_xitBehavesLike -#define fitBehavesLike qck_fitBehavesLike -#endif - -#define qck_it qck_it_builder(@{}, @(__FILE__), __LINE__) -#define qck_xit qck_it_builder(@{Filter.pending: @YES}, @(__FILE__), __LINE__) -#define qck_fit qck_it_builder(@{Filter.focused: @YES}, @(__FILE__), __LINE__) -#define qck_itBehavesLike qck_itBehavesLike_builder(@{}, @(__FILE__), __LINE__) -#define qck_xitBehavesLike qck_itBehavesLike_builder(@{Filter.pending: @YES}, @(__FILE__), __LINE__) -#define qck_fitBehavesLike qck_itBehavesLike_builder(@{Filter.focused: @YES}, @(__FILE__), __LINE__) - -typedef void (^QCKItBlock)(NSString *description, QCKDSLEmptyBlock closure); -typedef void (^QCKItBehavesLikeBlock)(NSString *description, QCKDSLSharedExampleContext context); - -QUICK_EXPORT QCKItBlock qck_it_builder(NSDictionary *flags, NSString *file, NSUInteger line); -QUICK_EXPORT QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSDictionary *flags, NSString *file, NSUInteger line); diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m b/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m deleted file mode 100644 index 10e8a3d..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/QCKDSL.m +++ /dev/null @@ -1,79 +0,0 @@ -#import "QCKDSL.h" -#import "World.h" -#import "World+DSL.h" - -void qck_beforeSuite(QCKDSLEmptyBlock closure) { - [[World sharedWorld] beforeSuite:closure]; -} - -void qck_afterSuite(QCKDSLEmptyBlock closure) { - [[World sharedWorld] afterSuite:closure]; -} - -void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) { - [[World sharedWorld] sharedExamples:name closure:closure]; -} - -void qck_describe(NSString *description, QCKDSLEmptyBlock closure) { - [[World sharedWorld] describe:description flags:@{} closure:closure]; -} - -void qck_context(NSString *description, QCKDSLEmptyBlock closure) { - qck_describe(description, closure); -} - -void qck_beforeEach(QCKDSLEmptyBlock closure) { - [[World sharedWorld] beforeEach:closure]; -} - -void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) { - [[World sharedWorld] beforeEachWithMetadata:closure]; -} - -void qck_afterEach(QCKDSLEmptyBlock closure) { - [[World sharedWorld] afterEach:closure]; -} - -void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) { - [[World sharedWorld] afterEachWithMetadata:closure]; -} - -QCKItBlock qck_it_builder(NSDictionary *flags, NSString *file, NSUInteger line) { - return ^(NSString *description, QCKDSLEmptyBlock closure) { - [[World sharedWorld] itWithDescription:description - flags:flags - file:file - line:line - closure:closure]; - }; -} - -QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSDictionary *flags, NSString *file, NSUInteger line) { - return ^(NSString *name, QCKDSLSharedExampleContext context) { - [[World sharedWorld] itBehavesLikeSharedExampleNamed:name - sharedExampleContext:context - flags:flags - file:file - line:line]; - }; -} - -void qck_pending(NSString *description, QCKDSLEmptyBlock closure) { - [[World sharedWorld] pending:description closure:closure]; -} - -void qck_xdescribe(NSString *description, QCKDSLEmptyBlock closure) { - [[World sharedWorld] xdescribe:description flags:@{} closure:closure]; -} - -void qck_xcontext(NSString *description, QCKDSLEmptyBlock closure) { - qck_xdescribe(description, closure); -} - -void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure) { - [[World sharedWorld] fdescribe:description flags:@{} closure:closure]; -} - -void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure) { - qck_fdescribe(description, closure); -} diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/World+DSL.h b/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/World+DSL.h deleted file mode 100644 index a3b8524..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/DSL/World+DSL.h +++ /dev/null @@ -1,20 +0,0 @@ -#import - -@interface World (SWIFT_EXTENSION(Quick)) -- (void)beforeSuite:(void (^ __nonnull)(void))closure; -- (void)afterSuite:(void (^ __nonnull)(void))closure; -- (void)sharedExamples:(NSString * __nonnull)name closure:(void (^ __nonnull)(NSDictionary * __nonnull (^ __nonnull)(void)))closure; -- (void)describe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; -- (void)context:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; -- (void)fdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; -- (void)xdescribe:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags closure:(void (^ __nonnull)(void))closure; -- (void)beforeEach:(void (^ __nonnull)(void))closure; -- (void)beforeEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; -- (void)afterEach:(void (^ __nonnull)(void))closure; -- (void)afterEachWithMetadata:(void (^ __nonnull)(ExampleMetadata * __nonnull))closure; -- (void)itWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; -- (void)fitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; -- (void)xitWithDescription:(NSString * __nonnull)description flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line closure:(void (^ __nonnull)(void))closure; -- (void)itBehavesLikeSharedExampleNamed:(NSString * __nonnull)name sharedExampleContext:(NSDictionary * __nonnull (^ __nonnull)(void))sharedExampleContext flags:(NSDictionary * __nonnull)flags file:(NSString * __nonnull)file line:(NSUInteger)line; -- (void)pending:(NSString * __nonnull)description closure:(void (^ __nonnull)(void))closure; -@end diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/NSString+QCKSelectorName.h b/Example/Pods/Quick/Sources/QuickObjectiveC/NSString+QCKSelectorName.h deleted file mode 100644 index 2da524e..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/NSString+QCKSelectorName.h +++ /dev/null @@ -1,17 +0,0 @@ -#import - -/** - QuickSpec converts example names into test methods. - Those test methods need valid selector names, which means no whitespace, - control characters, etc. This category gives NSString objects an easy way - to replace those illegal characters with underscores. - */ -@interface NSString (QCKSelectorName) - -/** - Returns a string with underscores in place of all characters that cannot - be included in a selector (SEL) name. - */ -@property (nonatomic, readonly) NSString *qck_selectorName; - -@end diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/NSString+QCKSelectorName.m b/Example/Pods/Quick/Sources/QuickObjectiveC/NSString+QCKSelectorName.m deleted file mode 100644 index d374be6..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/NSString+QCKSelectorName.m +++ /dev/null @@ -1,37 +0,0 @@ -#import "NSString+QCKSelectorName.h" - -@implementation NSString (QCKSelectorName) - -- (NSString *)qck_selectorName { - static NSMutableCharacterSet *invalidCharacters = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - invalidCharacters = [NSMutableCharacterSet new]; - - NSCharacterSet *whitespaceCharacterSet = [NSCharacterSet whitespaceCharacterSet]; - NSCharacterSet *newlineCharacterSet = [NSCharacterSet newlineCharacterSet]; - NSCharacterSet *illegalCharacterSet = [NSCharacterSet illegalCharacterSet]; - NSCharacterSet *controlCharacterSet = [NSCharacterSet controlCharacterSet]; - NSCharacterSet *punctuationCharacterSet = [NSCharacterSet punctuationCharacterSet]; - NSCharacterSet *nonBaseCharacterSet = [NSCharacterSet nonBaseCharacterSet]; - NSCharacterSet *symbolCharacterSet = [NSCharacterSet symbolCharacterSet]; - - [invalidCharacters formUnionWithCharacterSet:whitespaceCharacterSet]; - [invalidCharacters formUnionWithCharacterSet:newlineCharacterSet]; - [invalidCharacters formUnionWithCharacterSet:illegalCharacterSet]; - [invalidCharacters formUnionWithCharacterSet:controlCharacterSet]; - [invalidCharacters formUnionWithCharacterSet:punctuationCharacterSet]; - [invalidCharacters formUnionWithCharacterSet:nonBaseCharacterSet]; - [invalidCharacters formUnionWithCharacterSet:symbolCharacterSet]; - }); - - NSArray *validComponents = [self componentsSeparatedByCharactersInSet:invalidCharacters]; - - NSString *result = [validComponents componentsJoinedByString:@"_"]; - - return ([result length] == 0 - ? @"_" - : result); -} - -@end diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/Quick.h b/Example/Pods/Quick/Sources/QuickObjectiveC/Quick.h deleted file mode 100644 index 87dad10..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/Quick.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -//! Project version number for Quick. -FOUNDATION_EXPORT double QuickVersionNumber; - -//! Project version string for Quick. -FOUNDATION_EXPORT const unsigned char QuickVersionString[]; - -#import "QuickSpec.h" -#import "QCKDSL.h" -#import "QuickConfiguration.h" diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h b/Example/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h deleted file mode 100644 index 105a97e..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.h +++ /dev/null @@ -1,50 +0,0 @@ -#import - -/** - QuickSpec is a base class all specs written in Quick inherit from. - They need to inherit from QuickSpec, a subclass of XCTestCase, in - order to be discovered by the XCTest framework. - - XCTest automatically compiles a list of XCTestCase subclasses included - in the test target. It iterates over each class in that list, and creates - a new instance of that class for each test method. It then creates an - "invocation" to execute that test method. The invocation is an instance of - NSInvocation, which represents a single message send in Objective-C. - The invocation is set on the XCTestCase instance, and the test is run. - - Most of the code in QuickSpec is dedicated to hooking into XCTest events. - First, when the spec is first loaded and before it is sent any messages, - the +[NSObject initialize] method is called. QuickSpec overrides this method - to call +[QuickSpec spec]. This builds the example group stacks and - registers them with Quick.World, a global register of examples. - - Then, XCTest queries QuickSpec for a list of test methods. Normally, XCTest - automatically finds all methods whose selectors begin with the string "test". - However, QuickSpec overrides this default behavior by implementing the - +[XCTestCase testInvocations] method. This method iterates over each example - registered in Quick.World, defines a new method for that example, and - returns an invocation to call that method to XCTest. Those invocations are - the tests that are run by XCTest. Their selector names are displayed in - the Xcode test navigation bar. - */ -@interface QuickSpec : XCTestCase - -/** - Override this method in your spec to define a set of example groups - and examples. - - @code - override func spec() { - describe("winter") { - it("is coming") { - // ... - } - } - } - @endcode - - See DSL.swift for more information on what syntax is available. - */ -- (void)spec; - -@end diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.m b/Example/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.m deleted file mode 100644 index ea64934..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/QuickSpec.m +++ /dev/null @@ -1,170 +0,0 @@ -#import "QuickSpec.h" -#import "QuickConfiguration.h" -#import "NSString+QCKSelectorName.h" -#import "World.h" -#import - -static QuickSpec *currentSpec = nil; - -const void * const QCKExampleKey = &QCKExampleKey; - -@interface QuickSpec () -@property (nonatomic, strong) Example *example; -@end - -@implementation QuickSpec - -#pragma mark - XCTestCase Overrides - -/** - The runtime sends initialize to each class in a program just before the class, or any class - that inherits from it, is sent its first message from within the program. QuickSpec hooks into - this event to compile the example groups for this spec subclass. - - If an exception occurs when compiling the examples, report it to the user. Chances are they - included an expectation outside of a "it", "describe", or "context" block. - */ -+ (void)initialize { - [QuickConfiguration initialize]; - - World *world = [World sharedWorld]; - [world performWithCurrentExampleGroup:[world rootExampleGroupForSpecClass:self] closure:^{ - QuickSpec *spec = [self new]; - - @try { - [spec spec]; - } - @catch (NSException *exception) { - [NSException raise:NSInternalInconsistencyException - format:@"An exception occurred when building Quick's example groups.\n" - @"Some possible reasons this might happen include:\n\n" - @"- An 'expect(...).to' expectation was evaluated outside of " - @"an 'it', 'context', or 'describe' block\n" - @"- 'sharedExamples' was called twice with the same name\n" - @"- 'itBehavesLike' was called with a name that is not registered as a shared example\n\n" - @"Here's the original exception: '%@', reason: '%@', userInfo: '%@'", - exception.name, exception.reason, exception.userInfo]; - } - [self testInvocations]; - }]; -} - -/** - Invocations for each test method in the test case. QuickSpec overrides this method to define a - new method for each example defined in +[QuickSpec spec]. - - @return An array of invocations that execute the newly defined example methods. - */ -+ (NSArray *)testInvocations { - NSArray *examples = [[World sharedWorld] examplesForSpecClass:[self class]]; - NSMutableArray *invocations = [NSMutableArray arrayWithCapacity:[examples count]]; - - NSMutableSet *selectorNames = [NSMutableSet set]; - - for (Example *example in examples) { - SEL selector = [self addInstanceMethodForExample:example classSelectorNames:selectorNames]; - NSInvocation *invocation = [self invocationForInstanceMethodWithSelector:selector - example:example]; - [invocations addObject:invocation]; - } - - return invocations; -} - -/** - XCTest sets the invocation for the current test case instance using this setter. - QuickSpec hooks into this event to give the test case a reference to the current example. - It will need this reference to correctly report its name to XCTest. - */ -- (void)setInvocation:(NSInvocation *)invocation { - self.example = objc_getAssociatedObject(invocation, QCKExampleKey); - [super setInvocation:invocation]; -} - -#pragma mark - Public Interface - -- (void)spec { } - -#pragma mark - Internal Methods - -/** - QuickSpec uses this method to dynamically define a new instance method for the - given example. The instance method runs the example, catching any exceptions. - The exceptions are then reported as test failures. - - In order to report the correct file and line number, examples must raise exceptions - containing following keys in their userInfo: - - - "SenTestFilenameKey": A String representing the file name - - "SenTestLineNumberKey": An Int representing the line number - - These keys used to be used by SenTestingKit, and are still used by some testing tools - in the wild. See: https://github.com/Quick/Quick/pull/41 - - @return The selector of the newly defined instance method. - */ -+ (SEL)addInstanceMethodForExample:(Example *)example classSelectorNames:(NSMutableSet *)selectorNames { - IMP implementation = imp_implementationWithBlock(^(QuickSpec *self){ - currentSpec = self; - [example run]; - }); - NSCharacterSet *characterSet = [NSCharacterSet alphanumericCharacterSet]; - NSMutableString *sanitizedFileName = [NSMutableString string]; - for (NSUInteger i = 0; i < example.callsite.file.length; i++) { - unichar ch = [example.callsite.file characterAtIndex:i]; - if ([characterSet characterIsMember:ch]) { - [sanitizedFileName appendFormat:@"%c", ch]; - } - } - - const char *types = [[NSString stringWithFormat:@"%s%s%s", @encode(id), @encode(id), @encode(SEL)] UTF8String]; - - NSString *originalName = example.name.qck_selectorName; - NSString *selectorName = originalName; - NSUInteger i = 2; - - while ([selectorNames containsObject:selectorName]) { - selectorName = [NSString stringWithFormat:@"%@_%tu", originalName, i++]; - } - - [selectorNames addObject:selectorName]; - - SEL selector = NSSelectorFromString(selectorName); - class_addMethod(self, selector, implementation, types); - - return selector; -} - -+ (NSInvocation *)invocationForInstanceMethodWithSelector:(SEL)selector - example:(Example *)example { - NSMethodSignature *signature = [self instanceMethodSignatureForSelector:selector]; - NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature]; - invocation.selector = selector; - objc_setAssociatedObject(invocation, - QCKExampleKey, - example, - OBJC_ASSOCIATION_RETAIN_NONATOMIC); - return invocation; -} - -/** - This method is used to record failures, whether they represent example - expectations that were not met, or exceptions raised during test setup - and teardown. By default, the failure will be reported as an - XCTest failure, and the example will be highlighted in Xcode. - */ -- (void)recordFailureWithDescription:(NSString *)description - inFile:(NSString *)filePath - atLine:(NSUInteger)lineNumber - expected:(BOOL)expected { - if (self.example.isSharedExample) { - filePath = self.example.callsite.file; - lineNumber = self.example.callsite.line; - } - [currentSpec.testRun recordFailureWithDescription:description - inFile:filePath - atLine:lineNumber - expected:expected]; -} - -@end diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/World.h b/Example/Pods/Quick/Sources/QuickObjectiveC/World.h deleted file mode 100644 index e638cf6..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/World.h +++ /dev/null @@ -1,18 +0,0 @@ -#import - -@class ExampleGroup; -@class ExampleMetadata; - -SWIFT_CLASS("_TtC5Quick5World") -@interface World - -@property (nonatomic) ExampleGroup * __nullable currentExampleGroup; -@property (nonatomic) ExampleMetadata * __nullable currentExampleMetadata; -@property (nonatomic) BOOL isRunningAdditionalSuites; -+ (World * __nonnull)sharedWorld; -- (void)configure:(void (^ __nonnull)(Configuration * __nonnull))closure; -- (void)finalizeConfiguration; -- (ExampleGroup * __nonnull)rootExampleGroupForSpecClass:(Class __nonnull)cls; -- (NSArray * __nonnull)examplesForSpecClass:(Class __nonnull)specClass; -- (void)performWithCurrentExampleGroup:(ExampleGroup * __nonnull)group closure:(void (^ __nonnull)(void))closure; -@end diff --git a/Example/Pods/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m b/Example/Pods/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m deleted file mode 100644 index e49939e..0000000 --- a/Example/Pods/Quick/Sources/QuickObjectiveC/XCTestSuite+QuickTestSuiteBuilder.m +++ /dev/null @@ -1,40 +0,0 @@ -#import -#import -#import - -@interface XCTestSuite (QuickTestSuiteBuilder) -@end - -@implementation XCTestSuite (QuickTestSuiteBuilder) - -/** - In order to ensure we can correctly build dynamic test suites, we need to - replace some of the default test suite constructors. - */ -+ (void)load { - Method testCaseWithName = class_getClassMethod(self, @selector(testSuiteForTestCaseWithName:)); - Method hooked_testCaseWithName = class_getClassMethod(self, @selector(qck_hooked_testSuiteForTestCaseWithName:)); - method_exchangeImplementations(testCaseWithName, hooked_testCaseWithName); -} - -/** - The `+testSuiteForTestCaseWithName:` method is called when a specific test case - class is run from the Xcode test navigator. If the built test suite is `nil`, - Xcode will not run any tests for that test case. - - Given if the following test case class is run from the Xcode test navigator: - - FooSpec - testFoo - testBar - - XCTest will invoke this once per test case, with test case names following this format: - - FooSpec/testFoo - FooSpec/testBar - */ -+ (nullable instancetype)qck_hooked_testSuiteForTestCaseWithName:(nonnull NSString *)name { - return [QuickTestSuite selectedTestSuiteForTestCaseWithName:name]; -} - -@end diff --git a/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m b/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m deleted file mode 100644 index a6c4594..0000000 --- a/Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Alamofire : NSObject -@end -@implementation PodsDummy_Alamofire -@end diff --git a/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch b/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch deleted file mode 100644 index aa992a4..0000000 --- a/Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef __OBJC__ -#import -#endif - diff --git a/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h b/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h deleted file mode 100644 index 6b71676..0000000 --- a/Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - - -FOUNDATION_EXPORT double AlamofireVersionNumber; -FOUNDATION_EXPORT const unsigned char AlamofireVersionString[]; - diff --git a/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap b/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap deleted file mode 100644 index d1f125f..0000000 --- a/Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Alamofire { - umbrella header "Alamofire-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig b/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig deleted file mode 100644 index 772ef0b..0000000 --- a/Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig +++ /dev/null @@ -1,9 +0,0 @@ -CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Alamofire -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES diff --git a/Example/Pods/Target Support Files/Alamofire/Info.plist b/Example/Pods/Target Support Files/Alamofire/Info.plist deleted file mode 100644 index b672cd7..0000000 --- a/Example/Pods/Target Support Files/Alamofire/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 - 4.0.1 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/Nimble/Info.plist b/Example/Pods/Target Support Files/Nimble/Info.plist deleted file mode 100644 index e2771ff..0000000 --- a/Example/Pods/Target Support Files/Nimble/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.0.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/Nimble/Nimble-dummy.m b/Example/Pods/Target Support Files/Nimble/Nimble-dummy.m deleted file mode 100644 index e8177ab..0000000 --- a/Example/Pods/Target Support Files/Nimble/Nimble-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Nimble : NSObject -@end -@implementation PodsDummy_Nimble -@end diff --git a/Example/Pods/Target Support Files/Nimble/Nimble-prefix.pch b/Example/Pods/Target Support Files/Nimble/Nimble-prefix.pch deleted file mode 100644 index aa992a4..0000000 --- a/Example/Pods/Target Support Files/Nimble/Nimble-prefix.pch +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef __OBJC__ -#import -#endif - diff --git a/Example/Pods/Target Support Files/Nimble/Nimble-umbrella.h b/Example/Pods/Target Support Files/Nimble/Nimble-umbrella.h deleted file mode 100644 index 7151480..0000000 --- a/Example/Pods/Target Support Files/Nimble/Nimble-umbrella.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -#import "Nimble.h" -#import "DSL.h" -#import "NMBExceptionCapture.h" -#import "NMBStringify.h" - -FOUNDATION_EXPORT double NimbleVersionNumber; -FOUNDATION_EXPORT const unsigned char NimbleVersionString[]; - diff --git a/Example/Pods/Target Support Files/Nimble/Nimble.modulemap b/Example/Pods/Target Support Files/Nimble/Nimble.modulemap deleted file mode 100644 index 6f77009..0000000 --- a/Example/Pods/Target Support Files/Nimble/Nimble.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Nimble { - umbrella header "Nimble-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/Nimble/Nimble.xcconfig b/Example/Pods/Target Support Files/Nimble/Nimble.xcconfig deleted file mode 100644 index bc9e893..0000000 --- a/Example/Pods/Target Support Files/Nimble/Nimble.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Nimble -ENABLE_BITCODE = NO -FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" -OTHER_LDFLAGS = -weak-lswiftXCTest -weak_framework "XCTest" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Info.plist b/Example/Pods/Target Support Files/Pods-Reqres_Example/Info.plist deleted file mode 100644 index 2243fe6..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/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 - 1.0.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-acknowledgements.markdown b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-acknowledgements.markdown deleted file mode 100644 index 0ae7304..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-acknowledgements.markdown +++ /dev/null @@ -1,49 +0,0 @@ -# Acknowledgements -This application makes use of the following third party libraries: - -## Alamofire - -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. - - -## Reqres - -Copyright (c) 2016 Jan Mísař - -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-Reqres_Example/Pods-Reqres_Example-acknowledgements.plist b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-acknowledgements.plist deleted file mode 100644 index f226c09..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-acknowledgements.plist +++ /dev/null @@ -1,87 +0,0 @@ - - - - - PreferenceSpecifiers - - - FooterText - This application makes use of the following third party libraries: - Title - Acknowledgements - Type - PSGroupSpecifier - - - FooterText - 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. - - License - MIT - Title - Alamofire - Type - PSGroupSpecifier - - - FooterText - Copyright (c) 2016 Jan Mísař <misar.jan@gmail.com> - -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 - Reqres - Type - PSGroupSpecifier - - - FooterText - Generated by CocoaPods - https://cocoapods.org - Title - - Type - PSGroupSpecifier - - - StringsTable - Acknowledgements - Title - Acknowledgements - - diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-dummy.m b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-dummy.m deleted file mode 100644 index 6782e8a..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Pods_Reqres_Example : NSObject -@end -@implementation PodsDummy_Pods_Reqres_Example -@end diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-frameworks.sh b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-frameworks.sh deleted file mode 100755 index 6bbc195..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-frameworks.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -set -e - -echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" -mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - -SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" - -install_framework() -{ - if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then - local source="${BUILT_PRODUCTS_DIR}/$1" - elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then - local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" - elif [ -r "$1" ]; then - local source="$1" - fi - - local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - - if [ -L "${source}" ]; then - echo "Symlinked..." - source="$(readlink "${source}")" - fi - - # use filter instead of exclude so missing patterns dont' throw errors - echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" - rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" - - local basename - basename="$(basename -s .framework "$1")" - binary="${destination}/${basename}.framework/${basename}" - if ! [ -r "$binary" ]; then - binary="${destination}/${basename}" - fi - - # Strip invalid architectures so "fat" simulator / device frameworks work on device - if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then - strip_invalid_archs "$binary" - fi - - # Resign the code if required by the build settings to avoid unstable apps - code_sign_if_enabled "${destination}/$(basename "$1")" - - # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. - if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then - local swift_runtime_libs - swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) - for lib in $swift_runtime_libs; do - echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" - rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" - code_sign_if_enabled "${destination}/${lib}" - done - fi -} - -# Signs a framework with the provided identity -code_sign_if_enabled() { - if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then - # Use the current code_sign_identitiy - echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" - /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" - fi -} - -# Strip invalid architectures -strip_invalid_archs() { - binary="$1" - # Get architectures for current file - archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" - stripped="" - for arch in $archs; do - if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then - # Strip non-valid architectures in-place - lipo -remove "$arch" -output "$binary" "$binary" || exit 1 - stripped="$stripped $arch" - fi - done - if [[ "$stripped" ]]; then - echo "Stripped $binary of architectures:$stripped" - fi -} - - -if [[ "$CONFIGURATION" == "Debug" ]]; then - install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" - install_framework "$BUILT_PRODUCTS_DIR/Reqres/Reqres.framework" -fi -if [[ "$CONFIGURATION" == "Release" ]]; then - install_framework "$BUILT_PRODUCTS_DIR/Alamofire/Alamofire.framework" - install_framework "$BUILT_PRODUCTS_DIR/Reqres/Reqres.framework" -fi diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-resources.sh b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-resources.sh deleted file mode 100755 index 0a15615..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-resources.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -set -e - -mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" - -RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt -> "$RESOURCES_TO_COPY" - -XCASSET_FILES=() - -case "${TARGETED_DEVICE_FAMILY}" in - 1,2) - TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" - ;; - 1) - TARGET_DEVICE_ARGS="--target-device iphone" - ;; - 2) - TARGET_DEVICE_ARGS="--target-device ipad" - ;; - *) - TARGET_DEVICE_ARGS="--target-device mac" - ;; -esac - -realpath() { - DIRECTORY="$(cd "${1%/*}" && pwd)" - FILENAME="${1##*/}" - echo "$DIRECTORY/$FILENAME" -} - -install_resource() -{ - if [[ "$1" = /* ]] ; then - RESOURCE_PATH="$1" - else - RESOURCE_PATH="${PODS_ROOT}/$1" - fi - if [[ ! -e "$RESOURCE_PATH" ]] ; then - cat << EOM -error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. -EOM - exit 1 - fi - case $RESOURCE_PATH in - *.storyboard) - echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" - ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} - ;; - *.xib) - echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" - ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} - ;; - *.framework) - echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - ;; - *.xcdatamodel) - echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" - xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" - ;; - *.xcdatamodeld) - echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" - xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" - ;; - *.xcmappingmodel) - echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" - xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" - ;; - *.xcassets) - ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") - XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") - ;; - *) - echo "$RESOURCE_PATH" - echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" - ;; - esac -} - -mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then - mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" - rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -fi -rm -f "$RESOURCES_TO_COPY" - -if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] -then - # Find all other xcassets (this unfortunately includes those of path pods and other targets). - OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) - while read line; do - if [[ $line != "`realpath $PODS_ROOT`*" ]]; then - XCASSET_FILES+=("$line") - fi - done <<<"$OTHER_XCASSETS" - - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -fi diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-umbrella.h b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-umbrella.h deleted file mode 100644 index 2d91ab3..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-umbrella.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - - -FOUNDATION_EXPORT double Pods_Reqres_ExampleVersionNumber; -FOUNDATION_EXPORT const unsigned char Pods_Reqres_ExampleVersionString[]; - diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.debug.xcconfig b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.debug.xcconfig deleted file mode 100644 index f3a1fbb..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.debug.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -EMBEDDED_CONTENT_CONTAINS_SWIFT = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Reqres" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Reqres/Reqres.framework/Headers" -OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Reqres" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT}/Pods diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.modulemap b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.modulemap deleted file mode 100644 index 690a133..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Pods_Reqres_Example { - umbrella header "Pods-Reqres_Example-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.release.xcconfig b/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.release.xcconfig deleted file mode 100644 index f3a1fbb..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.release.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -EMBEDDED_CONTENT_CONTAINS_SWIFT = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Reqres" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Reqres/Reqres.framework/Headers" -OTHER_LDFLAGS = $(inherited) -framework "Alamofire" -framework "Reqres" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT}/Pods diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Info.plist b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Info.plist deleted file mode 100644 index 2243fe6..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/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 - 1.0.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-acknowledgements.markdown b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-acknowledgements.markdown deleted file mode 100644 index 5444c67..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-acknowledgements.markdown +++ /dev/null @@ -1,413 +0,0 @@ -# Acknowledgements -This application makes use of the following third party libraries: - -## Nimble - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Quick Team - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - -## Quick - -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014, Quick Team - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -Generated by CocoaPods - https://cocoapods.org diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-acknowledgements.plist b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-acknowledgements.plist deleted file mode 100644 index 3051e9b..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-acknowledgements.plist +++ /dev/null @@ -1,451 +0,0 @@ - - - - - PreferenceSpecifiers - - - FooterText - This application makes use of the following third party libraries: - Title - Acknowledgements - Type - PSGroupSpecifier - - - FooterText - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014 Quick Team - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - License - Apache 2.0 - Title - Nimble - Type - PSGroupSpecifier - - - FooterText - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2014, Quick Team - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - License - Apache 2.0 - Title - Quick - Type - PSGroupSpecifier - - - FooterText - Generated by CocoaPods - https://cocoapods.org - Title - - Type - PSGroupSpecifier - - - StringsTable - Acknowledgements - Title - Acknowledgements - - diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-dummy.m b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-dummy.m deleted file mode 100644 index 1c4deb4..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Pods_Reqres_Tests : NSObject -@end -@implementation PodsDummy_Pods_Reqres_Tests -@end diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-frameworks.sh b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-frameworks.sh deleted file mode 100755 index 3e8d2e4..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-frameworks.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -set -e - -echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" -mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - -SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" - -install_framework() -{ - if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then - local source="${BUILT_PRODUCTS_DIR}/$1" - elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then - local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" - elif [ -r "$1" ]; then - local source="$1" - fi - - local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - - if [ -L "${source}" ]; then - echo "Symlinked..." - source="$(readlink "${source}")" - fi - - # use filter instead of exclude so missing patterns dont' throw errors - echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" - rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" - - local basename - basename="$(basename -s .framework "$1")" - binary="${destination}/${basename}.framework/${basename}" - if ! [ -r "$binary" ]; then - binary="${destination}/${basename}" - fi - - # Strip invalid architectures so "fat" simulator / device frameworks work on device - if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then - strip_invalid_archs "$binary" - fi - - # Resign the code if required by the build settings to avoid unstable apps - code_sign_if_enabled "${destination}/$(basename "$1")" - - # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. - if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then - local swift_runtime_libs - swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) - for lib in $swift_runtime_libs; do - echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" - rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" - code_sign_if_enabled "${destination}/${lib}" - done - fi -} - -# Signs a framework with the provided identity -code_sign_if_enabled() { - if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then - # Use the current code_sign_identitiy - echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements \"$1\"" - /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements "$1" - fi -} - -# Strip invalid architectures -strip_invalid_archs() { - binary="$1" - # Get architectures for current file - archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" - stripped="" - for arch in $archs; do - if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then - # Strip non-valid architectures in-place - lipo -remove "$arch" -output "$binary" "$binary" || exit 1 - stripped="$stripped $arch" - fi - done - if [[ "$stripped" ]]; then - echo "Stripped $binary of architectures:$stripped" - fi -} - - -if [[ "$CONFIGURATION" == "Debug" ]]; then - install_framework "$BUILT_PRODUCTS_DIR/Nimble/Nimble.framework" - install_framework "$BUILT_PRODUCTS_DIR/Quick/Quick.framework" -fi -if [[ "$CONFIGURATION" == "Release" ]]; then - install_framework "$BUILT_PRODUCTS_DIR/Nimble/Nimble.framework" - install_framework "$BUILT_PRODUCTS_DIR/Quick/Quick.framework" -fi diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-resources.sh b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-resources.sh deleted file mode 100755 index 0a15615..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-resources.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -set -e - -mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" - -RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt -> "$RESOURCES_TO_COPY" - -XCASSET_FILES=() - -case "${TARGETED_DEVICE_FAMILY}" in - 1,2) - TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" - ;; - 1) - TARGET_DEVICE_ARGS="--target-device iphone" - ;; - 2) - TARGET_DEVICE_ARGS="--target-device ipad" - ;; - *) - TARGET_DEVICE_ARGS="--target-device mac" - ;; -esac - -realpath() { - DIRECTORY="$(cd "${1%/*}" && pwd)" - FILENAME="${1##*/}" - echo "$DIRECTORY/$FILENAME" -} - -install_resource() -{ - if [[ "$1" = /* ]] ; then - RESOURCE_PATH="$1" - else - RESOURCE_PATH="${PODS_ROOT}/$1" - fi - if [[ ! -e "$RESOURCE_PATH" ]] ; then - cat << EOM -error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. -EOM - exit 1 - fi - case $RESOURCE_PATH in - *.storyboard) - echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" - ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} - ;; - *.xib) - echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" - ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} - ;; - *.framework) - echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - ;; - *.xcdatamodel) - echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" - xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" - ;; - *.xcdatamodeld) - echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" - xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" - ;; - *.xcmappingmodel) - echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" - xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" - ;; - *.xcassets) - ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH") - XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") - ;; - *) - echo "$RESOURCE_PATH" - echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" - ;; - esac -} - -mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then - mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" - rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -fi -rm -f "$RESOURCES_TO_COPY" - -if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] -then - # Find all other xcassets (this unfortunately includes those of path pods and other targets). - OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) - while read line; do - if [[ $line != "`realpath $PODS_ROOT`*" ]]; then - XCASSET_FILES+=("$line") - fi - done <<<"$OTHER_XCASSETS" - - printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" -fi diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-umbrella.h b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-umbrella.h deleted file mode 100644 index 2891064..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-umbrella.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - - -FOUNDATION_EXPORT double Pods_Reqres_TestsVersionNumber; -FOUNDATION_EXPORT const unsigned char Pods_Reqres_TestsVersionString[]; - diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.debug.xcconfig b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.debug.xcconfig deleted file mode 100644 index 51e00b3..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.debug.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -EMBEDDED_CONTENT_CONTAINS_SWIFT = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "$PODS_CONFIGURATION_BUILD_DIR/Nimble" "$PODS_CONFIGURATION_BUILD_DIR/Quick" "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Reqres" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Nimble/Nimble.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Quick/Quick.framework/Headers" $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Reqres/Reqres.framework/Headers" -OTHER_LDFLAGS = $(inherited) -framework "Nimble" -framework "Quick" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT}/Pods diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.modulemap b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.modulemap deleted file mode 100644 index 2696be8..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Pods_Reqres_Tests { - umbrella header "Pods-Reqres_Tests-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.release.xcconfig b/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.release.xcconfig deleted file mode 100644 index 51e00b3..0000000 --- a/Example/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests.release.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -EMBEDDED_CONTENT_CONTAINS_SWIFT = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) $(PLATFORM_DIR)/Developer/Library/Frameworks "$PODS_CONFIGURATION_BUILD_DIR/Nimble" "$PODS_CONFIGURATION_BUILD_DIR/Quick" "$PODS_CONFIGURATION_BUILD_DIR/Alamofire" "$PODS_CONFIGURATION_BUILD_DIR/Reqres" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_CFLAGS = $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Nimble/Nimble.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Quick/Quick.framework/Headers" $(inherited) -iquote "$PODS_CONFIGURATION_BUILD_DIR/Alamofire/Alamofire.framework/Headers" -iquote "$PODS_CONFIGURATION_BUILD_DIR/Reqres/Reqres.framework/Headers" -OTHER_LDFLAGS = $(inherited) -framework "Nimble" -framework "Quick" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT}/Pods diff --git a/Example/Pods/Target Support Files/Quick/Info.plist b/Example/Pods/Target Support Files/Quick/Info.plist deleted file mode 100644 index 994ffe8..0000000 --- a/Example/Pods/Target Support Files/Quick/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 - 0.10.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/Quick/Quick-dummy.m b/Example/Pods/Target Support Files/Quick/Quick-dummy.m deleted file mode 100644 index 54d7dc0..0000000 --- a/Example/Pods/Target Support Files/Quick/Quick-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Quick : NSObject -@end -@implementation PodsDummy_Quick -@end diff --git a/Example/Pods/Target Support Files/Quick/Quick-prefix.pch b/Example/Pods/Target Support Files/Quick/Quick-prefix.pch deleted file mode 100644 index aa992a4..0000000 --- a/Example/Pods/Target Support Files/Quick/Quick-prefix.pch +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef __OBJC__ -#import -#endif - diff --git a/Example/Pods/Target Support Files/Quick/Quick-umbrella.h b/Example/Pods/Target Support Files/Quick/Quick-umbrella.h deleted file mode 100644 index c1aab14..0000000 --- a/Example/Pods/Target Support Files/Quick/Quick-umbrella.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -#import "QuickConfiguration.h" -#import "QCKDSL.h" -#import "Quick.h" -#import "QuickSpec.h" - -FOUNDATION_EXPORT double QuickVersionNumber; -FOUNDATION_EXPORT const unsigned char QuickVersionString[]; - diff --git a/Example/Pods/Target Support Files/Quick/Quick.modulemap b/Example/Pods/Target Support Files/Quick/Quick.modulemap deleted file mode 100644 index 1d12b21..0000000 --- a/Example/Pods/Target Support Files/Quick/Quick.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Quick { - umbrella header "Quick-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/Quick/Quick.xcconfig b/Example/Pods/Target Support Files/Quick/Quick.xcconfig deleted file mode 100644 index f25ce83..0000000 --- a/Example/Pods/Target Support Files/Quick/Quick.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Quick -ENABLE_BITCODE = NO -FRAMEWORK_SEARCH_PATHS = $(inherited) "$(PLATFORM_DIR)/Developer/Library/Frameworks" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" -OTHER_LDFLAGS = -framework "XCTest" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES diff --git a/Example/Pods/Target Support Files/Reqres/Info.plist b/Example/Pods/Target Support Files/Reqres/Info.plist deleted file mode 100644 index 2a9158a..0000000 --- a/Example/Pods/Target Support Files/Reqres/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 - 1.2.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Example/Pods/Target Support Files/Reqres/Reqres-dummy.m b/Example/Pods/Target Support Files/Reqres/Reqres-dummy.m deleted file mode 100644 index 8390127..0000000 --- a/Example/Pods/Target Support Files/Reqres/Reqres-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Reqres : NSObject -@end -@implementation PodsDummy_Reqres -@end diff --git a/Example/Pods/Target Support Files/Reqres/Reqres-prefix.pch b/Example/Pods/Target Support Files/Reqres/Reqres-prefix.pch deleted file mode 100644 index aa992a4..0000000 --- a/Example/Pods/Target Support Files/Reqres/Reqres-prefix.pch +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef __OBJC__ -#import -#endif - diff --git a/Example/Pods/Target Support Files/Reqres/Reqres-umbrella.h b/Example/Pods/Target Support Files/Reqres/Reqres-umbrella.h deleted file mode 100644 index 0bb87de..0000000 --- a/Example/Pods/Target Support Files/Reqres/Reqres-umbrella.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - - -FOUNDATION_EXPORT double ReqresVersionNumber; -FOUNDATION_EXPORT const unsigned char ReqresVersionString[]; - diff --git a/Example/Pods/Target Support Files/Reqres/Reqres.modulemap b/Example/Pods/Target Support Files/Reqres/Reqres.modulemap deleted file mode 100644 index 3236c27..0000000 --- a/Example/Pods/Target Support Files/Reqres/Reqres.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Reqres { - umbrella header "Reqres-umbrella.h" - - export * - module * { export * } -} diff --git a/Example/Pods/Target Support Files/Reqres/Reqres.xcconfig b/Example/Pods/Target Support Files/Reqres/Reqres.xcconfig deleted file mode 100644 index d5ca9b3..0000000 --- a/Example/Pods/Target Support Files/Reqres/Reqres.xcconfig +++ /dev/null @@ -1,9 +0,0 @@ -CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/Reqres -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Public" -OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS" -PODS_BUILD_DIR = $BUILD_DIR -PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES diff --git a/Example/Reqres.xcodeproj/project.pbxproj b/Example/Reqres.xcodeproj/project.pbxproj index 5a8070e..03edd74 100644 --- a/Example/Reqres.xcodeproj/project.pbxproj +++ b/Example/Reqres.xcodeproj/project.pbxproj @@ -13,7 +13,7 @@ 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; - 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; + 690F94771F4D8CF70097999D /* ReqresTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690F94761F4D8CF70097999D /* ReqresTests.swift */; }; B63B61FBA9E31EB58F23D671 /* Pods_Reqres_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9FDE80E2DD9D64A85D86C6C1 /* Pods_Reqres_Example.framework */; }; /* End PBXBuildFile section */ @@ -41,8 +41,8 @@ 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 607FACE51AFB9204008FA782 /* Reqres_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Reqres_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 61B4091F53FD9DA0CD471057 /* Pods-Reqres_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Reqres_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example.debug.xcconfig"; sourceTree = ""; }; + 690F94761F4D8CF70097999D /* ReqresTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReqresTests.swift; sourceTree = ""; }; 7E6361578490C80D3925F6E2 /* Reqres.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Reqres.podspec; path = ../Reqres.podspec; sourceTree = ""; }; 9FDE80E2DD9D64A85D86C6C1 /* Pods_Reqres_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Reqres_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BDDE296250E1112169CE19D6 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; @@ -124,8 +124,8 @@ 607FACE81AFB9204008FA782 /* Tests */ = { isa = PBXGroup; children = ( - 607FACEB1AFB9204008FA782 /* Tests.swift */, 607FACE91AFB9204008FA782 /* Supporting Files */, + 690F94761F4D8CF70097999D /* ReqresTests.swift */, ); path = Tests; sourceTree = ""; @@ -219,7 +219,7 @@ }; 607FACE41AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 0900; TestTargetID = 607FACCF1AFB9204008FA782; }; }; @@ -270,9 +270,14 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Reqres_Example/Pods-Reqres_Example-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework", + "${BUILT_PRODUCTS_DIR}/Reqres/Reqres.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Alamofire.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reqres.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -285,13 +290,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Reqres_Tests-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; 95C1602F4AE2D4440BEE0402 /* [CP] Copy Pods Resources */ = { @@ -315,9 +323,14 @@ files = ( ); inputPaths = ( + "${SRCROOT}/Pods/Target Support Files/Pods-Reqres_Tests/Pods-Reqres_Tests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Nimble/Nimble.framework", + "${BUILT_PRODUCTS_DIR}/Quick/Quick.framework", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Nimble.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Quick.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -345,13 +358,16 @@ files = ( ); inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Reqres_Example-checkManifestLockResult.txt", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ @@ -370,7 +386,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, + 690F94771F4D8CF70097999D /* ReqresTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -497,7 +513,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -512,7 +528,7 @@ MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -520,6 +536,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = C64942AB2B6AC873A4A70CBC /* Pods-Reqres_Tests.debug.xcconfig */; buildSettings = { + CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -532,6 +549,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 3.0; }; name = Debug; @@ -540,6 +558,7 @@ isa = XCBuildConfiguration; baseConfigurationReference = 5616442AC21C633A8CD76EAE /* Pods-Reqres_Tests.release.xcconfig */; buildSettings = { + CLANG_ENABLE_MODULES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", diff --git a/Example/Reqres.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/Example/Reqres.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..3ddf867 --- /dev/null +++ b/Example/Reqres.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + BuildSystemType + Latest + + diff --git a/Example/Reqres/AppDelegate.swift b/Example/Reqres/AppDelegate.swift index 8712a8a..3aed9f0 100644 --- a/Example/Reqres/AppDelegate.swift +++ b/Example/Reqres/AppDelegate.swift @@ -13,7 +13,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true @@ -41,6 +40,4 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } - } - diff --git a/Example/Reqres/ViewController.swift b/Example/Reqres/ViewController.swift index 1eb3a76..664066a 100644 --- a/Example/Reqres/ViewController.swift +++ b/Example/Reqres/ViewController.swift @@ -28,6 +28,6 @@ class ViewController: UIViewController { debugPrint(response.request) debugPrint(response.response) }) - + } } diff --git a/Example/Tests/ReqresTests.swift b/Example/Tests/ReqresTests.swift new file mode 100644 index 0000000..35653f0 --- /dev/null +++ b/Example/Tests/ReqresTests.swift @@ -0,0 +1,9 @@ +// +// ReqresTests.swift +// Reqres_Tests +// +// Created by Jakub Olejník on 23/08/2017. +// Copyright © 2017 CocoaPods. All rights reserved. +// + +import Foundation diff --git a/Example/Tests/Tests.swift b/Example/Tests/Tests.swift deleted file mode 100644 index 2b12076..0000000 --- a/Example/Tests/Tests.swift +++ /dev/null @@ -1,50 +0,0 @@ -// https://github.com/Quick/Quick - -import Quick -import Nimble -import Reqres - -class TableOfContentsSpec: QuickSpec { -// override func spec() { -// describe("these will fail") { -// -// it("can do maths") { -// expect(1) == 2 -// } -// -// it("can read") { -// expect("number") == "string" -// } -// -// it("will eventually fail") { -// expect("time").toEventually( equal("done") ) -// } -// -// context("these will pass") { -// -// it("can do maths") { -// expect(23) == 23 -// } -// -// it("can read") { -// expect("🐮") == "🐮" -// } -// -// it("will eventually pass") { -// var time = "passing" -// -// dispatch_async(dispatch_get_main_queue()) { -// time = "done" -// } -// -// waitUntil { done in -// NSThread.sleepForTimeInterval(0.5) -// expect(time) == "done" -// -// done() -// } -// } -// } -// } -// } -} diff --git a/README.md b/README.md index c42ff43..ca2b8df 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Reqres is a simple library for logging all requests and responses in your app. It supports Alamofire and also requests made via native NSURLSession. ``` -⬆️ POST 'https://ackee.cz/examples' +⬆️ POST 'https://ackee.cz/examples' Headers: [ Accept-Encoding : gzip;q=1.0, compress;q=0.5 Accept-Language : en-US;q=1.0 @@ -46,6 +46,14 @@ it, simply add the following line to your Podfile: pod "Reqres" ``` +### Swift version compatibility + +| Swift version | Reqres version | +| ------------- | -------------- | +| 2.x | 1.2.x | +| 3.x | >= 2.0 | +| 4.x | >= 2.0 | + ## Usage Initialization is different for usage with Alamofire and NSURLSession. @@ -101,7 +109,7 @@ Reqres.allowUTF8Emoji = false Reqres breaks Alamofire `.authenticate(user: password:)` method (and possibly more..?). Use with caution! Write tests! Volunteer to fix this bug! -## Forking this repository +## Forking this repository If you use Reqres in your projects drop us as tweet at [@ackeecz][1]. We would love to hear about it! ## Sharing is caring diff --git a/Reqres.podspec b/Reqres.podspec index 03b742f..987e736 100644 --- a/Reqres.podspec +++ b/Reqres.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'Reqres' - s.version = '2.0.1' + s.version = '2.1' s.summary = 'Simple network activity logger' s.description = <<-DESC diff --git a/Reqres/Classes/Reqres.swift b/Reqres/Classes/Reqres.swift index 96f6d56..7246848 100644 --- a/Reqres/Classes/Reqres.swift +++ b/Reqres/Classes/Reqres.swift @@ -1,6 +1,6 @@ // -// ACKNetworkLogger.swift -// ACKNetworkLogger +// Reqres.swift +// Reqres // // Created by Jan Mísař on 05/27/2016. // Copyright (c) 2016 Jan Mísař. All rights reserved. @@ -11,10 +11,8 @@ import Foundation let ReqresRequestHandledKey = "ReqresRequestHandledKey" let ReqresRequestTimeKey = "ReqresRequestTimeKey" -open class Reqres: URLProtocol { - var connection: NSURLConnection? - var data: NSMutableData? - var response: URLResponse? +open class Reqres: URLProtocol, URLSessionDelegate { + var dataTask: URLSessionDataTask? var newRequest: NSMutableURLRequest? open static var allowUTF8Emoji: Bool = true @@ -53,49 +51,38 @@ open class Reqres: URLProtocol { } open override func startLoading() { - guard let req = (request as NSURLRequest).mutableCopy() as? NSMutableURLRequest , newRequest == nil else { return } + guard let req = (request as NSURLRequest).mutableCopy() as? NSMutableURLRequest, newRequest == nil else { return } self.newRequest = req URLProtocol.setProperty(true, forKey: ReqresRequestHandledKey, in: newRequest!) URLProtocol.setProperty(Date(), forKey: ReqresRequestTimeKey, in: newRequest!) - connection = NSURLConnection(request: newRequest! as URLRequest, delegate: self) + let session = URLSession(configuration: .default, delegate: self, delegateQueue: nil) + dataTask = session.dataTask(with: request) { [weak self] data, response, error in + guard let `self` = self else { return } - logRequest(newRequest! as URLRequest) - } - - open override func stopLoading() { - connection?.cancel() - connection = nil - } + if let error = error { + self.client?.urlProtocol(self, didFailWithError: error) + self.logError(self.request, error: error as NSError) - // MARK: NSURLConnectionDelegate - - func connection(_ connection: NSURLConnection!, didReceiveResponse response: URLResponse!) { - let policy = URLCache.StoragePolicy(rawValue: request.cachePolicy.rawValue) ?? .notAllowed - client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: policy) - - self.response = response - self.data = NSMutableData() - } - - func connection(_ connection: NSURLConnection!, didReceiveData data: Data!) { - client?.urlProtocol(self, didLoad: data) - self.data?.append(data) - } + return + } - func connectionDidFinishLoading(_ connection: NSURLConnection!) { - client?.urlProtocolDidFinishLoading(self) + guard let response = response, let data = data else { return } - if let response = response { - logResponse(response, method: connection.originalRequest.httpMethod, data: data as Data?) + self.client?.urlProtocol(self, didReceive: response, cacheStoragePolicy: .allowed) + self.client?.urlProtocol(self, didLoad: data) + self.client?.urlProtocolDidFinishLoading(self) + self.logResponse(response, method: nil, data: data) } + dataTask?.resume() + + logRequest(newRequest! as URLRequest) } - func connection(_ connection: NSURLConnection!, didFailWithError error: NSError!) { - client?.urlProtocol(self, didFailWithError: error) - logError(connection.originalRequest, error: error) + open override func stopLoading() { + dataTask?.cancel() } // MARK: - Logging @@ -104,6 +91,10 @@ open class Reqres: URLProtocol { var s = "" + if type(of: self).allowUTF8Emoji { + s += "⚠️ " + } + if let method = request.httpMethod { s += "\(method) " } @@ -143,7 +134,7 @@ open class Reqres: URLProtocol { if type(of: self).logger.logLevel == .verbose { - if let headers = request.allHTTPHeaderFields , headers.count > 0 { + if let headers = request.allHTTPHeaderFields, headers.count > 0 { s += "\n" + logHeaders(headers as [String : AnyObject]) } @@ -164,12 +155,14 @@ open class Reqres: URLProtocol { s += "⬇️ " } - if let method = newRequest?.httpMethod { + if let method = method { + s += "\(method)" + } else if let method = newRequest?.httpMethod { s += "\(method) " } if let url = response.url?.absoluteString { - s += "\(url) " + s += "'\(url)' " } if let httpResponse = response as? HTTPURLResponse { @@ -195,7 +188,7 @@ open class Reqres: URLProtocol { if type(of: self).logger.logLevel == .verbose { - if let headers = (response as? HTTPURLResponse)?.allHeaderFields as? [String: AnyObject] , headers.count > 0 { + if let headers = (response as? HTTPURLResponse)?.allHeaderFields as? [String: AnyObject], headers.count > 0 { s += "\n" + logHeaders(headers) } @@ -223,11 +216,11 @@ open class Reqres: URLProtocol { if let json = try? JSONSerialization.jsonObject(with: body, options: .mutableContainers), let pretty = try? JSONSerialization.data(withJSONObject: json, options: .prettyPrinted), let string = String(data: pretty, encoding: String.Encoding.utf8) { - return string + return string } else if let string = String(data: body, encoding: String.Encoding.utf8) { - return string + return string } else { - return body.description + return body.description } } else { return "nil" @@ -244,7 +237,7 @@ extension URLRequest { let data = NSMutableData() stream.open() - let bufferSize = 4096 + let bufferSize = 4_096 let buffer = UnsafeMutablePointer.allocate(capacity: bufferSize) while stream.hasBytesAvailable { let bytesRead = stream.read(buffer, maxLength: bufferSize) diff --git a/Reqres/Classes/ReqresDefaultLogger.swift b/Reqres/Classes/ReqresDefaultLogger.swift index 6b86181..baf8b80 100644 --- a/Reqres/Classes/ReqresDefaultLogger.swift +++ b/Reqres/Classes/ReqresDefaultLogger.swift @@ -1,6 +1,6 @@ // -// ACKDefaultLogger.swift -// Pods +// ReqresDefaultLogger.swift +// Reqres // // Created by Jan Mísař on 02.08.16. // @@ -13,7 +13,7 @@ open class ReqresDefaultLogger: ReqresLogging { df.dateFormat = "YYYY-MM-dd HH:mm:ss.SSS" return df }() - + open var logLevel: LogLevel = .verbose open func logVerbose(_ message: String) { @@ -27,7 +27,7 @@ open class ReqresDefaultLogger: ReqresLogging { open func logError(_ message: String) { logMessage(message) } - + private func logMessage(_ message: String) { print("[" + dateFormatter.string(from: Date()) + "] " + message) } diff --git a/Reqres/Classes/ReqresLogging.swift b/Reqres/Classes/ReqresLogging.swift index 4944019..2f17410 100644 --- a/Reqres/Classes/ReqresLogging.swift +++ b/Reqres/Classes/ReqresLogging.swift @@ -1,6 +1,6 @@ // -// ACKLogging.swift -// Pods +// ReqresLogging.swift +// Reqres // // Created by Jan Mísař on 02.08.16. //