Classes
The following classes are available globally.
-
See moreRequestis the common superclass of all Alamofire request types and provides common state, delegate, and callback handling.Declaration
Swift
public class Request : @unchecked Sendableextension Request: Equatableextension Request: Hashableextension Request: CustomStringConvertible -
See moreEventMonitorthat provides Alamofire’s notifications.Declaration
Swift
public final class AlamofireNotifications : EventMonitor -
A
ParameterEncoderthat encodes types as JSON body data.If no
See moreContent-Typeheader is already set on the providedURLRequests, it’s set toapplication/json.Declaration
Swift
open class JSONParameterEncoder : @unchecked Sendable, ParameterEncoder -
A
ParameterEncoderthat encodes types as URL-encoded query strings to be set on the URL or as body data, depending on theDestinationset.If no
Content-Typeheader is already set on the providedURLRequests, it will be set toapplication/x-www-form-urlencoded; charset=utf-8.Encoding behavior can be customized by passing an instance of
See moreURLEncodedFormEncoderto the initializer.Declaration
Swift
open class URLEncodedFormParameterEncoder : @unchecked Sendable, ParameterEncoder -
Class which implements the various
See moreURLSessionDelegatemethods to connect various Alamofire features.Declaration
Swift
open class SessionDelegate : NSObject, @unchecked Sendableextension SessionDelegate: URLSessionDelegateextension SessionDelegate: URLSessionTaskDelegateextension SessionDelegate: URLSessionDataDelegateextension SessionDelegate: URLSessionWebSocketDelegateextension SessionDelegate: URLSessionDownloadDelegate -
See moreDataRequestsubclass which handlesDataupload from memory, file, or stream usingURLSessionUploadTask.Declaration
Swift
public final class UploadRequest : DataRequest, @unchecked Sendable -
The
See moreAuthenticationInterceptorclass manages the queuing and threading complexity of authenticating requests. It relies on anAuthenticatortype to handle the actualURLRequestauthentication andCredentialrefresh.Declaration
Swift
public final class AuthenticationInterceptor<AuthenticatorType> : RequestInterceptor, Sendable where AuthenticatorType : Authenticator -
An
See moreEventMonitorwhich can contain multipleEventMonitors and calls their methods on their queues.Declaration
Swift
public final class CompositeEventMonitor : EventMonitor -
See moreEventMonitorthat allows optional closures to be set to receive events.Declaration
Swift
open class ClosureEventMonitor : EventMonitor, @unchecked Sendable -
Constructs
multipart/form-datafor 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-datain general, please refer to the RFC-2388 and RFC-2045 specs as well and the w3 form documentation.- https://www.ietf.org/rfc/rfc2388.txt
- https://www.ietf.org/rfc/rfc2045.txt
- https://www.w3.org/TR/html401/interact/forms.html#h-17.13
Declaration
Swift
open class MultipartFormData -
The
NetworkReachabilityManagerclass listens for reachability changes of hosts and addresses for both cellular 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.
See moreDeclaration
Swift
open class NetworkReachabilityManager : @unchecked Sendable -
Closure-based
See moreRequestAdapter.Declaration
Swift
open class Adapter : @unchecked Sendable, RequestInterceptor -
Closure-based
See moreRequestRetrier.Declaration
Swift
open class Retrier : @unchecked Sendable, RequestInterceptor -
See moreRequestInterceptorwhich can use multipleRequestAdapterandRequestRetriervalues.Declaration
Swift
open class Interceptor : @unchecked Sendable, RequestInterceptor
-
A
See moreResponseSerializerthat performs minimal response checking and returns any responseDataas-is. By default, a request returningnilor no data is considered an error. However, if the request has anHTTPMethodor the response has an HTTP status code valid for empty responses, then an emptyDatavalue is returned.Declaration
Swift
public final class DataResponseSerializer : ResponseSerializer
-
A
See moreResponseSerializerthat decodes the response data as aString. By default, a request returningnilor no data is considered an error. However, if the request has anHTTPMethodor the response has an HTTP status code valid for empty responses, then an emptyStringis returned.Declaration
Swift
public final class StringResponseSerializer : ResponseSerializer
-
A
ResponseSerializerthat decodes the response data usingJSONSerialization. By default, a request returningnilor no data is considered an error. However, if the request has anHTTPMethodor the response has an HTTP status code valid for empty responses, then anNSNullvalue is returned.See moreNote
This serializer is deprecated and should not be used. Instead, create concrete types conforming toDecodableand use aDecodableResponseSerializer.Declaration
Swift
@available(*, deprecated, message: "JSONResponseSerializer deprecated and will be removed in Alamofire 6. Use DecodableResponseSerializer instead.") public final class JSONResponseSerializer : ResponseSerializer
-
A
ResponseSerializerthat decodes the response data as aDecodablevalue using any decoder that conforms toDataDecoder. By default, this is an instance ofJSONDecoder.Note
A request returning
nilor no data is considered an error. However, if the request has anHTTPMethodor the response has an HTTP status code valid for empty responses then an empty value will be returned. If the decoded type conforms toEmptyResponse, the type’semptyValue()will be returned. If the decoded type isEmpty, the.valueinstance is returned. If the decoded type does not conform toEmptyResponseand isn’tEmpty, an error will be produced.See moreNote
JSONDecoderandPropertyListDecoderare notSendableon Apple platforms until macOS 13+ or iOS 16+, so instances passed to a serializer should not be used outside of the serializer. Additionally, ensure a new serializer is created for each request, do not use a single, shared serializer, so as to ensure separate decoder instances.Declaration
Swift
public final class DecodableResponseSerializer<T> : ResponseSerializer where T : Decodable, T : Sendable -
A retry policy that retries requests using an exponential backoff for allowed HTTP methods and HTTP status codes as well as certain types of networking errors.
See moreDeclaration
Swift
open class RetryPolicy : @unchecked Sendable, RequestInterceptor
-
A retry policy that automatically retries idempotent requests for network connection lost errors. For more information about retrying network connection lost errors, please refer to Apple’s technical document.
See moreDeclaration
Swift
open class ConnectionLostRetryPolicy : RetryPolicy, @unchecked Sendable -
Responsible for managing the mapping of
See moreServerTrustEvaluatingvalues to given hosts.Declaration
Swift
open class ServerTrustManager : @unchecked Sendable
-
An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the host provided by the challenge. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain.
See moreDeclaration
Swift
public final class DefaultTrustEvaluator : ServerTrustEvaluating -
An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates. Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production environments to guarantee the validity of the server’s certificate chain.
See moreDeclaration
Swift
public final class RevocationTrustEvaluator : ServerTrustEvaluating -
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.
See moreDeclaration
Swift
public final class PinnedCertificatesTrustEvaluator : ServerTrustEvaluating -
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.
See moreDeclaration
Swift
public final class PublicKeysTrustEvaluator : ServerTrustEvaluating -
Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the evaluators consider it valid.
See moreDeclaration
Swift
public final class CompositeTrustEvaluator : ServerTrustEvaluating -
Disables all evaluation which in turn will always consider any server trust as valid.
Note
Instead of disabling server trust evaluation, it’s a better idea to configure systems to properly trust test certificates, as outlined in this Apple tech note.THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!
See moreDeclaration
Swift
public final class DisabledTrustEvaluator : ServerTrustEvaluating -
An object that encodes instances into URL-encoded query strings.
ArrayEncodingcan be used to configure howArrayvalues are encoded. By default, the.bracketsencoding is used, encoding array values with brackets for each value. e.garray[]=1&array[]=2.BoolEncodingcan be used to configure howBoolvalues are encoded. By default, the.numericencoding is used, encodingtrueas1andfalseas0.DataEncodingcan be used to configure howDatavalues are encoded. By default, the.deferredToDataencoding is used, which encodesDatavalues using their defaultEncodableimplementation.DateEncodingcan be used to configure howDatevalues are encoded. By default, the.deferredToDateencoding is used, which encodesDates using their defaultEncodableimplementation.KeyEncodingcan be used to configure how keys are encoded. By default, the.useDefaultKeysencoding is used, which encodes the keys directly from theEncodableimplementation.KeyPathEncodingcan be used to configure how paths within nested objects are encoded. By default, the.bracketsencoding is used, which encodes each sub-key in brackets. e.g.parent[child][grandchild]=value.NilEncodingcan be used to configure hownilOptionalvalues are encoded. By default, the.dropKeyencoding is used, which dropsnilkey / value pairs from the output entirely.SpaceEncodingcan be used to configure how spaces are encoded. By default, the.percentEscapedencoding is used, replacing spaces with%20.This type is largely based on Vapor’s
See moreurl-encoded-formproject.Declaration
Swift
public final class URLEncodedFormEncoder
View on GitHub
Install in Dash
Classes Reference