SkillAgentSearch skills...

Alamofire

Elegant HTTP Networking in Swift

Install / Use

/learn @Alamofire/Alamofire

README

Alamofire: Elegant Networking in Swift

Swift Platforms CocoaPods Compatible Carthage Compatible Swift Package Manager Swift Forums

Alamofire is an HTTP networking library written in Swift.

Features

  • [x] Chainable Request / Response Methods
  • [x] Swift Concurrency Support Back to iOS 13, macOS 10.15, tvOS 13, and watchOS 6.
  • [x] Combine Support
  • [x] URL / JSON Parameter Encoding
  • [x] Upload File / Data / Stream / MultipartFormData
  • [x] Download File using Request or Resume Data
  • [x] Authentication with URLCredential
  • [x] HTTP Response Validation
  • [x] Upload and Download Progress Closures with Progress
  • [x] cURL Command Output
  • [x] Dynamically Adapt and Retry Requests
  • [x] TLS Certificate and Public Key Pinning
  • [x] Network Reachability
  • [x] Comprehensive Unit and Integration Test Coverage
  • [x] Complete Documentation

Write Requests Fast!

Alamofire's compact syntax and extensive feature set allow requests with powerful features like automatic retry to be written in just a few lines of code.

// Automatic String to URL conversion, Swift concurrency support, and automatic retry.
let response = await AF.request("https://httpbin.org/get", interceptor: .retryPolicy)
                       // Automatic HTTP Basic Auth.
                       .authenticate(username: "user", password: "pass")
                       // Caching customization.
                       .cacheResponse(using: .cache)
                       // Redirect customization.
                       .redirect(using: .follow)
                       // Validate response code and Content-Type.
                       .validate()
                       // Produce a cURL command for the request.
                       .cURLDescription { description in
                         print(description)
                       }
                       // Automatic Decodable support with background parsing.
                       .serializingDecodable(DecodableType.self)
                       // Await the full response with metrics and a parsed body.
                       .response
// Detailed response description for easy debugging.
debugPrint(response)

Component Libraries

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.

Requirements

| Platform | Minimum Swift Version | Installation | Status | | ---------------------------------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------------- | ------------------------ | | iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+ | 6.0 / Xcode 16.0 | CocoaPods, Carthage, Swift Package Manager, Manual | Fully Tested | | Linux | Latest Only | Swift Package Manager | Building But Unsupported | | Windows | Latest Only | Swift Package Manager | Building But Unsupported | | Android | Latest Only | Swift Package Manager | Building But Unsupported |

Known Issues on Linux and Windows

Alamofire builds on Linux, Windows, and Android but there are missing features and many issues in the underlying swift-corelibs-foundation that prevent full functionality and may cause crashes. These include:

  • ServerTrustManager and associated certificate functionality is unavailable, so there is no certificate pinning and no client certificate support.
  • Various methods of HTTP authentication may crash, including HTTP Basic and HTTP Digest. Crashes may occur if responses contain server challenges.
  • Cache control through CachedResponseHandler and associated APIs is unavailable, as the underlying delegate methods aren't called.
  • URLSessionTaskMetrics are never gathered.
  • WebSocketRequest is not available.

Due to these issues, Alamofire is unsupported on Linux, Windows, and Android. Please report any crashes to the Swift bug reporter.

Migration Guides

Related Skills

View on GitHub
GitHub Stars42.4k
CategoryDevelopment
Updated6h ago
Forks7.7k

Languages

Swift

Security Score

100/100

Audited on Mar 22, 2026

No findings