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.
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.
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.
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.
+
+
+
+
Declaration
+
+
Swift
+
openfuncstream(closure:((Data)->Void)?=nil)->Self
+
+
+
+
+
Parameters
+
+
+
+
+
+ closure
+
+
+
+
+
The code to be executed periodically during the lifecycle of the request.
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.
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.
+
+
+
+
+
+
+ completionHandler
+
+
+
+
+
A closure to be executed once the request has finished.
Creates a response serializer that returns a JSON object result type constructed from the response data using
+JSONSerialization with the specified reading options.
Creates a response serializer that returns an object constructed from the response data using
+PropertyListSerialization with the specified reading options.
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.
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.
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.
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.
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.
+
+
+
+
+
+
+ completionHandler
+
+
+
+
+
A closure to be executed once the request has finished.
Creates a response serializer that returns a JSON object result type constructed from the response data using
+JSONSerialization with the specified reading options.
Creates a response serializer that returns an object constructed from the response data using
+PropertyListSerialization with the specified reading options.
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.
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.
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.
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.
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.
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.
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.
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.
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 plist object contained in a result type constructed from the response data using
+PropertyListSerialization with the specified reading options.
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.
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.
The session containing the task whose request resulted in a redirect.
+
+
+
+
+
+
+ task
+
+
+
+
+
The task whose request resulted in a redirect.
+
+
+
+
+
+
+ response
+
+
+
+
+
An object containing the server’s response to the original request.
+
+
+
+
+
+
+ request
+
+
+
+
+
A URL request object filled out with the new location.
+
+
+
+
+
+
+ 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.
The session containing the data task that received an initial reply.
+
+
+
+
+
+
+ dataTask
+
+
+
+
+
The data task that received an initial reply.
+
+
+
+
+
+
+ response
+
+
+
+
+
A URL response object populated with headers.
+
+
+
+
+
+
+ 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.
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.
+
+
+
+
+
+
+ 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.
The session containing the download task that finished.
+
+
+
+
+
+
+ downloadTask
+
+
+
+
+
The download task that finished.
+
+
+
+
+
+
+ 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.
The number of bytes transferred since the last time this delegate
+ method was called.
+
+
+
+
+
+
+ totalBytesWritten
+
+
+
+
+
The total number of bytes transferred so far.
+
+
+
+
+
+
+ totalBytesExpectedToWrite
+
+
+
+
+
The expected length of the file, as provided by the Content-Length
+ header. If this header was not provided, the value is
+ NSURLSessionTransferSizeUnknown.
The session containing the download task that finished.
+
+
+
+
+
+
+ downloadTask
+
+
+
+
+
The download task that resumed. See explanation in the discussion.
+
+
+
+
+
+
+ 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.
+
+
+
+
+
+
+ expectedTotalBytes
+
+
+
+
+
The expected length of the file, as provided by the Content-Length header.
+ If this header was not provided, the value is NSURLSessionTransferSizeUnknown.
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.
Creates a DownloadRequest from the resumeData produced from a previous request cancellation to retrieve
+the contents of the original request and save them to the destination.
+
+
If destination is not specified, the contents will remain in the temporary location determined by the
+underlying URL session.
+
+
If startRequestsImmediately is true, the request will have resume() called before being returned.
+
+
On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), resumeData is broken
+on background URL session configurations. There’s an underlying bug in the resumeData generation logic where the
+data is written incorrectly and will always fail to resume the download. For more information about the bug and
+possible workarounds, please refer to the following Stack Overflow post:
The resume data. This is an opaque data blob produced by URLSessionDownloadTask
+ when a task is cancelled. See URLSession -downloadTask(withResumeData:) for
+ additional information.
+
+
+
+
+
+
+ destination
+
+
+
+
+
The closure used to determine the destination of the downloaded file. nil by default.
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.
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.
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.
The ServerTrustPolicy evaluates the server trust generally provided by an NSURLAuthenticationChallenge when
+connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust
+with a given set of criteria to determine whether the server trust is valid and the connection should be made.
+
+
Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other
+vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged
+to route all communication over an HTTPS connection with pinning enabled.
+
+
+
performDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to
+ validate the host provided by the challenge. Applications are encouraged to always
+ validate the host in production environments to guarantee the validity of the server’s
+ certificate chain.
+
performRevokedEvaluation: Uses the default and revoked server trust evaluations allowing you to control whether to
+ validate the host provided by the challenge as well as specify the revocation flags for
+ testing for revoked certificates. Apple platforms did not start testing for revoked
+ certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is
+ demonstrated in our TLS tests. Applications are encouraged to always validate the host
+ in production environments to guarantee the validity of the server’s certificate chain.
+
pinCertificates: Uses the pinned certificates to validate the server trust. The server trust is
+ considered valid if one of the pinned certificates match one of the server certificates.
+ By validating both the certificate chain and host, certificate pinning provides a very
+ secure form of server trust validation mitigating most, if not all, MITM attacks.
+ Applications are encouraged to always validate the host and require a valid certificate
+ chain in production environments.
+
pinPublicKeys: Uses the pinned public keys to validate the server trust. The server trust is considered
+ valid if one of the pinned public keys match one of the server certificate public keys.
+ By validating both the certificate chain and host, public key pinning provides a very
+ secure form of server trust validation mitigating most, if not all, MITM attacks.
+ Applications are encouraged to always validate the host and require a valid certificate
+ chain in production environments.
+
disableEvaluation: Disables all evaluation which in turn will always consider any server trust as valid.
+
customEvaluation: Uses the associated closure to evaluate the validity of the server trust.
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.
Returns whether the AFError is a response serialization error. When true, the failedStringEncoding and
+underlyingError properties will contain the associated values.
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.
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.
The ServerTrustPolicy evaluates the server trust generally provided by an NSURLAuthenticationChallenge when
+connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust
+with a given set of criteria to determine whether the server trust is valid and the connection should be made.
+
+
Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other
+vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged
+to route all communication over an HTTPS connection with pinning enabled.
+
+
+
performDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to
+ validate the host provided by the challenge. Applications are encouraged to always
+ validate the host in production environments to guarantee the validity of the server’s
+ certificate chain.
+
performRevokedEvaluation: Uses the default and revoked server trust evaluations allowing you to control whether to
+ validate the host provided by the challenge as well as specify the revocation flags for
+ testing for revoked certificates. Apple platforms did not start testing for revoked
+ certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is
+ demonstrated in our TLS tests. Applications are encouraged to always validate the host
+ in production environments to guarantee the validity of the server’s certificate chain.
+
pinCertificates: Uses the pinned certificates to validate the server trust. The server trust is
+ considered valid if one of the pinned certificates match one of the server certificates.
+ By validating both the certificate chain and host, certificate pinning provides a very
+ secure form of server trust validation mitigating most, if not all, MITM attacks.
+ Applications are encouraged to always validate the host and require a valid certificate
+ chain in production environments.
+
pinPublicKeys: Uses the pinned public keys to validate the server trust. The server trust is considered
+ valid if one of the pinned public keys match one of the server certificate public keys.
+ By validating both the certificate chain and host, public key pinning provides a very
+ secure form of server trust validation mitigating most, if not all, MITM attacks.
+ Applications are encouraged to always validate the host and require a valid certificate
+ chain in production environments.
+
disableEvaluation: Disables all evaluation which in turn will always consider any server trust as valid.
+
customEvaluation: Uses the associated closure to evaluate the validity of the server trust.
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.
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.
Creates a DownloadRequest using the default SessionManager from the resumeData produced from a
+previous request cancellation to retrieve the contents of the original request and save them to the destination.
+
+
If destination is not specified, the contents will remain in the temporary location determined by the
+underlying URL session.
+
+
On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), resumeData is broken
+on background URL session configurations. There’s an underlying bug in the resumeData generation logic where the
+data is written incorrectly and will always fail to resume the download. For more information about the bug and
+possible workarounds, please refer to the following Stack Overflow post:
The resume data. This is an opaque data blob produced by URLSessionDownloadTask
+ when a task is cancelled. See URLSession -downloadTask(withResumeData:) for additional
+ information.
+
+
+
+
+
+
+ destination
+
+
+
+
+
The closure used to determine the destination of the downloaded file. nil by default.
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.
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.
Determines whether the Request should be retried by calling the completion closure.
+
+
This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs
+to be retried. The one requirement is that the completion closure is called to ensure the request is properly
+cleaned up after.
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).
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.
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.
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.
A closure that takes the success value of the instance’s result.
+
+
+
+
+
+
+
+
Return Value
+
A DataResponse whose result wraps the value returned by the given closure. If this instance’s
+ result is a failure, returns a response wrapping the same failure.
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.
A closure that takes the success value of the instance’s result.
+
+
+
+
+
+
+
+
Return Value
+
A DownloadResponse whose result wraps the value returned by the given closure. If this instance’s
+ result is a failure, returns a response wrapping the same failure.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
+
+
+
+
Declaration
+
+
Swift
+
openfuncstream(closure:((Data)->Void)?=nil)->Self
+
+
+
+
+
Parameters
+
+
+
+
+
+ closure
+
+
+
+
+
The code to be executed periodically during the lifecycle of the request.
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.
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.
+
+
+
+
+
+
+ completionHandler
+
+
+
+
+
A closure to be executed once the request has finished.
Creates a response serializer that returns a JSON object result type constructed from the response data using
+JSONSerialization with the specified reading options.
Creates a response serializer that returns an object constructed from the response data using
+PropertyListSerialization with the specified reading options.
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.
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.
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.
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.
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.
+
+
+
+
+
+
+ completionHandler
+
+
+
+
+
A closure to be executed once the request has finished.
Creates a response serializer that returns a JSON object result type constructed from the response data using
+JSONSerialization with the specified reading options.
Creates a response serializer that returns an object constructed from the response data using
+PropertyListSerialization with the specified reading options.
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.
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.
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.
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.
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.
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.
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.
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.
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 plist object contained in a result type constructed from the response data using
+PropertyListSerialization with the specified reading options.
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.
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.
The session containing the task whose request resulted in a redirect.
+
+
+
+
+
+
+ task
+
+
+
+
+
The task whose request resulted in a redirect.
+
+
+
+
+
+
+ response
+
+
+
+
+
An object containing the server’s response to the original request.
+
+
+
+
+
+
+ request
+
+
+
+
+
A URL request object filled out with the new location.
+
+
+
+
+
+
+ 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.
The session containing the data task that received an initial reply.
+
+
+
+
+
+
+ dataTask
+
+
+
+
+
The data task that received an initial reply.
+
+
+
+
+
+
+ response
+
+
+
+
+
A URL response object populated with headers.
+
+
+
+
+
+
+ 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.
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.
+
+
+
+
+
+
+ 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.
The session containing the download task that finished.
+
+
+
+
+
+
+ downloadTask
+
+
+
+
+
The download task that finished.
+
+
+
+
+
+
+ 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.
The number of bytes transferred since the last time this delegate
+ method was called.
+
+
+
+
+
+
+ totalBytesWritten
+
+
+
+
+
The total number of bytes transferred so far.
+
+
+
+
+
+
+ totalBytesExpectedToWrite
+
+
+
+
+
The expected length of the file, as provided by the Content-Length
+ header. If this header was not provided, the value is
+ NSURLSessionTransferSizeUnknown.
The session containing the download task that finished.
+
+
+
+
+
+
+ downloadTask
+
+
+
+
+
The download task that resumed. See explanation in the discussion.
+
+
+
+
+
+
+ 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.
+
+
+
+
+
+
+ expectedTotalBytes
+
+
+
+
+
The expected length of the file, as provided by the Content-Length header.
+ If this header was not provided, the value is NSURLSessionTransferSizeUnknown.
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.
Creates a DownloadRequest from the resumeData produced from a previous request cancellation to retrieve
+the contents of the original request and save them to the destination.
+
+
If destination is not specified, the contents will remain in the temporary location determined by the
+underlying URL session.
+
+
If startRequestsImmediately is true, the request will have resume() called before being returned.
+
+
On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), resumeData is broken
+on background URL session configurations. There’s an underlying bug in the resumeData generation logic where the
+data is written incorrectly and will always fail to resume the download. For more information about the bug and
+possible workarounds, please refer to the following Stack Overflow post:
The resume data. This is an opaque data blob produced by URLSessionDownloadTask
+ when a task is cancelled. See URLSession -downloadTask(withResumeData:) for
+ additional information.
+
+
+
+
+
+
+ destination
+
+
+
+
+
The closure used to determine the destination of the downloaded file. nil by default.
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.
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.
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.
The ServerTrustPolicy evaluates the server trust generally provided by an NSURLAuthenticationChallenge when
+connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust
+with a given set of criteria to determine whether the server trust is valid and the connection should be made.
+
+
Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other
+vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged
+to route all communication over an HTTPS connection with pinning enabled.
+
+
+
performDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to
+ validate the host provided by the challenge. Applications are encouraged to always
+ validate the host in production environments to guarantee the validity of the server’s
+ certificate chain.
+
performRevokedEvaluation: Uses the default and revoked server trust evaluations allowing you to control whether to
+ validate the host provided by the challenge as well as specify the revocation flags for
+ testing for revoked certificates. Apple platforms did not start testing for revoked
+ certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is
+ demonstrated in our TLS tests. Applications are encouraged to always validate the host
+ in production environments to guarantee the validity of the server’s certificate chain.
+
pinCertificates: Uses the pinned certificates to validate the server trust. The server trust is
+ considered valid if one of the pinned certificates match one of the server certificates.
+ By validating both the certificate chain and host, certificate pinning provides a very
+ secure form of server trust validation mitigating most, if not all, MITM attacks.
+ Applications are encouraged to always validate the host and require a valid certificate
+ chain in production environments.
+
pinPublicKeys: Uses the pinned public keys to validate the server trust. The server trust is considered
+ valid if one of the pinned public keys match one of the server certificate public keys.
+ By validating both the certificate chain and host, public key pinning provides a very
+ secure form of server trust validation mitigating most, if not all, MITM attacks.
+ Applications are encouraged to always validate the host and require a valid certificate
+ chain in production environments.
+
disableEvaluation: Disables all evaluation which in turn will always consider any server trust as valid.
+
customEvaluation: Uses the associated closure to evaluate the validity of the server trust.
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.
Returns whether the AFError is a response serialization error. When true, the failedStringEncoding and
+underlyingError properties will contain the associated values.
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.
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.
The ServerTrustPolicy evaluates the server trust generally provided by an NSURLAuthenticationChallenge when
+connecting to a server over a secure HTTPS connection. The policy configuration then evaluates the server trust
+with a given set of criteria to determine whether the server trust is valid and the connection should be made.
+
+
Using pinned certificates or public keys for evaluation helps prevent man-in-the-middle (MITM) attacks and other
+vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged
+to route all communication over an HTTPS connection with pinning enabled.
+
+
+
performDefaultEvaluation: Uses the default server trust evaluation while allowing you to control whether to
+ validate the host provided by the challenge. Applications are encouraged to always
+ validate the host in production environments to guarantee the validity of the server’s
+ certificate chain.
+
performRevokedEvaluation: Uses the default and revoked server trust evaluations allowing you to control whether to
+ validate the host provided by the challenge as well as specify the revocation flags for
+ testing for revoked certificates. Apple platforms did not start testing for revoked
+ certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is
+ demonstrated in our TLS tests. Applications are encouraged to always validate the host
+ in production environments to guarantee the validity of the server’s certificate chain.
+
pinCertificates: Uses the pinned certificates to validate the server trust. The server trust is
+ considered valid if one of the pinned certificates match one of the server certificates.
+ By validating both the certificate chain and host, certificate pinning provides a very
+ secure form of server trust validation mitigating most, if not all, MITM attacks.
+ Applications are encouraged to always validate the host and require a valid certificate
+ chain in production environments.
+
pinPublicKeys: Uses the pinned public keys to validate the server trust. The server trust is considered
+ valid if one of the pinned public keys match one of the server certificate public keys.
+ By validating both the certificate chain and host, public key pinning provides a very
+ secure form of server trust validation mitigating most, if not all, MITM attacks.
+ Applications are encouraged to always validate the host and require a valid certificate
+ chain in production environments.
+
disableEvaluation: Disables all evaluation which in turn will always consider any server trust as valid.
+
customEvaluation: Uses the associated closure to evaluate the validity of the server trust.
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.
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.
Creates a DownloadRequest using the default SessionManager from the resumeData produced from a
+previous request cancellation to retrieve the contents of the original request and save them to the destination.
+
+
If destination is not specified, the contents will remain in the temporary location determined by the
+underlying URL session.
+
+
On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), resumeData is broken
+on background URL session configurations. There’s an underlying bug in the resumeData generation logic where the
+data is written incorrectly and will always fail to resume the download. For more information about the bug and
+possible workarounds, please refer to the following Stack Overflow post:
The resume data. This is an opaque data blob produced by URLSessionDownloadTask
+ when a task is cancelled. See URLSession -downloadTask(withResumeData:) for additional
+ information.
+
+
+
+
+
+
+ destination
+
+
+
+
+
The closure used to determine the destination of the downloaded file. nil by default.
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.
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.
Determines whether the Request should be retried by calling the completion closure.
+
+
This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs
+to be retried. The one requirement is that the completion closure is called to ensure the request is properly
+cleaned up after.
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).
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.
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.
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.
A closure that takes the success value of the instance’s result.
+
+
+
+
+
+
+
+
Return Value
+
A DataResponse whose result wraps the value returned by the given closure. If this instance’s
+ result is a failure, returns a response wrapping the same failure.
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.
A closure that takes the success value of the instance’s result.
+
+
+
+
+
+
+
+
Return Value
+
A DownloadResponse whose result wraps the value returned by the given closure. If this instance’s
+ result is a failure, returns a response wrapping the same failure.
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.
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.
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.
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).
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.
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.
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.
In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the Alamofire Software Foundation to bring additional functionality to the Alamofire ecosystem.
+
+
+
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 - 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.
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
+
+
You can install Carthage with Homebrew using the following command:
+
$ brew update
+$ brew install carthage
+
+
+
To integrate Alamofire into your Xcode project using Carthage, specify it in your Cartfile:
+
github "Alamofire/Alamofire" ~> 4.4
+
+
+
Run carthage update to build the framework and drag the built Alamofire.framework into your Xcode project.
+
Swift Package Manager
+
+
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Alamofire does support its use on supported platforms.
+
+
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the dependencies value of your Package.swift.
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.
Handling the Response of a Request made in Alamofire involves chaining a response handler onto the Request.
+
Alamofire.request("https://httpbin.org/get").responseJSON{responsein
+ print("Request: \(String(describing:response.request))")// original url request
+ print("Response: \(String(describing:response.response))")// http url response
+ print("Result: \(response.result)")// response serialization result
+
+ ifletjson=response.result.value{
+ print("JSON: \(json)")// serialized json response
+ }
+
+ ifletdata=response.data,letutf8Text=String(data:data,encoding:.utf8){
+ print("Data: \(utf8Text)")// original server data as UTF8 string
+ }
+}
+
+
+
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 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 for doing it this way.
+
+
+
Alamofire contains five different response handlers by default including:
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..<500 and 500..<600 ranges do NOT automatically trigger an Error. Alamofire uses 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.
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.
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.
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.
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.
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.
Automatically validates status code within 200..<300 range, and that the Content-Type header of the response matches the Accept header of the request, if one is provided.
Response Caching is handled on the system framework level by 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 section.
+
+
HTTP Methods
+
+
The HTTPMethod enumeration lists the HTTP methods defined in RFC 7231 §4.3:
These values can be passed as the method argument to the Alamofire.request API:
+
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
+
letparameters: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
+
letparameters: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",method:.post,parameters:parameters)
+Alamofire.request("https://httpbin.org/post",method:.post,parameters:parameters,encoding:URLEncoding.default)
+Alamofire.request("https://httpbin.org/post",method:.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.
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.
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.
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 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.
+
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.
+
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.
+
+
+
If you need to customize these headers, a custom URLSessionConfiguration should be created, the defaultHTTPHeaders property updated and the configuration applied to a new SessionManager instance.
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.
+
+
+
This will only work on macOS as is. Other platforms don’t allow access to the filesystem outside of your app’s sandbox. To download files on other platforms, see the Download File Destination section.
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 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.
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.
+
+
+
IMPORTANT: On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), resumeData is broken on background URL session configurations. There’s an underlying bug in the resumeData generation logic where the data is written incorrectly and will always fail to resume the download. For more information about the bug and possible workarounds, please see this Stack Overflow post.
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 section.
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.
+
letfileURL=Bundle.main.url(forResource:"video",withExtension:"mov")
+
+Alamofire.upload(fileURL,to:"https://httpbin.org/post")
+ .uploadProgress{progressin// main queue by default
+ print("Upload Progress: \(progress.fractionCompleted)")
+ }
+ .downloadProgress{progressin// main queue by default
+ print("Download Progress: \(progress.fractionCompleted)")
+ }
+ .responseJSON{responsein
+ 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.
In iOS and tvOS 10 and macOS 10.12, Apple introduced the new 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.
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:
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
+
letrequest=Alamofire.request("https://httpbin.org/ip")
+
+print(request)
+// GET https://httpbin.org/ip (200)
+
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.
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:
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
vardefaultHeaders=Alamofire.SessionManager.defaultHTTPHeaders
+defaultHeaders["DNT"]="1 (Do Not Track Enabled)"
+
+letconfiguration=URLSessionConfiguration.default
+configuration.httpAdditionalHeaders=defaultHeaders
+
+letsessionManager=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:
+
/// Overrides default behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)`.
+openvarsessionDidReceiveChallenge:((URLSession,URLAuthenticationChallenge)->(URLSession.AuthChallengeDisposition,URLCredential?))?
+
+/// Overrides default behavior for URLSessionDelegate method `urlSessionDidFinishEvents(forBackgroundURLSession:)`.
+openvarsessionDidFinishEventsForBackgroundURLSession:((URLSession)->Void)?
+
+/// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)`.
+openvartaskWillPerformHTTPRedirection:((URLSession,URLSessionTask,HTTPURLResponse,URLRequest)->URLRequest?)?
+
+/// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)`.
+openvardataTaskWillCacheResponse:((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.
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.
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:
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.
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):
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.
Alamofire.request(Router.readUser("mattt"))// GET https://example.com/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.
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.
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
+
+
Alamofire provides built-in response serialization for data, strings, JSON, and property lists:
Those responses wrap deserialized values (Data, String, Any) or errors (network, validation errors), as well as meta-data (URL request, HTTP headers, status code, metrics, …).
+
+
You have several ways to customize all of those response elements:
Response mapping is the simplest way to produce customized responses. It transforms the value of a response, while preserving eventual errors and meta-data. For example, you can turn a json response DataResponse<Any> into a response that holds an application model, such as DataResponse<User>. You perform response mapping with the DataResponse.map method:
+
Alamofire.request("https://example.com/users/mattt").responseJSON{(response:DataResponse<Any>)in
+ letuserResponse=response.map{jsonin
+ // We assume an existing User(json: Any) initializer
+ returnUser(json:json)
+ }
+
+ // Process userResponse, of type DataResponse<User>:
+ ifletuser=userResponse.value{
+ print("User: { username: \(user.username), name: \(user.name) }")
+ }
+}
+
+
+
When the transformation may throw an error, use flatMap instead:
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:
+
enumBackendError:Error{
+ casenetwork(error:Error)// Capture any underlying Error from the URLSession API
+ casedataSerialization(error:Error)
+ casejsonSerialization(error:Error)
+ casexmlSerialization(error:Error)
+ caseobjectSerialization(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 might be implemented:
+
extensionDataRequest{
+ staticfuncxmlResponseSerializer()->DataResponseSerializer<ONOXMLDocument>{
+ returnDataResponseSerializer{request,response,data,errorin
+ // Pass through any underlying URLSession error to the .network case.
+ guarderror==nilelse{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.
+ letresult=Request.serializeResponseData(response:response,data:data,error:nil)
+
+ guardcaselet.success(validData)=resultelse{
+ return.failure(BackendError.dataSerialization(error:result.error!as!AFError))
+ }
+
+ do{
+ letxml=tryONOXMLDocument(data:validData)
+ return.success(xml)
+ }catch{
+ return.failure(BackendError.xmlSerialization(error:error))
+ }
+ }
+ }
+
+ @discardableResult
+ funcresponseXMLDocument(
+ queue:DispatchQueue?=nil,
+ completionHandler:@escaping(DataResponse<ONOXMLDocument>)->Void)
+ ->Self
+ {
+ returnresponse(
+ queue:queue,
+ responseSerializer:DataRequest.xmlResponseSerializer(),
+ completionHandler:completionHandler
+ )
+ }
+}
+
+
Generic Response Object Serialization
+
+
Generics can be used to provide automatic, type-safe response object serialization.
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.
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.
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.
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.
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.
Make sure to remember to retain the manager in the above example, or no status changes will be reported.
+Also, do not include the scheme in the host string or reachability won’t function correctly.
+
+
+
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.
The following radars have some effect on the current implementation of Alamofire.
+
+
+
rdar://21349340 - Compiler throwing warning due to toll-free bridging issue in test case
+
rdar://26761490 - 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, 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.
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 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.
+
+
+
License
+
+
Alamofire is released under the MIT license. See LICENSE for details.
The textual representation used when written to an output stream, which includes whether the result was a","parent_name":"DownloadResponse"},"Structs/DownloadResponse.html#/s:9Alamofire16DownloadResponseV16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The debug textual representation used when written to an output stream, which includes the URL request, the URL","parent_name":"DownloadResponse"},"Structs/DownloadResponse.html#/s:9Alamofire16DownloadResponseV3mapACyqd__Gqd__xclF":{"name":"map(_:)","abstract":"
Evaluates the given closure when the result of this DownloadResponse is a success, passing the unwrapped","parent_name":"DownloadResponse"},"Structs/DownloadResponse.html#/s:9Alamofire16DownloadResponseV7flatMapACyqd__Gqd__xKclF":{"name":"flatMap(_:)","abstract":"
Evaluates the given closure when the result of this DownloadResponse is a success, passing the unwrapped","parent_name":"DownloadResponse"},"Structs/DownloadResponse.html#/s:9Alamofire16DownloadResponseV7metricsSo21URLSessionTaskMetricsCSgv":{"name":"metrics","abstract":"
The task metrics containing the request / response statistics.
The textual representation used when written to an output stream, which includes whether the result was a","parent_name":"DataResponse"},"Structs/DataResponse.html#/s:9Alamofire12DataResponseV16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The debug textual representation used when written to an output stream, which includes the URL request, the URL","parent_name":"DataResponse"},"Structs/DataResponse.html#/s:9Alamofire12DataResponseV3mapACyqd__Gqd__xclF":{"name":"map(_:)","abstract":"
Evaluates the specified closure when the result of this DataResponse is a success, passing the unwrapped","parent_name":"DataResponse"},"Structs/DataResponse.html#/s:9Alamofire12DataResponseV7flatMapACyqd__Gqd__xKclF":{"name":"flatMap(_:)","abstract":"
Evaluates the given closure when the result of this DataResponse is a success, passing the unwrapped result","parent_name":"DataResponse"},"Structs/DataResponse.html#/s:9Alamofire12DataResponseV7metricsSo21URLSessionTaskMetricsCSgv":{"name":"metrics","abstract":"
The task metrics containing the request / response statistics.
Defines whether the url-encoded query string is applied to the existing query string or HTTP body of the","parent_name":"URLEncoding"},"Structs/URLEncoding.html#/s:9Alamofire11URLEncodingV7defaultACvZ":{"name":"default","abstract":"
The textual representation used when written to an output stream, which includes the latency, the request","parent_name":"Timeline"},"Structs/Timeline.html#/s:9Alamofire8TimelineV16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The textual representation used when written to an output stream, which includes the request start time, the","parent_name":"Timeline"},"Structs/Timeline.html":{"name":"Timeline","abstract":"
Responsible for computing the timing metrics for the complete lifecycle of a Request.
Creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP"},"Structs/JSONEncoding.html":{"name":"JSONEncoding","abstract":"
Uses JSONSerialization to create a JSON representation of the parameters object, which is set as the body of the"},"Structs/PropertyListEncoding.html":{"name":"PropertyListEncoding","abstract":"
Uses PropertyListSerialization to create a plist representation of the parameters object, according to the"},"Structs/DataResponseSerializer.html":{"name":"DataResponseSerializer","abstract":"
A generic DataResponseSerializerType used to serialize a request, response, and data into a serialized object.
A type that determines whether a request should be retried after being executed by the specified session manager"},"Protocols/DataResponseSerializerProtocol.html":{"name":"DataResponseSerializerProtocol","abstract":"
The type in which all data response serializers must conform to in order to serialize a response.
Types adopting the URLConvertible protocol can be used to construct URLs, which are then used to construct"},"Protocols/URLRequestConvertible.html":{"name":"URLRequestConvertible","abstract":"
Types adopting the URLRequestConvertible protocol can be used to construct URL requests.
Creates a DataRequest using the default SessionManager to retrieve the contents of the specified url,"},"Functions.html#/s:9Alamofire7requestAA11DataRequestCAA21URLRequestConvertible_pF":{"name":"request(_:)","abstract":"
Creates a DataRequest using the default SessionManager to retrieve the contents of a URL based on the"},"Functions.html#/s:9Alamofire8downloadAA15DownloadRequestCAA14URLConvertible_p_AA10HTTPMethodO6methods10DictionaryVySSypGSg10parametersAA17ParameterEncoding_p8encodingAJyS2SGSg7headers10Foundation3URLV011destinationO0_AD0C7OptionsV7optionstAU_So15HTTPURLResponseCtcSg2totF":{"name":"download(_:method:parameters:encoding:headers:to:)","abstract":"
Creates a DownloadRequest using the default SessionManager to retrieve the contents of the specified url,"},"Functions.html#/s:9Alamofire8downloadAA15DownloadRequestCAA21URLRequestConvertible_p_10Foundation3URLV011destinationH0_AD0C7OptionsV7optionstAH_So15HTTPURLResponseCtcSg2totF":{"name":"download(_:to:)","abstract":"
Creates a DownloadRequest using the default SessionManager to retrieve the contents of a URL based on the"},"Functions.html#/s:9Alamofire8downloadAA15DownloadRequestC10Foundation4DataV12resumingWith_AE3URLV011destinationI0_AD0C7OptionsV7optionstAJ_So15HTTPURLResponseCtcSg2totF":{"name":"download(resumingWith:to:)","abstract":"
Creates a DownloadRequest using the default SessionManager from the resumeData produced from a"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestC10Foundation3URLV_AA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headerstF":{"name":"upload(_:to:method:headers:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified url, method and headers"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestC10Foundation3URLV_AA21URLRequestConvertible_p4withtF":{"name":"upload(_:with:)","abstract":"
Creates a UploadRequest using the default SessionManager from the specified urlRequest for"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestC10Foundation4DataV_AA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headerstF":{"name":"upload(_:to:method:headers:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified url, method and headers"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestC10Foundation4DataV_AA21URLRequestConvertible_p4withtF":{"name":"upload(_:with:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified urlRequest for"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestCSo11InputStreamC_AA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headerstF":{"name":"upload(_:to:method:headers:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified url, method and headers"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestCSo11InputStreamC_AA21URLRequestConvertible_p4withtF":{"name":"upload(_:with:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified urlRequest for"},"Functions.html#/s:9Alamofire6uploadyyAA17MultipartFormDataCc09multipartdE0_s6UInt64V14usingThresholdAA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headersyAA14SessionManagerC0cdE14EncodingResultOcSg18encodingCompletiontF":{"name":"upload(multipartFormData:usingThreshold:to:method:headers:encodingCompletion:)","abstract":"
Encodes multipartFormData using encodingMemoryThreshold with the default SessionManager and calls"},"Functions.html#/s:9Alamofire6uploadyyAA17MultipartFormDataCc09multipartdE0_s6UInt64V14usingThresholdAA21URLRequestConvertible_p4withyAA14SessionManagerC0cdE14EncodingResultOcSg18encodingCompletiontF":{"name":"upload(multipartFormData:usingThreshold:with:encodingCompletion:)","abstract":"
Encodes multipartFormData using encodingMemoryThreshold and the default SessionManager and"},"Functions.html#/s:9Alamofire6streamAA13StreamRequestCSS12withHostName_Si4porttF":{"name":"stream(withHostName:port:)","abstract":"
Creates a StreamRequest using the default SessionManager for bidirectional streaming with the hostname"},"Functions.html#/s:9Alamofire6streamAA13StreamRequestCSo10NetServiceC4with_tF":{"name":"stream(with:)","abstract":"
The textual representation used when written to an output stream, which includes whether the result was a","parent_name":"Result"},"Enums/Result.html#/s:9Alamofire6ResultO16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The debug textual representation used when written to an output stream, which includes whether the result was a","parent_name":"Result"},"Enums/Result.html#/s:9Alamofire6ResultOACyxGxyKc5value_tcfc":{"name":"init(value:)","abstract":"
Creates a Result instance from the result of a closure.
Returns whether the AFError is a parameter encoding error. When true, the underlyingError property will","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO24isMultipartEncodingErrorSbv":{"name":"isMultipartEncodingError","abstract":"
Returns whether the AFError is a multipart encoding error. When true, the url and underlyingError properties","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO25isResponseValidationErrorSbv":{"name":"isResponseValidationError","abstract":"
Returns whether the AFError is a response validation error. When true, the acceptableContentTypes,","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO28isResponseSerializationErrorSbv":{"name":"isResponseSerializationError","abstract":"
Returns whether the AFError is a response serialization error. When true, the failedStringEncoding and","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO14urlConvertibleAA14URLConvertible_pSgv":{"name":"urlConvertible","abstract":"
The Error returned by a system framework associated with a .parameterEncodingFailed,","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO22acceptableContentTypesSaySSGSgv":{"name":"acceptableContentTypes","abstract":"
AFError is the error type returned by Alamofire. It encompasses a few different types of errors, each with"},"Enums/ServerTrustPolicy.html":{"name":"ServerTrustPolicy","abstract":"
The ServerTrustPolicy evaluates the server trust generally provided by an NSURLAuthenticationChallenge when"},"Enums/Result.html":{"name":"Result","abstract":"
Used to represent whether a request was successful or encountered an error.
A closure executed when the network reachability status changes. The closure takes a single argument: the","parent_name":"NetworkReachabilityManager"},"Classes/NetworkReachabilityManager.html#/s:9Alamofire26NetworkReachabilityManagerC11isReachableSbv":{"name":"isReachable","abstract":"
Defines whether the MultipartFormData encoding was successful and contains result of the encoding as","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC7defaultACvZ":{"name":"default","abstract":"
A default instance of SessionManager, used by top-level Alamofire request methods, and suitable for use","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC18defaultHTTPHeaderss10DictionaryVyS2SGvZ":{"name":"defaultHTTPHeaders","abstract":"
Creates default values for the Accept-Encoding, Accept-Language and User-Agent headers.
The background completion handler closure provided by the UIApplicationDelegate","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerCACSo23URLSessionConfigurationC13configuration_AA0B8DelegateC8delegateAA017ServerTrustPolicyC0CSg06serverjkC0tcfc":{"name":"init(configuration:delegate:serverTrustPolicyManager:)","abstract":"
Creates an instance with the specified configuration, delegate and serverTrustPolicyManager.
Creates a DataRequest to retrieve the contents of the specified url, method, parameters, encoding","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC7requestAA11DataRequestCAA21URLRequestConvertible_pF":{"name":"request(_:)","abstract":"
Creates a DataRequest to retrieve the contents of a URL based on the specified urlRequest.
Creates a DownloadRequest to retrieve the contents the specified url, method, parameters, encoding,","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC8downloadAA15DownloadRequestCAA21URLRequestConvertible_p_10Foundation3URLV011destinationJ0_AF0E7OptionsV7optionstAJ_So15HTTPURLResponseCtcSg2totF":{"name":"download(_:to:)","abstract":"
Creates a DownloadRequest to retrieve the contents of a URL based on the specified urlRequest and save","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC8downloadAA15DownloadRequestC10Foundation4DataV12resumingWith_AG3URLV011destinationK0_AF0E7OptionsV7optionstAL_So15HTTPURLResponseCtcSg2totF":{"name":"download(resumingWith:to:)","abstract":"
Creates a DownloadRequest from the resumeData produced from a previous request cancellation to retrieve","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC6uploadAA13UploadRequestC10Foundation3URLV_AA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headerstF":{"name":"upload(_:to:method:headers:)","abstract":"
Creates an UploadRequest from the specified url, method and headers for uploading the file.
Encodes multipartFormData using encodingMemoryThreshold and calls encodingCompletion with new","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC6uploadyyAA17MultipartFormDataCc09multipartfG0_s6UInt64V14usingThresholdAA21URLRequestConvertible_p4withyAC0efG14EncodingResultOcSg18encodingCompletiontF":{"name":"upload(multipartFormData:usingThreshold:with:encodingCompletion:)","abstract":"
Encodes multipartFormData using encodingMemoryThreshold and calls encodingCompletion with new","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC6streamAA13StreamRequestCSS12withHostName_Si4porttF":{"name":"stream(withHostName:port:)","abstract":"
Creates a StreamRequest for bidirectional streaming using the hostname and port.
Sets a closure to be called periodically during the lifecycle of the UploadRequest as data is sent to","parent_name":"UploadRequest"},"Classes/DownloadRequest/DownloadOptions.html#/s:9Alamofire15DownloadRequestC0B7OptionsV8rawValueSuv":{"name":"rawValue","abstract":"
Returns the raw bitmask value of the option and satisfies the RawRepresentable protocol.
A collection of options to be executed prior to moving a downloaded file from the temporary URL to the","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC0B15FileDestinationa":{"name":"DownloadFileDestination","abstract":"
A closure executed once a download request has successfully completed in order to determine where to move the","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC7request10Foundation10URLRequestVSgv":{"name":"request","abstract":"
Creates a download file destination closure which uses the default file manager to move the temporary file to a","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC8responseACXDSo13DispatchQueueCSg5queue_yAA07DefaultB8ResponseVc17completionHandlertF":{"name":"response(queue:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns a result string type initialized from the response data with","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC14responseStringACXDSo13DispatchQueueCSg5queue_SS10FoundationE8EncodingVSg8encodingyAA0B8ResponseVySSGc17completionHandlertF":{"name":"responseString(queue:encoding:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns a JSON object result type constructed from the response data using","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC12responseJSONACXDSo13DispatchQueueCSg5queue_So17JSONSerializationC14ReadingOptionsV7optionsyAA0B8ResponseVyypGc17completionHandlertF":{"name":"responseJSON(queue:options:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns an object constructed from the response data using","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC20responsePropertyListACXDSo13DispatchQueueCSg5queue_So0eF13SerializationC17MutabilityOptionsV7optionsyAA0B8ResponseVyypGc17completionHandlertF":{"name":"responsePropertyList(queue:options:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC8validateACXDAA0C0C16ValidationResultO10Foundation10URLRequestVSg_So15HTTPURLResponseCAI3URLVSgAQtcF":{"name":"validate(_:)","abstract":"
Validates the request, using the specified closure.
Validates that the response has a status code in the default acceptable range of 200…299, and that the content","parent_name":"DownloadRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC7request10Foundation10URLRequestVSgv":{"name":"request","abstract":"
Creates a response serializer that returns a result string type initialized from the response data with","parent_name":"DataRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC14responseStringACXDSo13DispatchQueueCSg5queue_SS10FoundationE8EncodingVSg8encodingyAA0B8ResponseVySSGc17completionHandlertF":{"name":"responseString(queue:encoding:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns a JSON object result type constructed from the response data using","parent_name":"DataRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC12responseJSONACXDSo13DispatchQueueCSg5queue_So17JSONSerializationC14ReadingOptionsV7optionsyAA0B8ResponseVyypGc17completionHandlertF":{"name":"responseJSON(queue:options:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns an object constructed from the response data using","parent_name":"DataRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC20responsePropertyListACXDSo13DispatchQueueCSg5queue_So0eF13SerializationC17MutabilityOptionsV7optionsyAA0B8ResponseVyypGc17completionHandlertF":{"name":"responsePropertyList(queue:options:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the","parent_name":"DataRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC8validateACXDAA0C0C16ValidationResultO10Foundation10URLRequestVSg_So15HTTPURLResponseCAI0B0VSgtcF":{"name":"validate(_:)","abstract":"
Validates the request, using the specified closure.
Validates that the response has a status code in the default acceptable range of 200…299, and that the content","parent_name":"DataRequest"},"Classes/Request/ValidationResult.html#/s:9Alamofire7RequestC16ValidationResultO7successA2EmF":{"name":"success","abstract":"
The textual representation used when written to an output stream, which includes the HTTP method and URL, as","parent_name":"Request"},"Classes/Request.html#/s:9Alamofire7RequestC16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The textual representation used when written to an output stream, in the form of a cURL command.
Returns a JSON object contained in a result type constructed from the response data using JSONSerialization","parent_name":"Request"},"Classes/Request.html#/s:9Alamofire7RequestC29serializeResponsePropertyListAA6ResultOyypGSo0eF13SerializationC17MutabilityOptionsV7options_So15HTTPURLResponseCSg8response10Foundation4DataVSg4datas5Error_pSg5errortFZ":{"name":"serializeResponsePropertyList(options:response:data:error:)","abstract":"
Returns a plist object contained in a result type constructed from the response data using","parent_name":"Request"},"Classes/Request/ValidationResult.html":{"name":"ValidationResult","abstract":"
Used to represent whether validation was successful or encountered an error resulting in a failure.
Overrides all behavior for URLSessionTaskDelegate method urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC23taskDidReceiveChallengeSo10URLSessionC04AuthG11DispositionO_So13URLCredentialCSgtAF_So0H4TaskCSo017URLAuthenticationG0CtcSgv":{"name":"taskDidReceiveChallenge","abstract":"
Overrides all behavior for URLSessionTaskDelegate method urlSession(_:task:didReceive:completionHandler:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC21taskNeedNewBodyStreamSo05InputH0CSgSo10URLSessionC_So0J4TaskCtcSgv":{"name":"taskNeedNewBodyStream","abstract":"
Overrides all behavior for URLSessionTaskDelegate method urlSession(_:task:needNewBodyStream:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC19taskDidSendBodyDataySo10URLSessionC_So0I4TaskCs5Int64VA2JtcSgv":{"name":"taskDidSendBodyData","abstract":"
Overrides all behavior for URLSessionDataDelegate method urlSession(_:dataTask:didReceive:completionHandler:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC025dataTaskDidBecomeDownloadE0ySo10URLSessionC_So0i4DataE0CSo0ihE0CtcSgv":{"name":"dataTaskDidBecomeDownloadTask","abstract":"
Overrides all behavior for URLSessionDataDelegate method urlSession(_:dataTask:willCacheResponse:completionHandler:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC37downloadTaskDidFinishDownloadingToURLySo10URLSessionC_So0k8DownloadE0C10Foundation0J0VtcSgv":{"name":"downloadTaskDidFinishDownloadingToURL","abstract":"
Returns a Bool indicating whether the SessionDelegate implements or inherits a method that can respond","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:didBecomeInvalidWithError:":{"name":"urlSession(_:didBecomeInvalidWithError:)","abstract":"
Tells the delegate that the session has been invalidated.
Requests credentials from the delegate in response to a session-level authentication request from the","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSessionDidFinishEventsForBackgroundURLSession:":{"name":"urlSessionDidFinishEvents(forBackgroundURLSession:)","abstract":"
Tells the delegate that all messages enqueued for a session have been delivered.
Responsible for sending a request and receiving the response and associated data from the server, as well as"},"Classes/DataRequest.html":{"name":"DataRequest","abstract":"
Specific type of Request that manages an underlying URLSessionDataTask.
Constructs multipart/form-data for uploads within an HTTP or HTTPS body. There are currently two ways to encode"},"Classes/ServerTrustPolicyManager.html":{"name":"ServerTrustPolicyManager","abstract":"
Responsible for managing the mapping of ServerTrustPolicy objects to a given host.
The NetworkReachabilityManager class listens for reachability changes of hosts and addresses for both WWAN and"},"Classes/TaskDelegate.html":{"name":"TaskDelegate","abstract":"
The task delegate is responsible for handling all delegate callbacks for the underlying task as well as"},"Classes.html":{"name":"Classes","abstract":"
In order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the Alamofire Software Foundation to bring additional functionality to the Alamofire ecosystem.
+
+
+
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 - 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.
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
+
+
You can install Carthage with Homebrew using the following command:
+
$ brew update
+$ brew install carthage
+
+
+
To integrate Alamofire into your Xcode project using Carthage, specify it in your Cartfile:
+
github "Alamofire/Alamofire" ~> 4.4
+
+
+
Run carthage update to build the framework and drag the built Alamofire.framework into your Xcode project.
+
Swift Package Manager
+
+
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler. It is in early development, but Alamofire does support its use on supported platforms.
+
+
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the dependencies value of your Package.swift.
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.
Handling the Response of a Request made in Alamofire involves chaining a response handler onto the Request.
+
Alamofire.request("https://httpbin.org/get").responseJSON{responsein
+ print("Request: \(String(describing:response.request))")// original url request
+ print("Response: \(String(describing:response.response))")// http url response
+ print("Result: \(response.result)")// response serialization result
+
+ ifletjson=response.result.value{
+ print("JSON: \(json)")// serialized json response
+ }
+
+ ifletdata=response.data,letutf8Text=String(data:data,encoding:.utf8){
+ print("Data: \(utf8Text)")// original server data as UTF8 string
+ }
+}
+
+
+
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 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 for doing it this way.
+
+
+
Alamofire contains five different response handlers by default including:
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..<500 and 500..<600 ranges do NOT automatically trigger an Error. Alamofire uses 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.
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.
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.
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.
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.
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.
Automatically validates status code within 200..<300 range, and that the Content-Type header of the response matches the Accept header of the request, if one is provided.
Response Caching is handled on the system framework level by 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 section.
+
+
HTTP Methods
+
+
The HTTPMethod enumeration lists the HTTP methods defined in RFC 7231 §4.3:
These values can be passed as the method argument to the Alamofire.request API:
+
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
+
letparameters: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
+
letparameters: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",method:.post,parameters:parameters)
+Alamofire.request("https://httpbin.org/post",method:.post,parameters:parameters,encoding:URLEncoding.default)
+Alamofire.request("https://httpbin.org/post",method:.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.
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.
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.
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 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.
+
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.
+
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.
+
+
+
If you need to customize these headers, a custom URLSessionConfiguration should be created, the defaultHTTPHeaders property updated and the configuration applied to a new SessionManager instance.
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.
+
+
+
This will only work on macOS as is. Other platforms don’t allow access to the filesystem outside of your app’s sandbox. To download files on other platforms, see the Download File Destination section.
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 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.
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.
+
+
+
IMPORTANT: On the latest release of all the Apple platforms (iOS 10, macOS 10.12, tvOS 10, watchOS 3), resumeData is broken on background URL session configurations. There’s an underlying bug in the resumeData generation logic where the data is written incorrectly and will always fail to resume the download. For more information about the bug and possible workarounds, please see this Stack Overflow post.
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 section.
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.
+
letfileURL=Bundle.main.url(forResource:"video",withExtension:"mov")
+
+Alamofire.upload(fileURL,to:"https://httpbin.org/post")
+ .uploadProgress{progressin// main queue by default
+ print("Upload Progress: \(progress.fractionCompleted)")
+ }
+ .downloadProgress{progressin// main queue by default
+ print("Download Progress: \(progress.fractionCompleted)")
+ }
+ .responseJSON{responsein
+ 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.
In iOS and tvOS 10 and macOS 10.12, Apple introduced the new 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.
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:
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
+
letrequest=Alamofire.request("https://httpbin.org/ip")
+
+print(request)
+// GET https://httpbin.org/ip (200)
+
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.
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:
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
vardefaultHeaders=Alamofire.SessionManager.defaultHTTPHeaders
+defaultHeaders["DNT"]="1 (Do Not Track Enabled)"
+
+letconfiguration=URLSessionConfiguration.default
+configuration.httpAdditionalHeaders=defaultHeaders
+
+letsessionManager=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:
+
/// Overrides default behavior for URLSessionDelegate method `urlSession(_:didReceive:completionHandler:)`.
+openvarsessionDidReceiveChallenge:((URLSession,URLAuthenticationChallenge)->(URLSession.AuthChallengeDisposition,URLCredential?))?
+
+/// Overrides default behavior for URLSessionDelegate method `urlSessionDidFinishEvents(forBackgroundURLSession:)`.
+openvarsessionDidFinishEventsForBackgroundURLSession:((URLSession)->Void)?
+
+/// Overrides default behavior for URLSessionTaskDelegate method `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)`.
+openvartaskWillPerformHTTPRedirection:((URLSession,URLSessionTask,HTTPURLResponse,URLRequest)->URLRequest?)?
+
+/// Overrides default behavior for URLSessionDataDelegate method `urlSession(_:dataTask:willCacheResponse:completionHandler:)`.
+openvardataTaskWillCacheResponse:((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.
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.
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:
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.
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):
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.
Alamofire.request(Router.readUser("mattt"))// GET https://example.com/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.
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.
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
+
+
Alamofire provides built-in response serialization for data, strings, JSON, and property lists:
Those responses wrap deserialized values (Data, String, Any) or errors (network, validation errors), as well as meta-data (URL request, HTTP headers, status code, metrics, …).
+
+
You have several ways to customize all of those response elements:
Response mapping is the simplest way to produce customized responses. It transforms the value of a response, while preserving eventual errors and meta-data. For example, you can turn a json response DataResponse<Any> into a response that holds an application model, such as DataResponse<User>. You perform response mapping with the DataResponse.map method:
+
Alamofire.request("https://example.com/users/mattt").responseJSON{(response:DataResponse<Any>)in
+ letuserResponse=response.map{jsonin
+ // We assume an existing User(json: Any) initializer
+ returnUser(json:json)
+ }
+
+ // Process userResponse, of type DataResponse<User>:
+ ifletuser=userResponse.value{
+ print("User: { username: \(user.username), name: \(user.name) }")
+ }
+}
+
+
+
When the transformation may throw an error, use flatMap instead:
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:
+
enumBackendError:Error{
+ casenetwork(error:Error)// Capture any underlying Error from the URLSession API
+ casedataSerialization(error:Error)
+ casejsonSerialization(error:Error)
+ casexmlSerialization(error:Error)
+ caseobjectSerialization(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 might be implemented:
+
extensionDataRequest{
+ staticfuncxmlResponseSerializer()->DataResponseSerializer<ONOXMLDocument>{
+ returnDataResponseSerializer{request,response,data,errorin
+ // Pass through any underlying URLSession error to the .network case.
+ guarderror==nilelse{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.
+ letresult=Request.serializeResponseData(response:response,data:data,error:nil)
+
+ guardcaselet.success(validData)=resultelse{
+ return.failure(BackendError.dataSerialization(error:result.error!as!AFError))
+ }
+
+ do{
+ letxml=tryONOXMLDocument(data:validData)
+ return.success(xml)
+ }catch{
+ return.failure(BackendError.xmlSerialization(error:error))
+ }
+ }
+ }
+
+ @discardableResult
+ funcresponseXMLDocument(
+ queue:DispatchQueue?=nil,
+ completionHandler:@escaping(DataResponse<ONOXMLDocument>)->Void)
+ ->Self
+ {
+ returnresponse(
+ queue:queue,
+ responseSerializer:DataRequest.xmlResponseSerializer(),
+ completionHandler:completionHandler
+ )
+ }
+}
+
+
Generic Response Object Serialization
+
+
Generics can be used to provide automatic, type-safe response object serialization.
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.
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.
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.
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.
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.
Make sure to remember to retain the manager in the above example, or no status changes will be reported.
+Also, do not include the scheme in the host string or reachability won’t function correctly.
+
+
+
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.
The following radars have some effect on the current implementation of Alamofire.
+
+
+
rdar://21349340 - Compiler throwing warning due to toll-free bridging issue in test case
+
rdar://26761490 - 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, 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.
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 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.
+
+
+
License
+
+
Alamofire is released under the MIT license. See LICENSE for details.
The textual representation used when written to an output stream, which includes whether the result was a","parent_name":"DownloadResponse"},"Structs/DownloadResponse.html#/s:9Alamofire16DownloadResponseV16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The debug textual representation used when written to an output stream, which includes the URL request, the URL","parent_name":"DownloadResponse"},"Structs/DownloadResponse.html#/s:9Alamofire16DownloadResponseV3mapACyqd__Gqd__xclF":{"name":"map(_:)","abstract":"
Evaluates the given closure when the result of this DownloadResponse is a success, passing the unwrapped","parent_name":"DownloadResponse"},"Structs/DownloadResponse.html#/s:9Alamofire16DownloadResponseV7flatMapACyqd__Gqd__xKclF":{"name":"flatMap(_:)","abstract":"
Evaluates the given closure when the result of this DownloadResponse is a success, passing the unwrapped","parent_name":"DownloadResponse"},"Structs/DownloadResponse.html#/s:9Alamofire16DownloadResponseV7metricsSo21URLSessionTaskMetricsCSgv":{"name":"metrics","abstract":"
The task metrics containing the request / response statistics.
The textual representation used when written to an output stream, which includes whether the result was a","parent_name":"DataResponse"},"Structs/DataResponse.html#/s:9Alamofire12DataResponseV16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The debug textual representation used when written to an output stream, which includes the URL request, the URL","parent_name":"DataResponse"},"Structs/DataResponse.html#/s:9Alamofire12DataResponseV3mapACyqd__Gqd__xclF":{"name":"map(_:)","abstract":"
Evaluates the specified closure when the result of this DataResponse is a success, passing the unwrapped","parent_name":"DataResponse"},"Structs/DataResponse.html#/s:9Alamofire12DataResponseV7flatMapACyqd__Gqd__xKclF":{"name":"flatMap(_:)","abstract":"
Evaluates the given closure when the result of this DataResponse is a success, passing the unwrapped result","parent_name":"DataResponse"},"Structs/DataResponse.html#/s:9Alamofire12DataResponseV7metricsSo21URLSessionTaskMetricsCSgv":{"name":"metrics","abstract":"
The task metrics containing the request / response statistics.
Defines whether the url-encoded query string is applied to the existing query string or HTTP body of the","parent_name":"URLEncoding"},"Structs/URLEncoding.html#/s:9Alamofire11URLEncodingV7defaultACvZ":{"name":"default","abstract":"
The textual representation used when written to an output stream, which includes the latency, the request","parent_name":"Timeline"},"Structs/Timeline.html#/s:9Alamofire8TimelineV16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The textual representation used when written to an output stream, which includes the request start time, the","parent_name":"Timeline"},"Structs/Timeline.html":{"name":"Timeline","abstract":"
Responsible for computing the timing metrics for the complete lifecycle of a Request.
Creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP"},"Structs/JSONEncoding.html":{"name":"JSONEncoding","abstract":"
Uses JSONSerialization to create a JSON representation of the parameters object, which is set as the body of the"},"Structs/PropertyListEncoding.html":{"name":"PropertyListEncoding","abstract":"
Uses PropertyListSerialization to create a plist representation of the parameters object, according to the"},"Structs/DataResponseSerializer.html":{"name":"DataResponseSerializer","abstract":"
A generic DataResponseSerializerType used to serialize a request, response, and data into a serialized object.
A type that determines whether a request should be retried after being executed by the specified session manager"},"Protocols/DataResponseSerializerProtocol.html":{"name":"DataResponseSerializerProtocol","abstract":"
The type in which all data response serializers must conform to in order to serialize a response.
Types adopting the URLConvertible protocol can be used to construct URLs, which are then used to construct"},"Protocols/URLRequestConvertible.html":{"name":"URLRequestConvertible","abstract":"
Types adopting the URLRequestConvertible protocol can be used to construct URL requests.
Creates a DataRequest using the default SessionManager to retrieve the contents of the specified url,"},"Functions.html#/s:9Alamofire7requestAA11DataRequestCAA21URLRequestConvertible_pF":{"name":"request(_:)","abstract":"
Creates a DataRequest using the default SessionManager to retrieve the contents of a URL based on the"},"Functions.html#/s:9Alamofire8downloadAA15DownloadRequestCAA14URLConvertible_p_AA10HTTPMethodO6methods10DictionaryVySSypGSg10parametersAA17ParameterEncoding_p8encodingAJyS2SGSg7headers10Foundation3URLV011destinationO0_AD0C7OptionsV7optionstAU_So15HTTPURLResponseCtcSg2totF":{"name":"download(_:method:parameters:encoding:headers:to:)","abstract":"
Creates a DownloadRequest using the default SessionManager to retrieve the contents of the specified url,"},"Functions.html#/s:9Alamofire8downloadAA15DownloadRequestCAA21URLRequestConvertible_p_10Foundation3URLV011destinationH0_AD0C7OptionsV7optionstAH_So15HTTPURLResponseCtcSg2totF":{"name":"download(_:to:)","abstract":"
Creates a DownloadRequest using the default SessionManager to retrieve the contents of a URL based on the"},"Functions.html#/s:9Alamofire8downloadAA15DownloadRequestC10Foundation4DataV12resumingWith_AE3URLV011destinationI0_AD0C7OptionsV7optionstAJ_So15HTTPURLResponseCtcSg2totF":{"name":"download(resumingWith:to:)","abstract":"
Creates a DownloadRequest using the default SessionManager from the resumeData produced from a"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestC10Foundation3URLV_AA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headerstF":{"name":"upload(_:to:method:headers:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified url, method and headers"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestC10Foundation3URLV_AA21URLRequestConvertible_p4withtF":{"name":"upload(_:with:)","abstract":"
Creates a UploadRequest using the default SessionManager from the specified urlRequest for"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestC10Foundation4DataV_AA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headerstF":{"name":"upload(_:to:method:headers:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified url, method and headers"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestC10Foundation4DataV_AA21URLRequestConvertible_p4withtF":{"name":"upload(_:with:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified urlRequest for"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestCSo11InputStreamC_AA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headerstF":{"name":"upload(_:to:method:headers:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified url, method and headers"},"Functions.html#/s:9Alamofire6uploadAA13UploadRequestCSo11InputStreamC_AA21URLRequestConvertible_p4withtF":{"name":"upload(_:with:)","abstract":"
Creates an UploadRequest using the default SessionManager from the specified urlRequest for"},"Functions.html#/s:9Alamofire6uploadyyAA17MultipartFormDataCc09multipartdE0_s6UInt64V14usingThresholdAA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headersyAA14SessionManagerC0cdE14EncodingResultOcSg18encodingCompletiontF":{"name":"upload(multipartFormData:usingThreshold:to:method:headers:encodingCompletion:)","abstract":"
Encodes multipartFormData using encodingMemoryThreshold with the default SessionManager and calls"},"Functions.html#/s:9Alamofire6uploadyyAA17MultipartFormDataCc09multipartdE0_s6UInt64V14usingThresholdAA21URLRequestConvertible_p4withyAA14SessionManagerC0cdE14EncodingResultOcSg18encodingCompletiontF":{"name":"upload(multipartFormData:usingThreshold:with:encodingCompletion:)","abstract":"
Encodes multipartFormData using encodingMemoryThreshold and the default SessionManager and"},"Functions.html#/s:9Alamofire6streamAA13StreamRequestCSS12withHostName_Si4porttF":{"name":"stream(withHostName:port:)","abstract":"
Creates a StreamRequest using the default SessionManager for bidirectional streaming with the hostname"},"Functions.html#/s:9Alamofire6streamAA13StreamRequestCSo10NetServiceC4with_tF":{"name":"stream(with:)","abstract":"
The textual representation used when written to an output stream, which includes whether the result was a","parent_name":"Result"},"Enums/Result.html#/s:9Alamofire6ResultO16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The debug textual representation used when written to an output stream, which includes whether the result was a","parent_name":"Result"},"Enums/Result.html#/s:9Alamofire6ResultOACyxGxyKc5value_tcfc":{"name":"init(value:)","abstract":"
Creates a Result instance from the result of a closure.
Returns whether the AFError is a parameter encoding error. When true, the underlyingError property will","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO24isMultipartEncodingErrorSbv":{"name":"isMultipartEncodingError","abstract":"
Returns whether the AFError is a multipart encoding error. When true, the url and underlyingError properties","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO25isResponseValidationErrorSbv":{"name":"isResponseValidationError","abstract":"
Returns whether the AFError is a response validation error. When true, the acceptableContentTypes,","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO28isResponseSerializationErrorSbv":{"name":"isResponseSerializationError","abstract":"
Returns whether the AFError is a response serialization error. When true, the failedStringEncoding and","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO14urlConvertibleAA14URLConvertible_pSgv":{"name":"urlConvertible","abstract":"
The Error returned by a system framework associated with a .parameterEncodingFailed,","parent_name":"AFError"},"Enums/AFError.html#/s:9Alamofire7AFErrorO22acceptableContentTypesSaySSGSgv":{"name":"acceptableContentTypes","abstract":"
AFError is the error type returned by Alamofire. It encompasses a few different types of errors, each with"},"Enums/ServerTrustPolicy.html":{"name":"ServerTrustPolicy","abstract":"
The ServerTrustPolicy evaluates the server trust generally provided by an NSURLAuthenticationChallenge when"},"Enums/Result.html":{"name":"Result","abstract":"
Used to represent whether a request was successful or encountered an error.
A closure executed when the network reachability status changes. The closure takes a single argument: the","parent_name":"NetworkReachabilityManager"},"Classes/NetworkReachabilityManager.html#/s:9Alamofire26NetworkReachabilityManagerC11isReachableSbv":{"name":"isReachable","abstract":"
Defines whether the MultipartFormData encoding was successful and contains result of the encoding as","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC7defaultACvZ":{"name":"default","abstract":"
A default instance of SessionManager, used by top-level Alamofire request methods, and suitable for use","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC18defaultHTTPHeaderss10DictionaryVyS2SGvZ":{"name":"defaultHTTPHeaders","abstract":"
Creates default values for the Accept-Encoding, Accept-Language and User-Agent headers.
The background completion handler closure provided by the UIApplicationDelegate","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerCACSo23URLSessionConfigurationC13configuration_AA0B8DelegateC8delegateAA017ServerTrustPolicyC0CSg06serverjkC0tcfc":{"name":"init(configuration:delegate:serverTrustPolicyManager:)","abstract":"
Creates an instance with the specified configuration, delegate and serverTrustPolicyManager.
Creates a DataRequest to retrieve the contents of the specified url, method, parameters, encoding","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC7requestAA11DataRequestCAA21URLRequestConvertible_pF":{"name":"request(_:)","abstract":"
Creates a DataRequest to retrieve the contents of a URL based on the specified urlRequest.
Creates a DownloadRequest to retrieve the contents the specified url, method, parameters, encoding,","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC8downloadAA15DownloadRequestCAA21URLRequestConvertible_p_10Foundation3URLV011destinationJ0_AF0E7OptionsV7optionstAJ_So15HTTPURLResponseCtcSg2totF":{"name":"download(_:to:)","abstract":"
Creates a DownloadRequest to retrieve the contents of a URL based on the specified urlRequest and save","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC8downloadAA15DownloadRequestC10Foundation4DataV12resumingWith_AG3URLV011destinationK0_AF0E7OptionsV7optionstAL_So15HTTPURLResponseCtcSg2totF":{"name":"download(resumingWith:to:)","abstract":"
Creates a DownloadRequest from the resumeData produced from a previous request cancellation to retrieve","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC6uploadAA13UploadRequestC10Foundation3URLV_AA14URLConvertible_p2toAA10HTTPMethodO6methods10DictionaryVyS2SGSg7headerstF":{"name":"upload(_:to:method:headers:)","abstract":"
Creates an UploadRequest from the specified url, method and headers for uploading the file.
Encodes multipartFormData using encodingMemoryThreshold and calls encodingCompletion with new","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC6uploadyyAA17MultipartFormDataCc09multipartfG0_s6UInt64V14usingThresholdAA21URLRequestConvertible_p4withyAC0efG14EncodingResultOcSg18encodingCompletiontF":{"name":"upload(multipartFormData:usingThreshold:with:encodingCompletion:)","abstract":"
Encodes multipartFormData using encodingMemoryThreshold and calls encodingCompletion with new","parent_name":"SessionManager"},"Classes/SessionManager.html#/s:9Alamofire14SessionManagerC6streamAA13StreamRequestCSS12withHostName_Si4porttF":{"name":"stream(withHostName:port:)","abstract":"
Creates a StreamRequest for bidirectional streaming using the hostname and port.
Sets a closure to be called periodically during the lifecycle of the UploadRequest as data is sent to","parent_name":"UploadRequest"},"Classes/DownloadRequest/DownloadOptions.html#/s:9Alamofire15DownloadRequestC0B7OptionsV8rawValueSuv":{"name":"rawValue","abstract":"
Returns the raw bitmask value of the option and satisfies the RawRepresentable protocol.
A collection of options to be executed prior to moving a downloaded file from the temporary URL to the","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC0B15FileDestinationa":{"name":"DownloadFileDestination","abstract":"
A closure executed once a download request has successfully completed in order to determine where to move the","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC7request10Foundation10URLRequestVSgv":{"name":"request","abstract":"
Creates a download file destination closure which uses the default file manager to move the temporary file to a","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC8responseACXDSo13DispatchQueueCSg5queue_yAA07DefaultB8ResponseVc17completionHandlertF":{"name":"response(queue:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns a result string type initialized from the response data with","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC14responseStringACXDSo13DispatchQueueCSg5queue_SS10FoundationE8EncodingVSg8encodingyAA0B8ResponseVySSGc17completionHandlertF":{"name":"responseString(queue:encoding:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns a JSON object result type constructed from the response data using","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC12responseJSONACXDSo13DispatchQueueCSg5queue_So17JSONSerializationC14ReadingOptionsV7optionsyAA0B8ResponseVyypGc17completionHandlertF":{"name":"responseJSON(queue:options:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns an object constructed from the response data using","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC20responsePropertyListACXDSo13DispatchQueueCSg5queue_So0eF13SerializationC17MutabilityOptionsV7optionsyAA0B8ResponseVyypGc17completionHandlertF":{"name":"responsePropertyList(queue:options:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a","parent_name":"DownloadRequest"},"Classes/DownloadRequest.html#/s:9Alamofire15DownloadRequestC8validateACXDAA0C0C16ValidationResultO10Foundation10URLRequestVSg_So15HTTPURLResponseCAI3URLVSgAQtcF":{"name":"validate(_:)","abstract":"
Validates the request, using the specified closure.
Validates that the response has a status code in the default acceptable range of 200…299, and that the content","parent_name":"DownloadRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC7request10Foundation10URLRequestVSgv":{"name":"request","abstract":"
Creates a response serializer that returns a result string type initialized from the response data with","parent_name":"DataRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC14responseStringACXDSo13DispatchQueueCSg5queue_SS10FoundationE8EncodingVSg8encodingyAA0B8ResponseVySSGc17completionHandlertF":{"name":"responseString(queue:encoding:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns a JSON object result type constructed from the response data using","parent_name":"DataRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC12responseJSONACXDSo13DispatchQueueCSg5queue_So17JSONSerializationC14ReadingOptionsV7optionsyAA0B8ResponseVyypGc17completionHandlertF":{"name":"responseJSON(queue:options:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
Creates a response serializer that returns an object constructed from the response data using","parent_name":"DataRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC20responsePropertyListACXDSo13DispatchQueueCSg5queue_So0eF13SerializationC17MutabilityOptionsV7optionsyAA0B8ResponseVyypGc17completionHandlertF":{"name":"responsePropertyList(queue:options:completionHandler:)","abstract":"
Adds a handler to be called once the request has finished.
A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the","parent_name":"DataRequest"},"Classes/DataRequest.html#/s:9Alamofire11DataRequestC8validateACXDAA0C0C16ValidationResultO10Foundation10URLRequestVSg_So15HTTPURLResponseCAI0B0VSgtcF":{"name":"validate(_:)","abstract":"
Validates the request, using the specified closure.
Validates that the response has a status code in the default acceptable range of 200…299, and that the content","parent_name":"DataRequest"},"Classes/Request/ValidationResult.html#/s:9Alamofire7RequestC16ValidationResultO7successA2EmF":{"name":"success","abstract":"
The textual representation used when written to an output stream, which includes the HTTP method and URL, as","parent_name":"Request"},"Classes/Request.html#/s:9Alamofire7RequestC16debugDescriptionSSv":{"name":"debugDescription","abstract":"
The textual representation used when written to an output stream, in the form of a cURL command.
Returns a JSON object contained in a result type constructed from the response data using JSONSerialization","parent_name":"Request"},"Classes/Request.html#/s:9Alamofire7RequestC29serializeResponsePropertyListAA6ResultOyypGSo0eF13SerializationC17MutabilityOptionsV7options_So15HTTPURLResponseCSg8response10Foundation4DataVSg4datas5Error_pSg5errortFZ":{"name":"serializeResponsePropertyList(options:response:data:error:)","abstract":"
Returns a plist object contained in a result type constructed from the response data using","parent_name":"Request"},"Classes/Request/ValidationResult.html":{"name":"ValidationResult","abstract":"
Used to represent whether validation was successful or encountered an error resulting in a failure.
Overrides all behavior for URLSessionTaskDelegate method urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC23taskDidReceiveChallengeSo10URLSessionC04AuthG11DispositionO_So13URLCredentialCSgtAF_So0H4TaskCSo017URLAuthenticationG0CtcSgv":{"name":"taskDidReceiveChallenge","abstract":"
Overrides all behavior for URLSessionTaskDelegate method urlSession(_:task:didReceive:completionHandler:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC21taskNeedNewBodyStreamSo05InputH0CSgSo10URLSessionC_So0J4TaskCtcSgv":{"name":"taskNeedNewBodyStream","abstract":"
Overrides all behavior for URLSessionTaskDelegate method urlSession(_:task:needNewBodyStream:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC19taskDidSendBodyDataySo10URLSessionC_So0I4TaskCs5Int64VA2JtcSgv":{"name":"taskDidSendBodyData","abstract":"
Overrides all behavior for URLSessionDataDelegate method urlSession(_:dataTask:didReceive:completionHandler:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC025dataTaskDidBecomeDownloadE0ySo10URLSessionC_So0i4DataE0CSo0ihE0CtcSgv":{"name":"dataTaskDidBecomeDownloadTask","abstract":"
Overrides all behavior for URLSessionDataDelegate method urlSession(_:dataTask:willCacheResponse:completionHandler:) and","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/s:9Alamofire15SessionDelegateC37downloadTaskDidFinishDownloadingToURLySo10URLSessionC_So0k8DownloadE0C10Foundation0J0VtcSgv":{"name":"downloadTaskDidFinishDownloadingToURL","abstract":"
Returns a Bool indicating whether the SessionDelegate implements or inherits a method that can respond","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSession:didBecomeInvalidWithError:":{"name":"urlSession(_:didBecomeInvalidWithError:)","abstract":"
Tells the delegate that the session has been invalidated.
Requests credentials from the delegate in response to a session-level authentication request from the","parent_name":"SessionDelegate"},"Classes/SessionDelegate.html#/c:@CM@Alamofire@objc(cs)SessionDelegate(im)URLSessionDidFinishEventsForBackgroundURLSession:":{"name":"urlSessionDidFinishEvents(forBackgroundURLSession:)","abstract":"
Tells the delegate that all messages enqueued for a session have been delivered.
Responsible for sending a request and receiving the response and associated data from the server, as well as"},"Classes/DataRequest.html":{"name":"DataRequest","abstract":"
Specific type of Request that manages an underlying URLSessionDataTask.
Constructs multipart/form-data for uploads within an HTTP or HTTPS body. There are currently two ways to encode"},"Classes/ServerTrustPolicyManager.html":{"name":"ServerTrustPolicyManager","abstract":"
Responsible for managing the mapping of ServerTrustPolicy objects to a given host.
The NetworkReachabilityManager class listens for reachability changes of hosts and addresses for both WWAN and"},"Classes/TaskDelegate.html":{"name":"TaskDelegate","abstract":"
The task delegate is responsible for handling all delegate callbacks for the underlying task as well as"},"Classes.html":{"name":"Classes","abstract":"
"}}
\ No newline at end of file
diff --git a/Carthage/Checkouts/AlamofireImage/Carthage/Checkouts/Alamofire/docs/undocumented.json b/Carthage/Checkouts/AlamofireImage/Carthage/Checkouts/Alamofire/docs/undocumented.json
new file mode 100644
index 0000000..14d86fa
--- /dev/null
+++ b/Carthage/Checkouts/AlamofireImage/Carthage/Checkouts/Alamofire/docs/undocumented.json
@@ -0,0 +1,439 @@
+{
+ "warnings": [
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 44,
+ "symbol": "AFError.ParameterEncodingFailureReason.missingURL",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 45,
+ "symbol": "AFError.ParameterEncodingFailureReason.jsonEncodingFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 46,
+ "symbol": "AFError.ParameterEncodingFailureReason.propertyListEncodingFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 75,
+ "symbol": "AFError.MultipartEncodingFailureReason.bodyPartURLInvalid",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 76,
+ "symbol": "AFError.MultipartEncodingFailureReason.bodyPartFilenameInvalid",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 77,
+ "symbol": "AFError.MultipartEncodingFailureReason.bodyPartFileNotReachable",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 78,
+ "symbol": "AFError.MultipartEncodingFailureReason.bodyPartFileNotReachableWithError",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 79,
+ "symbol": "AFError.MultipartEncodingFailureReason.bodyPartFileIsDirectory",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 80,
+ "symbol": "AFError.MultipartEncodingFailureReason.bodyPartFileSizeNotAvailable",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 81,
+ "symbol": "AFError.MultipartEncodingFailureReason.bodyPartFileSizeQueryFailedWithError",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 82,
+ "symbol": "AFError.MultipartEncodingFailureReason.bodyPartInputStreamCreationFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 84,
+ "symbol": "AFError.MultipartEncodingFailureReason.outputStreamCreationFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 85,
+ "symbol": "AFError.MultipartEncodingFailureReason.outputStreamFileAlreadyExists",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 86,
+ "symbol": "AFError.MultipartEncodingFailureReason.outputStreamURLInvalid",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 87,
+ "symbol": "AFError.MultipartEncodingFailureReason.outputStreamWriteFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 89,
+ "symbol": "AFError.MultipartEncodingFailureReason.inputStreamReadFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 102,
+ "symbol": "AFError.ResponseValidationFailureReason.dataFileNil",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 103,
+ "symbol": "AFError.ResponseValidationFailureReason.dataFileReadFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 104,
+ "symbol": "AFError.ResponseValidationFailureReason.missingContentType",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 105,
+ "symbol": "AFError.ResponseValidationFailureReason.unacceptableContentType",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 106,
+ "symbol": "AFError.ResponseValidationFailureReason.unacceptableStatusCode",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 119,
+ "symbol": "AFError.ResponseSerializationFailureReason.inputDataNil",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 120,
+ "symbol": "AFError.ResponseSerializationFailureReason.inputDataNilOrZeroLength",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 121,
+ "symbol": "AFError.ResponseSerializationFailureReason.inputFileNil",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 122,
+ "symbol": "AFError.ResponseSerializationFailureReason.inputFileReadFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 123,
+ "symbol": "AFError.ResponseSerializationFailureReason.stringSerializationFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 124,
+ "symbol": "AFError.ResponseSerializationFailureReason.jsonSerializationFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 125,
+ "symbol": "AFError.ResponseSerializationFailureReason.propertyListSerializationFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 128,
+ "symbol": "AFError.invalidURL",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 129,
+ "symbol": "AFError.parameterEncodingFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 130,
+ "symbol": "AFError.multipartEncodingFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 131,
+ "symbol": "AFError.responseValidationFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/AFError.swift",
+ "line": 132,
+ "symbol": "AFError.responseSerializationFailed",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/NetworkReachabilityManager.swift",
+ "line": 43,
+ "symbol": "NetworkReachabilityManager.NetworkReachabilityStatus.unknown",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/NetworkReachabilityManager.swift",
+ "line": 44,
+ "symbol": "NetworkReachabilityManager.NetworkReachabilityStatus.notReachable",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/NetworkReachabilityManager.swift",
+ "line": 45,
+ "symbol": "NetworkReachabilityManager.NetworkReachabilityStatus.reachable",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/NetworkReachabilityManager.swift",
+ "line": 53,
+ "symbol": "NetworkReachabilityManager.ConnectionType.ethernetOrWiFi",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/NetworkReachabilityManager.swift",
+ "line": 54,
+ "symbol": "NetworkReachabilityManager.ConnectionType.wwan",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 31,
+ "symbol": "HTTPMethod.options",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 32,
+ "symbol": "HTTPMethod.get",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 33,
+ "symbol": "HTTPMethod.head",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 34,
+ "symbol": "HTTPMethod.post",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 35,
+ "symbol": "HTTPMethod.put",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 36,
+ "symbol": "HTTPMethod.patch",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 37,
+ "symbol": "HTTPMethod.delete",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 38,
+ "symbol": "HTTPMethod.trace",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 39,
+ "symbol": "HTTPMethod.connect",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 82,
+ "symbol": "URLEncoding.Destination.httpBody",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 82,
+ "symbol": "URLEncoding.Destination.methodDependent",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ParameterEncoding.swift",
+ "line": 82,
+ "symbol": "URLEncoding.Destination.queryString",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/Result.swift",
+ "line": 35,
+ "symbol": "Result.success",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/Result.swift",
+ "line": 36,
+ "symbol": "Result.failure",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ServerTrustPolicy.swift",
+ "line": 116,
+ "symbol": "ServerTrustPolicy.performDefaultEvaluation",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ServerTrustPolicy.swift",
+ "line": 117,
+ "symbol": "ServerTrustPolicy.performRevokedEvaluation",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ServerTrustPolicy.swift",
+ "line": 118,
+ "symbol": "ServerTrustPolicy.pinCertificates",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ServerTrustPolicy.swift",
+ "line": 119,
+ "symbol": "ServerTrustPolicy.pinPublicKeys",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ServerTrustPolicy.swift",
+ "line": 120,
+ "symbol": "ServerTrustPolicy.disableEvaluation",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/ServerTrustPolicy.swift",
+ "line": 121,
+ "symbol": "ServerTrustPolicy.customEvaluation",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/SessionManager.swift",
+ "line": 40,
+ "symbol": "SessionManager.MultipartFormDataEncodingResult.success",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/SessionManager.swift",
+ "line": 41,
+ "symbol": "SessionManager.MultipartFormDataEncodingResult.failure",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/Validation.swift",
+ "line": 38,
+ "symbol": "Request.ValidationResult.success",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ },
+ {
+ "file": "/Users/jshier/Desktop/Code/Alamofire/Source/Validation.swift",
+ "line": 39,
+ "symbol": "Request.ValidationResult.failure",
+ "symbol_kind": "source.lang.swift.decl.enumelement",
+ "warning": "undocumented"
+ }
+ ],
+ "source_directory": "/Users/jshier/Desktop/Code/Alamofire"
+}
\ No newline at end of file
diff --git a/Carthage/Checkouts/AlamofireImage/Documentation/AlamofireImage 3.0 Migration Guide.md b/Carthage/Checkouts/AlamofireImage/Documentation/AlamofireImage 3.0 Migration Guide.md
index 88c384b..48b1878 100644
--- a/Carthage/Checkouts/AlamofireImage/Documentation/AlamofireImage 3.0 Migration Guide.md
+++ b/Carthage/Checkouts/AlamofireImage/Documentation/AlamofireImage 3.0 Migration Guide.md
@@ -16,7 +16,7 @@ For those of you that would like to use AlamofireImage with Swift 2.2 or 2.3, pl
The benefits of upgrading can be summarized as follows:
-- **Alamofire 4 Compatability**
+- **Alamofire 4 Compatibility**
- **Complete Swift 3 Compatibility:** includes the full adoption of the new [API Design Guidelines](https://swift.org/documentation/api-design-guidelines/).
- **New Error System:** uses a new `AFIError` type to adhere to the new pattern proposed in [SE-0112](https://github.com/apple/swift-evolution/blob/master/proposals/0112-nserror-bridging.md).
@@ -125,7 +125,7 @@ imageCache.removeImageWithIdentifier("avatar")
// AlamofireImage 3
imageCache.removeImage(withIdentifier: "avatar")
-// With an Addtional Identifier
+// With an Additional Identifier
// AlamofireImage 2
imageCache.removeImageForRequest(urlRequest, withAdditionalIdentifier: "circle")
diff --git a/Carthage/Checkouts/AlamofireImage/Example/AppDelegate.swift b/Carthage/Checkouts/AlamofireImage/Example/AppDelegate.swift
index 28dadfc..b604c3b 100644
--- a/Carthage/Checkouts/AlamofireImage/Example/AppDelegate.swift
+++ b/Carthage/Checkouts/AlamofireImage/Example/AppDelegate.swift
@@ -1,7 +1,7 @@
//
// AppDelegate.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Example/Base.lproj/LaunchScreen.xib b/Carthage/Checkouts/AlamofireImage/Example/Base.lproj/LaunchScreen.xib
index 85bb703..3371399 100644
--- a/Carthage/Checkouts/AlamofireImage/Example/Base.lproj/LaunchScreen.xib
+++ b/Carthage/Checkouts/AlamofireImage/Example/Base.lproj/LaunchScreen.xib
@@ -1,9 +1,13 @@
-
-
+
+
+
+
+
-
+
+
@@ -12,20 +16,20 @@
-
-
+
diff --git a/Carthage/Checkouts/AlamofireImage/Example/Gravatar.swift b/Carthage/Checkouts/AlamofireImage/Example/Gravatar.swift
index 1c51074..e7e64b5 100644
--- a/Carthage/Checkouts/AlamofireImage/Example/Gravatar.swift
+++ b/Carthage/Checkouts/AlamofireImage/Example/Gravatar.swift
@@ -1,7 +1,7 @@
//
// Gravatar.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Example/ImageCell.swift b/Carthage/Checkouts/AlamofireImage/Example/ImageCell.swift
index c919229..ff9cde6 100644
--- a/Carthage/Checkouts/AlamofireImage/Example/ImageCell.swift
+++ b/Carthage/Checkouts/AlamofireImage/Example/ImageCell.swift
@@ -1,7 +1,7 @@
//
// ImageCell.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Example/ImageViewController.swift b/Carthage/Checkouts/AlamofireImage/Example/ImageViewController.swift
index cfeb028..9687d8c 100644
--- a/Carthage/Checkouts/AlamofireImage/Example/ImageViewController.swift
+++ b/Carthage/Checkouts/AlamofireImage/Example/ImageViewController.swift
@@ -1,7 +1,7 @@
//
// ImageViewController.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Example/ImagesViewController.swift b/Carthage/Checkouts/AlamofireImage/Example/ImagesViewController.swift
index cce767e..b9a6a63 100644
--- a/Carthage/Checkouts/AlamofireImage/Example/ImagesViewController.swift
+++ b/Carthage/Checkouts/AlamofireImage/Example/ImagesViewController.swift
@@ -1,7 +1,7 @@
//
// ImagesViewController.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Example/iOS-Example-Bridging-Header.h b/Carthage/Checkouts/AlamofireImage/Example/iOS-Example-Bridging-Header.h
index a4fd79f..43cf48c 100644
--- a/Carthage/Checkouts/AlamofireImage/Example/iOS-Example-Bridging-Header.h
+++ b/Carthage/Checkouts/AlamofireImage/Example/iOS-Example-Bridging-Header.h
@@ -1,7 +1,7 @@
//
// iOS-Example-Bridging-Header.h
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/ISSUE_TEMPLATE.md b/Carthage/Checkouts/AlamofireImage/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..7eb2dd4
--- /dev/null
+++ b/Carthage/Checkouts/AlamofireImage/ISSUE_TEMPLATE.md
@@ -0,0 +1,33 @@
+> ℹ Please fill out this template when filing an issue.
+> All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.
+>
+> Per our [*CONTRIBUTING guidelines](https://github.com/Alamofire/AlamofireImage/blob/master/CONTRIBUTING.md), we use GitHub for
+> bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag `alamofireimage`.
+>
+> Please remove this line and everything above it before submitting.
+
+* [ ] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/Alamofire/AlamofireImage/blob/master/CONTRIBUTING.md).
+
+## What did you do?
+
+ℹ Please replace this with what you did.
+
+## What did you expect to happen?
+
+ℹ Please replace this with what you expected to happen.
+
+## What happened instead?
+
+ℹ Please replace this with of what happened instead.
+
+## Alamofire Environment
+
+**Alamofire version:**
+**Xcode version:**
+**Swift version:**
+**Platform(s) running AlamofireImage:**
+**macOS version running Xcode:**
+
+## Demo Project
+
+ℹ Please link to or upload a project we can download that reproduces the issue.
diff --git a/Carthage/Checkouts/AlamofireImage/LICENSE b/Carthage/Checkouts/AlamofireImage/LICENSE
index 4fe9ec9..3d4f7a8 100644
--- a/Carthage/Checkouts/AlamofireImage/LICENSE
+++ b/Carthage/Checkouts/AlamofireImage/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/PULL_REQUEST_TEMPLATE.md b/Carthage/Checkouts/AlamofireImage/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..6e04c37
--- /dev/null
+++ b/Carthage/Checkouts/AlamofireImage/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,13 @@
+### Issue Link :link:
+
+
+### Goals :soccer:
+
+
+
+### Implementation Details :construction:
+
+
+
+### Testing Details :mag:
+
diff --git a/Carthage/Checkouts/AlamofireImage/Package.swift b/Carthage/Checkouts/AlamofireImage/Package.swift
index e3c6953..aa11a8c 100644
--- a/Carthage/Checkouts/AlamofireImage/Package.swift
+++ b/Carthage/Checkouts/AlamofireImage/Package.swift
@@ -1,30 +1,33 @@
-// Package.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Package.swift
//
-// 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:
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
+// 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.
//
-// 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 PackageDescription
let package = Package(
name: "AlamofireImage",
dependencies: [
- .Package(url: "https://github.com/Alamofire/Alamofire.git", versions: Version(4, 0, 0).. CocoaPods 1.1.0+ is required.
+> CocoaPods 1.1+ is required.
To integrate AlamofireImage into your Xcode project using CocoaPods, specify it in your `Podfile`:
@@ -64,7 +65,7 @@ platform :ios, '10.0'
use_frameworks!
target '' do
- pod 'AlamofireImage', '~> 3.1'
+ pod 'AlamofireImage', '~> 3.3'
end
```
@@ -88,7 +89,7 @@ $ brew install carthage
To integrate AlamofireImage into your Xcode project using Carthage, specify it in your `Cartfile`:
```ogdl
-github "Alamofire/AlamofireImage" ~> 3.1
+github "Alamofire/AlamofireImage" ~> 3.3
```
Run `carthage update` to build the framework and drag the built `AlamofireImage.framework` into your Xcode project.
@@ -101,13 +102,13 @@ If you prefer not to use either of the aforementioned dependency managers, you c
- 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
+```bash
$ git init
```
- Add AlamofireImage as a git [submodule](http://git-scm.com/docs/git-submodule) by running the following command:
- ```bash
+```bash
$ git submodule add https://github.com/Alamofire/AlamofireImage.git
```
@@ -138,6 +139,7 @@ $ git submodule add https://github.com/Alamofire/AlamofireImage.git
### Image Response Serializers
```swift
+import Alamofire
import AlamofireImage
Alamofire.request("https://httpbin.org/image/png").responseImage { response in
@@ -279,7 +281,7 @@ The current list of multi-pass image filters includes:
### Image Cache
-Image caching can become complicated when it comes to network images. `URLCache` is quite powerful and does a great job reasoning through the various cache policies and `Cache-Control` headers. However, it is not equiped to handle caching multiple modified versions of those images.
+Image caching can become complicated when it comes to network images. `URLCache` is quite powerful and does a great job reasoning through the various cache policies and `Cache-Control` headers. However, it is not equipped to handle caching multiple modified versions of those images.
For example, let's say you need to download an album of images. Your app needs to display both the thumbnail version as well as the full size version at various times. Due to performance issues, you want to scale down the thumbnails to a reasonable size before rendering them on-screen. You also need to apply a global CoreImage filter to the full size images when displayed. While `URLCache` can easily handle storing the original downloaded image, it cannot store these different variants. What you really need is another caching layer designed to handle these different variants.
@@ -573,7 +575,7 @@ The [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise m
* 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 enthusiam 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.
+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.
diff --git a/Carthage/Checkouts/AlamofireImage/Source/AFIError.swift b/Carthage/Checkouts/AlamofireImage/Source/AFIError.swift
index b648529..49774bb 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/AFIError.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/AFIError.swift
@@ -1,7 +1,7 @@
//
// AFIError.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Source/AlamofireImage.h b/Carthage/Checkouts/AlamofireImage/Source/AlamofireImage.h
index 9989aa7..dfac38a 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/AlamofireImage.h
+++ b/Carthage/Checkouts/AlamofireImage/Source/AlamofireImage.h
@@ -1,7 +1,7 @@
//
// AlamofireImage.h
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Source/Image.swift b/Carthage/Checkouts/AlamofireImage/Source/Image.swift
index fad90c4..3338419 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/Image.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/Image.swift
@@ -1,7 +1,7 @@
//
// Image.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Source/ImageCache.swift b/Carthage/Checkouts/AlamofireImage/Source/ImageCache.swift
index cf231b0..3f6bc3c 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/ImageCache.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/ImageCache.swift
@@ -1,7 +1,7 @@
//
// ImageCache.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 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
@@ -196,8 +196,8 @@ open class AutoPurgingImageCache: ImageRequestCache {
if self.currentMemoryUsage > self.memoryCapacity {
let bytesToPurge = self.currentMemoryUsage - self.preferredMemoryUsageAfterPurge
+ var sortedImages = self.cachedImages.map { $1 }
- var sortedImages = self.cachedImages.map{$1}
sortedImages.sort {
let date1 = $0.lastAccessDate
let date2 = $1.lastAccessDate
diff --git a/Carthage/Checkouts/AlamofireImage/Source/ImageDownloader.swift b/Carthage/Checkouts/AlamofireImage/Source/ImageDownloader.swift
index 3e84306..b85a479 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/ImageDownloader.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/ImageDownloader.swift
@@ -1,7 +1,7 @@
//
// ImageDownloader.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 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
@@ -275,7 +275,7 @@ open class ImageDownloader {
let urlID = ImageDownloader.urlIdentifier(for: urlRequest)
if let responseHandler = self.responseHandlers[urlID] {
- responseHandler.operations.append(receiptID: receiptID, filter: filter, completion: completion)
+ responseHandler.operations.append((receiptID: receiptID, filter: filter, completion: completion))
request = responseHandler.request
return
}
diff --git a/Carthage/Checkouts/AlamofireImage/Source/ImageFilter.swift b/Carthage/Checkouts/AlamofireImage/Source/ImageFilter.swift
index b93eb48..92c93a1 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/ImageFilter.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/ImageFilter.swift
@@ -1,7 +1,7 @@
//
// ImageFilter.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Source/Info-tvOS.plist b/Carthage/Checkouts/AlamofireImage/Source/Info-tvOS.plist
index 07bfcd5..eb22fc9 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/Info-tvOS.plist
+++ b/Carthage/Checkouts/AlamofireImage/Source/Info-tvOS.plist
@@ -15,7 +15,7 @@
CFBundlePackageTypeFMWKCFBundleShortVersionString
- 3.2.0
+ 3.3.0CFBundleSignature????CFBundleVersion
diff --git a/Carthage/Checkouts/AlamofireImage/Source/Info.plist b/Carthage/Checkouts/AlamofireImage/Source/Info.plist
index 340121d..f7c2d1b 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/Info.plist
+++ b/Carthage/Checkouts/AlamofireImage/Source/Info.plist
@@ -15,7 +15,7 @@
CFBundlePackageTypeFMWKCFBundleShortVersionString
- 3.2.0
+ 3.3.0CFBundleSignature????CFBundleVersion
diff --git a/Carthage/Checkouts/AlamofireImage/Source/Request+AlamofireImage.swift b/Carthage/Checkouts/AlamofireImage/Source/Request+AlamofireImage.swift
index 0e49619..c147165 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/Request+AlamofireImage.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/Request+AlamofireImage.swift
@@ -1,7 +1,7 @@
//
// Request+AlamofireImage.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 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
@@ -112,6 +112,8 @@ extension DataRequest {
/// (such as PNG or JPEG). Enabling this can significantly improve drawing
/// performance as it allows a bitmap representation to be constructed in the
/// background rather than on the main thread. `true` by default.
+ /// - parameter queue: The queue on which the completion handler is dispatched. `nil` by default,
+ /// which results in using `DispatchQueue.main`.
/// - parameter completionHandler: A closure to be executed once the request has finished. The closure takes 4
/// arguments: the URL request, the URL response, if one was received, the image,
/// if one could be created from the URL response and data, and any error produced
@@ -122,10 +124,12 @@ extension DataRequest {
public func responseImage(
imageScale: CGFloat = DataRequest.imageScale,
inflateResponseImage: Bool = true,
+ queue: DispatchQueue? = nil,
completionHandler: @escaping (DataResponse) -> Void)
-> Self
{
return response(
+ queue: queue,
responseSerializer: DataRequest.imageResponseSerializer(
imageScale: imageScale,
inflateResponseImage: inflateResponseImage
@@ -200,7 +204,7 @@ extension DataRequest {
throw AFIError.imageSerializationFailed
}
- private class var imageScale: CGFloat {
+ public class var imageScale: CGFloat {
#if os(iOS) || os(tvOS)
return UIScreen.main.scale
#elseif os(watchOS)
@@ -244,11 +248,17 @@ extension DataRequest {
/// arguments: the URL request, the URL response, if one was received, the image, if
/// one could be created from the URL response and data, and any error produced while
/// creating the image.
+ /// - parameter queue: The queue on which the completion handler is dispatched. `nil` by default,
+ /// which results in using `DispatchQueue.main`.
///
/// - returns: The request.
@discardableResult
- public func responseImage(completionHandler: @escaping (DataResponse) -> Void) -> Self {
+ public func responseImage(
+ queue: DispatchQueue? = nil,
+ completionHandler: @escaping (DataResponse) -> Void)
+ -> Self {
return response(
+ queue: queue,
responseSerializer: DataRequest.imageResponseSerializer(),
completionHandler: completionHandler
)
diff --git a/Carthage/Checkouts/AlamofireImage/Source/UIButton+AlamofireImage.swift b/Carthage/Checkouts/AlamofireImage/Source/UIButton+AlamofireImage.swift
index 10ab10b..23017ca 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/UIButton+AlamofireImage.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/UIButton+AlamofireImage.swift
@@ -1,7 +1,7 @@
//
// UIButton+AlamofireImage.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 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
@@ -107,7 +107,7 @@ extension UIButton {
/// Asynchronously downloads an image from the specified URL and sets it once the request is finished.
///
- /// If the image is cached locally, the image is set immediately. Otherwise the specified placehoder image will be
+ /// If the image is cached locally, the image is set immediately. Otherwise the specified placeholder image will be
/// set immediately, and then the remote image will be set once the image request is finished.
///
/// - parameter state: The control state of the button to set the image on.
@@ -146,7 +146,7 @@ extension UIButton {
/// Asynchronously downloads an image from the specified URL request and sets it once the request is finished.
///
- /// If the image is cached locally, the image is set immediately. Otherwise the specified placehoder image will be
+ /// If the image is cached locally, the image is set immediately. Otherwise the specified placeholder image will be
/// set immediately, and then the remote image will be set once the image request is finished.
///
/// - parameter state: The control state of the button to set the image on.
@@ -254,7 +254,7 @@ extension UIButton {
/// Asynchronously downloads an image from the specified URL and sets it once the request is finished.
///
- /// If the image is cached locally, the image is set immediately. Otherwise the specified placehoder image will be
+ /// If the image is cached locally, the image is set immediately. Otherwise the specified placeholder image will be
/// set immediately, and then the remote image will be set once the image request is finished.
///
/// - parameter state: The control state of the button to set the image on.
@@ -293,7 +293,7 @@ extension UIButton {
/// Asynchronously downloads an image from the specified URL request and sets it once the request is finished.
///
- /// If the image is cached locally, the image is set immediately. Otherwise the specified placehoder image will be
+ /// If the image is cached locally, the image is set immediately. Otherwise the specified placeholder image will be
/// set immediately, and then the remote image will be set once the image request is finished.
///
/// - parameter state: The control state of the button to set the image on.
diff --git a/Carthage/Checkouts/AlamofireImage/Source/UIImage+AlamofireImage.swift b/Carthage/Checkouts/AlamofireImage/Source/UIImage+AlamofireImage.swift
index c042c50..4597cee 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/UIImage+AlamofireImage.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/UIImage+AlamofireImage.swift
@@ -1,7 +1,7 @@
//
// UIImage+AlamofireImage.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 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
@@ -132,10 +132,12 @@ extension UIImage {
///
/// - returns: A new image object.
public func af_imageScaled(to size: CGSize) -> UIImage {
+ assert(size.width > 0 && size.height > 0, "You cannot safely scale an image to a zero width or height")
+
UIGraphicsBeginImageContextWithOptions(size, af_isOpaque, 0.0)
- draw(in: CGRect(origin: CGPoint.zero, size: size))
+ draw(in: CGRect(origin: .zero, size: size))
- let scaledImage = UIGraphicsGetImageFromCurrentImageContext()!
+ let scaledImage = UIGraphicsGetImageFromCurrentImageContext() ?? self
UIGraphicsEndImageContext()
return scaledImage
@@ -153,6 +155,8 @@ extension UIImage {
///
/// - returns: A new image object.
public func af_imageAspectScaled(toFit size: CGSize) -> UIImage {
+ assert(size.width > 0 && size.height > 0, "You cannot safely scale an image to a zero width or height")
+
let imageAspectRatio = self.size.width / self.size.height
let canvasAspectRatio = size.width / size.height
@@ -170,7 +174,7 @@ extension UIImage {
UIGraphicsBeginImageContextWithOptions(size, false, 0.0)
draw(in: CGRect(origin: origin, size: scaledSize))
- let scaledImage = UIGraphicsGetImageFromCurrentImageContext()!
+ let scaledImage = UIGraphicsGetImageFromCurrentImageContext() ?? self
UIGraphicsEndImageContext()
return scaledImage
@@ -183,6 +187,8 @@ extension UIImage {
///
/// - returns: A new image object.
public func af_imageAspectScaled(toFill size: CGSize) -> UIImage {
+ assert(size.width > 0 && size.height > 0, "You cannot safely scale an image to a zero width or height")
+
let imageAspectRatio = self.size.width / self.size.height
let canvasAspectRatio = size.width / size.height
@@ -200,7 +206,7 @@ extension UIImage {
UIGraphicsBeginImageContextWithOptions(size, af_isOpaque, 0.0)
draw(in: CGRect(origin: origin, size: scaledSize))
- let scaledImage = UIGraphicsGetImageFromCurrentImageContext()!
+ let scaledImage = UIGraphicsGetImageFromCurrentImageContext() ?? self
UIGraphicsEndImageContext()
return scaledImage
diff --git a/Carthage/Checkouts/AlamofireImage/Source/UIImageView+AlamofireImage.swift b/Carthage/Checkouts/AlamofireImage/Source/UIImageView+AlamofireImage.swift
index 9ee1f29..01e54cf 100644
--- a/Carthage/Checkouts/AlamofireImage/Source/UIImageView+AlamofireImage.swift
+++ b/Carthage/Checkouts/AlamofireImage/Source/UIImageView+AlamofireImage.swift
@@ -1,7 +1,7 @@
//
// UIImageView+AlamofireImage.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 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
@@ -172,7 +172,7 @@ extension UIImageView {
/// Asynchronously downloads an image from the specified URL, applies the specified image filter to the downloaded
/// image and sets it once finished while executing the image transition.
///
- /// If the image is cached locally, the image is set immediately. Otherwise the specified placehoder image will be
+ /// If the image is cached locally, the image is set immediately. Otherwise the specified placeholder image will be
/// set immediately, and then the remote image will be set once the image request is finished.
///
/// The `completion` closure is called after the image download and filtering are complete, but before the start of
@@ -225,7 +225,7 @@ extension UIImageView {
/// Asynchronously downloads an image from the specified URL Request, applies the specified image filter to the downloaded
/// image and sets it once finished while executing the image transition.
///
- /// If the image is cached locally, the image is set immediately. Otherwise the specified placehoder image will be
+ /// If the image is cached locally, the image is set immediately. Otherwise the specified placeholder image will be
/// set immediately, and then the remote image will be set once the image request is finished.
///
/// The `completion` closure is called after the image download and filtering are complete, but before the start of
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/AFError+AlamofireImageTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/AFError+AlamofireImageTests.swift
index dab23fd..8cabe92 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/AFError+AlamofireImageTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/AFError+AlamofireImageTests.swift
@@ -1,7 +1,7 @@
//
// AFError+AlamofireImageTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/BaseTestCase.swift b/Carthage/Checkouts/AlamofireImage/Tests/BaseTestCase.swift
index 974fd86..88a96ce 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/BaseTestCase.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/BaseTestCase.swift
@@ -1,7 +1,7 @@
//
// BaseTestCase.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/ImageCacheTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/ImageCacheTests.swift
index 5a49a18..f42e5b9 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/ImageCacheTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/ImageCacheTests.swift
@@ -1,7 +1,7 @@
//
// ImageCacheTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/ImageDownloaderTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/ImageDownloaderTests.swift
index fd34e76..e6a7fd1 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/ImageDownloaderTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/ImageDownloaderTests.swift
@@ -1,7 +1,7 @@
//
// ImageDownloaderTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/ImageFilterTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/ImageFilterTests.swift
index 09d74c4..e328ec2 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/ImageFilterTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/ImageFilterTests.swift
@@ -1,7 +1,7 @@
//
// ImageFilterTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/RequestTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/RequestTests.swift
index abb1cf0..975d1fc 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/RequestTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/RequestTests.swift
@@ -1,7 +1,7 @@
//
// RequestTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/UIButtonTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/UIButtonTests.swift
index 8179235..9fb3d85 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/UIButtonTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/UIButtonTests.swift
@@ -1,7 +1,7 @@
//
// UIButtonTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -30,9 +30,9 @@ import UIKit
import XCTest
private class TestButton: UIButton {
- var imageObserver: ((Void) -> Void)?
+ var imageObserver: (() -> Void)?
- required init(imageObserver: ((Void) -> Void)? = nil) {
+ required init(imageObserver: (() -> Void)? = nil) {
self.imageObserver = imageObserver
super.init(frame: CGRect.zero)
}
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/UIImage+AlamofireImageTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/UIImage+AlamofireImageTests.swift
index 4d05609..d548f64 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/UIImage+AlamofireImageTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/UIImage+AlamofireImageTests.swift
@@ -1,7 +1,7 @@
//
// UIImage+AlamofireImageTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/UIImageTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/UIImageTests.swift
index 66d26d6..97c1a81 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/UIImageTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/UIImageTests.swift
@@ -1,7 +1,7 @@
//
// UIImageTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 Alamofire Software Foundation (http://alamofire.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/AlamofireImage/Tests/UIImageViewTests.swift b/Carthage/Checkouts/AlamofireImage/Tests/UIImageViewTests.swift
index 08c44ce..691e6cc 100644
--- a/Carthage/Checkouts/AlamofireImage/Tests/UIImageViewTests.swift
+++ b/Carthage/Checkouts/AlamofireImage/Tests/UIImageViewTests.swift
@@ -1,7 +1,7 @@
//
// UIImageViewTests.swift
//
-// Copyright (c) 2015-2016 Alamofire Software Foundation (http://alamofire.org/)
+// Copyright (c) 2015-2017 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
@@ -31,9 +31,9 @@ import UIKit
import XCTest
private class TestImageView: UIImageView {
- var imageObserver: ((Void) -> Void)?
+ var imageObserver: (() -> Void)?
- convenience init(imageObserver: ((Void) -> Void)? = nil) {
+ convenience init(imageObserver: (() -> Void)? = nil) {
self.init(frame: CGRect.zero)
self.imageObserver = imageObserver
}
diff --git a/Carthage/Checkouts/AlamofireImage/iOS Example.xcodeproj/project.pbxproj b/Carthage/Checkouts/AlamofireImage/iOS Example.xcodeproj/project.pbxproj
index 4ce1526..b3f354c 100644
--- a/Carthage/Checkouts/AlamofireImage/iOS Example.xcodeproj/project.pbxproj
+++ b/Carthage/Checkouts/AlamofireImage/iOS Example.xcodeproj/project.pbxproj
@@ -221,7 +221,7 @@
4CDA9E5F1AACEB740077861B /* Supporting Files */,
);
name = Source;
- path = "iOS Example";
+ path = Example;
sourceTree = "";
};
4CDA9E5F1AACEB740077861B /* Supporting Files */ = {
@@ -279,12 +279,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
- LastUpgradeCheck = 0800;
+ LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Alamofire;
TargetAttributes = {
4CDA9E5B1AACEB740077861B = {
CreatedOnToolsVersion = 6.2;
- LastSwiftMigration = 0800;
+ LastSwiftMigration = 0900;
};
};
};
@@ -477,14 +477,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -515,6 +521,8 @@
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Example/iOS-Example-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_SWIFT3_OBJC_INFERENCE = Off;
+ SWIFT_VERSION = 3.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
@@ -528,14 +536,20 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -558,6 +572,8 @@
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Example/iOS-Example-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
+ SWIFT_SWIFT3_OBJC_INFERENCE = Off;
+ SWIFT_VERSION = 3.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
VALIDATE_PRODUCT = YES;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
@@ -569,13 +585,10 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.alamofire.AFImage;
PRODUCT_NAME = AFImage;
- PROVISIONING_PROFILE = "";
- SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -585,13 +598,10 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
- FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "$(SRCROOT)/Example/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.alamofire.AFImage;
PRODUCT_NAME = AFImage;
- PROVISIONING_PROFILE = "";
- SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
diff --git a/Carthage/Checkouts/AlamofireImage/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme b/Carthage/Checkouts/AlamofireImage/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme
index a46b8c3..70d1a3f 100644
--- a/Carthage/Checkouts/AlamofireImage/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme
+++ b/Carthage/Checkouts/AlamofireImage/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme
@@ -1,6 +1,6 @@
@@ -45,6 +46,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
diff --git a/Carthage/Checkouts/ObjectMapper b/Carthage/Checkouts/ObjectMapper
index 680f5cd..4091630 160000
--- a/Carthage/Checkouts/ObjectMapper
+++ b/Carthage/Checkouts/ObjectMapper
@@ -1 +1 @@
-Subproject commit 680f5cdfe87b94aefce8f94adcbf73adf54c1f37
+Subproject commit 40916302f077985bbb017b7ed6ddff7256c67479
diff --git a/Carthage/Checkouts/SwiftyJSON/Carthage/Build b/Carthage/Checkouts/SwiftyJSON/Carthage/Build
new file mode 120000
index 0000000..76f9ba2
--- /dev/null
+++ b/Carthage/Checkouts/SwiftyJSON/Carthage/Build
@@ -0,0 +1 @@
+../../../../Carthage/Build
\ No newline at end of file
diff --git a/Carthage/Checkouts/SwiftyJSON/README.md b/Carthage/Checkouts/SwiftyJSON/README.md
index b14c762..6256c84 100644
--- a/Carthage/Checkouts/SwiftyJSON/README.md
+++ b/Carthage/Checkouts/SwiftyJSON/README.md
@@ -496,7 +496,7 @@ There are two options available:
- use the default Swift one
- use a custom one that will handle optionals well and represent `nil` as `"null"`:
```swift
-let data = ["1":2, "2":"two", "3": nil] as [String: Any?]
+let dict = ["1":2, "2":"two", "3": nil] as [String: Any?]
let json = JSON(dict)
let representation = json.rawString(options: [.castNilToNSNull: true])
// representation is "{\"1\":2,\"2\":\"two\",\"3\":null}", which represents {"1":2,"2":"two","3":null}
diff --git a/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.h b/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.h
index ac94221..d69a764 100644
--- a/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.h
+++ b/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.h
@@ -1,6 +1,6 @@
// SwiftyJSON.h
//
-// Copyright (c) 2014 - 2016 Ruoyu Fu, Pinglin Tang
+// Copyright (c) 2014 - 2017 Ruoyu Fu, Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.swift b/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.swift
index f74ab53..e79c10d 100644
--- a/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Source/SwiftyJSON.swift
@@ -1,6 +1,6 @@
// SwiftyJSON.swift
//
-// Copyright (c) 2014 - 2016 Ruoyu Fu, Pinglin Tang
+// Copyright (c) 2014 - 2017 Ruoyu Fu, Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.podspec b/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.podspec
index 111a697..2d822e3 100644
--- a/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.podspec
+++ b/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SwiftyJSON"
- s.version = "3.1.3"
+ s.version = "3.1.4"
s.summary = "SwiftyJSON makes it easy to deal with JSON data in Swift"
s.homepage = "https://github.com/SwiftyJSON/SwiftyJSON"
s.license = { :type => "MIT" }
diff --git a/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcodeproj/project.xcworkspace/xcshareddata/SwiftyJSON.xccheckout b/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcodeproj/project.xcworkspace/xcshareddata/SwiftyJSON.xccheckout
new file mode 100644
index 0000000..0c49336
--- /dev/null
+++ b/Carthage/Checkouts/SwiftyJSON/SwiftyJSON.xcodeproj/project.xcworkspace/xcshareddata/SwiftyJSON.xccheckout
@@ -0,0 +1,41 @@
+
+
+
+
+ IDESourceControlProjectFavoriteDictionaryKey
+
+ IDESourceControlProjectIdentifier
+ 3A573BC4-D26F-4B75-AEB7-A02DA780E705
+ IDESourceControlProjectName
+ SwiftyJSON
+ IDESourceControlProjectOriginsDictionary
+
+ C861FC00CEE0F6A6BE81FCFF6785FAA78C58EBB3
+ https://github.com/lingoer/SwiftyJSON.git
+
+ IDESourceControlProjectPath
+ SwiftyJSON.xcodeproj
+ IDESourceControlProjectRelativeInstallPathDictionary
+
+ C861FC00CEE0F6A6BE81FCFF6785FAA78C58EBB3
+ ../..
+
+ IDESourceControlProjectURL
+ https://github.com/lingoer/SwiftyJSON.git
+ IDESourceControlProjectVersion
+ 111
+ IDESourceControlProjectWCCIdentifier
+ C861FC00CEE0F6A6BE81FCFF6785FAA78C58EBB3
+ IDESourceControlProjectWCConfigurations
+
+
+ IDESourceControlRepositoryExtensionIdentifierKey
+ public.vcs.git
+ IDESourceControlWCCIdentifierKey
+ C861FC00CEE0F6A6BE81FCFF6785FAA78C58EBB3
+ IDESourceControlWCCName
+ SwiftyJSON
+
+
+
+
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/ArrayTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/ArrayTests.swift
index e2d471a..c3c53de 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/ArrayTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/ArrayTests.swift
@@ -1,6 +1,6 @@
// ArrayTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/BaseTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/BaseTests.swift
index 47eb56f..0c0ff8e 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/BaseTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/BaseTests.swift
@@ -1,6 +1,6 @@
// BaseTests.swift
//
-// Copyright (c) 2014 - 2016 Ruoyu Fu, Pinglin Tang
+// Copyright (c) 2014 - 2017 Ruoyu Fu, Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/ComparableTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/ComparableTests.swift
index c027b07..f238012 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/ComparableTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/ComparableTests.swift
@@ -1,6 +1,6 @@
// ComparableTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/DictionaryTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/DictionaryTests.swift
index 13208de..5f9c822 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/DictionaryTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/DictionaryTests.swift
@@ -1,6 +1,6 @@
// DictionaryTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/LiteralConvertibleTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/LiteralConvertibleTests.swift
index c55f251..fa88e23 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/LiteralConvertibleTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/LiteralConvertibleTests.swift
@@ -1,6 +1,6 @@
// LiteralConvertibleTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/NumberTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/NumberTests.swift
index 828bae6..0ae66b5 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/NumberTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/NumberTests.swift
@@ -1,6 +1,6 @@
// NumberTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/PerformanceTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/PerformanceTests.swift
index 80b3c02..e3ed976 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/PerformanceTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/PerformanceTests.swift
@@ -1,6 +1,6 @@
// PerformanceTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/PrintableTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/PrintableTests.swift
index bcdeaaa..f60fc8c 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/PrintableTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/PrintableTests.swift
@@ -1,6 +1,6 @@
// PrintableTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/RawRepresentableTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/RawRepresentableTests.swift
index 342cd78..9ebf9b2 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/RawRepresentableTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/RawRepresentableTests.swift
@@ -1,6 +1,6 @@
// RawRepresentableTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/RawTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/RawTests.swift
index d45f1ce..7693d8e 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/RawTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/RawTests.swift
@@ -1,6 +1,6 @@
// RawTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/SequenceTypeTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/SequenceTypeTests.swift
index 62bd7dc..8f164c4 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/SequenceTypeTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/SequenceTypeTests.swift
@@ -1,7 +1,7 @@
//
// SequenceTypeTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/StringTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/StringTests.swift
index d9d5508..8d8e6eb 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/StringTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/StringTests.swift
@@ -1,6 +1,6 @@
// StringTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/SubscriptTests.swift b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/SubscriptTests.swift
index e9acc8c..2a5cd97 100644
--- a/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/SubscriptTests.swift
+++ b/Carthage/Checkouts/SwiftyJSON/Tests/SwiftyJSONTests/SubscriptTests.swift
@@ -1,6 +1,6 @@
// SubscriptTests.swift
//
-// Copyright (c) 2014 - 2016 Pinglin Tang
+// Copyright (c) 2014 - 2017 Pinglin Tang
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
diff --git a/Carthage/Checkouts/SwiftyUserDefaults b/Carthage/Checkouts/SwiftyUserDefaults
index 9be965f..cfcf2b8 160000
--- a/Carthage/Checkouts/SwiftyUserDefaults
+++ b/Carthage/Checkouts/SwiftyUserDefaults
@@ -1 +1 @@
-Subproject commit 9be965f0188e79a14738e6dd32511c0461c04b56
+Subproject commit cfcf2b8004b9b108ceb7c8f99f79654e7b05d739
diff --git a/waterwheelDemo/waterwheelDemo-iOS/waterwheelDemo-iOS.xcodeproj/project.pbxproj b/waterwheelDemo/waterwheelDemo-iOS/waterwheelDemo-iOS.xcodeproj/project.pbxproj
index f5d0252..27311e0 100644
--- a/waterwheelDemo/waterwheelDemo-iOS/waterwheelDemo-iOS.xcodeproj/project.pbxproj
+++ b/waterwheelDemo/waterwheelDemo-iOS/waterwheelDemo-iOS.xcodeproj/project.pbxproj
@@ -12,17 +12,12 @@
1D389C241D8B35CA002A7BB6 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1D389C231D8B35CA002A7BB6 /* Assets.xcassets */; };
1D389C271D8B35CA002A7BB6 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1D389C251D8B35CA002A7BB6 /* LaunchScreen.storyboard */; };
1D389C341D8B3875002A7BB6 /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C2F1D8B3875002A7BB6 /* Alamofire.framework */; };
- 1D389C351D8B3875002A7BB6 /* ObjectMapper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C301D8B3875002A7BB6 /* ObjectMapper.framework */; };
- 1D389C361D8B3875002A7BB6 /* SwiftyJSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C311D8B3875002A7BB6 /* SwiftyJSON.framework */; };
- 1D389C371D8B3875002A7BB6 /* SwiftyUserDefaults.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C321D8B3875002A7BB6 /* SwiftyUserDefaults.framework */; };
1D389C381D8B3875002A7BB6 /* waterwheel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C331D8B3875002A7BB6 /* waterwheel.framework */; };
1D389C3D1D8B3B72002A7BB6 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D389C3A1D8B3B72002A7BB6 /* LoginViewController.swift */; };
1D389C3E1D8B3B72002A7BB6 /* MenuTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D389C3B1D8B3B72002A7BB6 /* MenuTableViewController.swift */; };
1D389C3F1D8B3B72002A7BB6 /* NodeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D389C3C1D8B3B72002A7BB6 /* NodeViewController.swift */; };
1DEC82551E1DC162009CDF8A /* AlamofireImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DEC82541E1DC162009CDF8A /* AlamofireImage.framework */; };
- 1DEC82561E1DC175009CDF8A /* AlamofireImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DEC82541E1DC162009CDF8A /* AlamofireImage.framework */; };
1DEC82571E1DC175009CDF8A /* AlamofireImage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1DEC82541E1DC162009CDF8A /* AlamofireImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- 1DEC82581E1DC175009CDF8A /* Alamofire.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C2F1D8B3875002A7BB6 /* Alamofire.framework */; };
1DEC82591E1DC175009CDF8A /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C2F1D8B3875002A7BB6 /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1DEC825A1E1DC175009CDF8A /* ObjectMapper.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C301D8B3875002A7BB6 /* ObjectMapper.framework */; };
1DEC825B1E1DC175009CDF8A /* ObjectMapper.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C301D8B3875002A7BB6 /* ObjectMapper.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@@ -30,7 +25,6 @@
1DEC825D1E1DC175009CDF8A /* SwiftyJSON.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C311D8B3875002A7BB6 /* SwiftyJSON.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1DEC825E1E1DC175009CDF8A /* SwiftyUserDefaults.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C321D8B3875002A7BB6 /* SwiftyUserDefaults.framework */; };
1DEC825F1E1DC175009CDF8A /* SwiftyUserDefaults.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C321D8B3875002A7BB6 /* SwiftyUserDefaults.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- 1DEC82601E1DC175009CDF8A /* waterwheel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C331D8B3875002A7BB6 /* waterwheel.framework */; };
1DEC82611E1DC175009CDF8A /* waterwheel.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1D389C331D8B3875002A7BB6 /* waterwheel.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */
@@ -79,15 +73,9 @@
1DEC825A1E1DC175009CDF8A /* ObjectMapper.framework in Frameworks */,
1DEC82551E1DC162009CDF8A /* AlamofireImage.framework in Frameworks */,
1D389C381D8B3875002A7BB6 /* waterwheel.framework in Frameworks */,
- 1DEC82561E1DC175009CDF8A /* AlamofireImage.framework in Frameworks */,
- 1DEC82601E1DC175009CDF8A /* waterwheel.framework in Frameworks */,
1DEC825C1E1DC175009CDF8A /* SwiftyJSON.framework in Frameworks */,
1D389C341D8B3875002A7BB6 /* Alamofire.framework in Frameworks */,
- 1D389C351D8B3875002A7BB6 /* ObjectMapper.framework in Frameworks */,
- 1D389C361D8B3875002A7BB6 /* SwiftyJSON.framework in Frameworks */,
1DEC825E1E1DC175009CDF8A /* SwiftyUserDefaults.framework in Frameworks */,
- 1D389C371D8B3875002A7BB6 /* SwiftyUserDefaults.framework in Frameworks */,
- 1DEC82581E1DC175009CDF8A /* Alamofire.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -168,11 +156,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
- LastUpgradeCheck = 0820;
+ LastUpgradeCheck = 0900;
ORGANIZATIONNAME = acquia;
TargetAttributes = {
1D389C161D8B35CA002A7BB6 = {
CreatedOnToolsVersion = 8.0;
+ DevelopmentTeam = ABBM6U9RM5;
+ LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
@@ -272,7 +262,9 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -280,7 +272,11 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
@@ -323,7 +319,9 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -331,7 +329,11 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
@@ -363,6 +365,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = ABBM6U9RM5;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
@@ -371,7 +374,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.acquia.waterwheelDemo-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_SWIFT3_OBJC_INFERENCE = On;
+ SWIFT_VERSION = 4.0;
};
name = Debug;
};
@@ -380,6 +384,7 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = ABBM6U9RM5;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
@@ -388,7 +393,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.acquia.waterwheelDemo-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_VERSION = 3.0;
+ SWIFT_SWIFT3_OBJC_INFERENCE = On;
+ SWIFT_VERSION = 4.0;
};
name = Release;
};