Elegant HTTP Networking in Swift

Last update: Jun 22, 2022

Alamofire: Elegant Networking in Swift

Build Status CocoaPods Compatible Carthage Compatible Platform Twitter Gitter Open Source Helpers

Alamofire is an HTTP networking library written in Swift.


  • Chainable Request / Response Methods
  • Combine Support
  • URL / JSON Parameter Encoding
  • Upload File / Data / Stream / MultipartFormData
  • Download File using Request or Resume Data
  • Authentication with URLCredential
  • HTTP Response Validation
  • Upload and Download Progress Closures with Progress
  • cURL Command Output
  • Dynamically Adapt and Retry Requests
  • TLS Certificate and Public Key Pinning
  • Network Reachability
  • Comprehensive Unit and Integration Test Coverage
  • Complete Documentation

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.


  • iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+
  • Xcode 11+
  • Swift 5.1+

Migration Guides




CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'Alamofire', '~> 5.2'


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your Cartfile:

github "Alamofire/Alamofire" ~> 5.2

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.

dependencies: [
    .package(url: "https://github.com/Alamofire/Alamofire.git", .upToNextMajor(from: "5.2.0"))


If you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually.

Embedded Framework

  • Open up Terminal, cd into your top-level project directory, and run the following command "if" your project is not initialized as a git repository:

    $ git init
  • Add Alamofire as a git submodule by running the following command:

    $ git submodule add https://github.com/Alamofire/Alamofire.git
  • Open the new Alamofire folder, and drag the Alamofire.xcodeproj into the Project Navigator of your application's Xcode project.

    It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.

  • Select the Alamofire.xcodeproj in the Project Navigator and verify the deployment target matches that of your application target.

  • Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the "Targets" heading in the sidebar.

  • In the tab bar at the top of that window, open the "General" panel.

  • Click on the + button under the "Embedded Binaries" section.

  • You will see two different Alamofire.xcodeproj folders each with two different versions of the Alamofire.framework nested inside a Products folder.

    It does not matter which Products folder you choose from, but it does matter whether you choose the top or bottom Alamofire.framework.

  • Select the top Alamofire.framework for iOS and the bottom one for macOS.

    You can verify which one you selected by inspecting the build log for your project. The build target for Alamofire will be listed as 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.

Open Radars

The following radars have some effect on the current implementation of Alamofire.

  • rdar://21349340 - Compiler throwing warning due to toll-free bridging issue in the test case
  • rdar://26870455 - Background URL Session Configurations do not work in the simulator
  • rdar://26849668 - Some URLProtocol APIs do not properly handle URLRequest
  • FB7624529 - urlSession(_:task:didFinishCollecting:) never called on watchOS

Resolved Radars

The following radars have been resolved over time after being filed against the Alamofire project.

  • rdar://26761490 - Swift string interpolation causing memory leak with common usage.
    • (Resolved): 9/1/17 in Xcode 9 beta 6.
  • rdar://36082113 - URLSessionTaskMetrics failing to link on watchOS 3.0+
    • (Resolved): Just add CFNetwork to your linked frameworks.


  • Collection of URLSessionTaskMetrics is currently disabled on watchOS due to FB7624529.


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.


Alamofire is owned and maintained by the Alamofire Software Foundation. You can follow them on Twitter at @AlamofireSF for project updates and releases.

Security Disclosure

If you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to [email protected]. Please do not post it to a public issue tracker.


The ASF is looking to raise money to officially stay registered as a federal non-profit organization. Registering will allow Foundation 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 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. Any amount you can donate today to help us reach our goal would be greatly appreciated.



MacStadium provides Alamofire with a free, hosted Mac mini.

Powered by MacStadium


Alamofire is released under the MIT license. See LICENSE for details.


  • 1. [WIP] Swift 3.0 Migration

    Alamofire - Swift 3.0

    The initial migration to Swift 3.0 has been completed, and can be found in the swift3 branch. Many thanks to the Apple Engineers in the labs at WWDC who assisted with some of the migration issues. :beers:

    Please file Github issues for any problems discovered while using this branch.

    This branch should be considered a work in progress, and will be updated as future Xcode 8 and Swift 3 seeds are released by Apple.

    Official support for Swift 3.0 and Xcode 8 will be not available until the fall when Apple releases both.

    Migration Notes

    • Many Foundation types are now value types, instead of reference types. Please audit your code to ensure all references to NSMutableURLRequest are now properly handled as var and are of type URLRequest.

    • Due to the Swift 3.0 naming conventions, many Alamofire API parameters that referenced an object in the URL Foundation loading system and began with capital letters now begin with lowercase letters. For example, URLRequest parameter names are now urlRequest to prevent confusion.

      More notes will be added as issues are discovered.


    The following radars were filed as a result of this migration and are currently being tracked by the ASF team.

    • 26850776: CharacterSet crashes when attempting to remove an item from the set in Swift 3.0
    • 26849668: NSURLProtocol APIs still contain NSMutableURLRequest parameter types and do not support the Swift 3.0 value types
    • 26870455: NSURLSession with background configuration does not function on the iOS simulator inside of test targets


    • [x] Update Project Recommended Settings
    • [x] Update Example
    • [x] Travis CI Support
    • [ ] Update Documentation/README
    Reviewed by kcharwood at 2016-06-17 21:56
  • 2. dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire on my iPhone(iOS8) while debuging

    dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire
      Referenced from: /private/var/mobile/Containers/Bundle/Application/XXX/Anachronos.app/Anachronos
      Reason: image not found

    Xcode6 GM

    I've read all the issues about this kind of problem, but couldn't solve the problem.

    Also, there is the same issue in iOS Example project:

    dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire
      Referenced from: /private/var/mobile/Containers/Bundle/Application/CEA6C4C1-C211-460C-8ECF-4FD9C66F1016/iOS Example.app/iOS Example
      Reason: image not found
    Reviewed by imWildCat at 2014-09-15 15:42
  • 3. iOS 13.3.1 dyld: Library not loaded

    I'm getting this error when trying to run my app with Alamofire 5.0.0-rc3:

    dyld: Library not loaded: @rpath/Alamofire.framework/Alamofire Referenced from: /private/var/containers/Bundle/Application/CC8FF01F-CB03-4D92-ADDE-8B458EDF3D74/SupremeYou.app/SupremeYou Reason: no suitable image found. Did find: /private/var/containers/Bundle/Application/CC8FF01F-CB03-4D92-ADDE-8B458EDF3D74/SupremeYou.app/Frameworks/Alamofire.framework/Alamofire: code signature invalid for '/private/var/containers/Bundle/Application/CC8FF01F-CB03-4D92-ADDE-8B458EDF3D74/SupremeYou.app/Frameworks/Alamofire.framework/Alamofire'

    /private/var/containers/Bundle/Application/CC8FF01F-CB03-4D92-ADDE-8B458EDF3D74/SupremeYou.app/Frameworks/Alamofire.framework/Alamofire: stat() failed with errno=25
    /private/var/containers/Bundle/Application/CC8FF01F-CB03-4D92-ADDE-8B458EDF3D74/SupremeYou.app/Frameworks/Alamofire.framework/Alamofire: code signature invalid for '/private/var/containers/Bundle/Application/CC8FF01F-CB03-4D92-ADDE-8B458EDF3D74/SupremeYou.app/Frameworks/Alamofire.framework/Alamofire'

    I've been tested my app on an iPhone 11 Pro 13.3 and it was working fine until I decided to update the phone. So I update the iPhone 11 to the 13.3.1 version, and the error started to appear.

    it works fine on an iPhone 8 Plus with iOS version 13.3.

    Also it doesn't work on an iPhone 6s with iOS 13.3.1.

    Reviewed by Wasa22 at 2020-01-29 02:12
  • 4. AlamoFire full IPv6 support


    Due to http://9to5mac.com/2016/05/04/apple-will-require-ios-app-store-apps-to-support-ipv6-only-networks-from-june-1/

    I am opening this for raising a small issue, but also to ask a question.

    Is alamofire fully supporting IPv6? referencing the doc from Apple https://developer.apple.com/library/mac/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW1

    I haven't found any hardcoded IP address or reference to low level api apart those:

    is using IPv4 only: AF_INET and sockaddr_in

    Apple suggest to support also IPv6 counterparts: https://developer.apple.com/library/mac/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/UnderstandingandPreparingfortheIPv6Transition/UnderstandingandPreparingfortheIPv6Transition.html#//apple_ref/doc/uid/TP40010220-CH213-SW12

    If your code handles IPv4 types, make sure the IPv6 equivalents are handled too.

    IPv4 IPv6 AF_INET AF_INET6 PF_INET PF_INET6 struct in_addr struct in_addr6 struct sockaddr_in struct sockaddr_in6 kDNSServiceProtocol_IPv4 kDNSServiceProtocol_IPv6


    Reviewed by racer1988 at 2016-05-06 09:06
  • 5. Xcode 13 betas: Build fails in Combine

    Facing below error: SourcePackages/checkouts/Alamofire/Source/Combine.swift:25:5: Failed to build module 'Combine'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 5.5 (swiftlang-1300.0.24.14 clang-1300.0.25.10)', while this compiler is 'Apple Swift version 5.5 (swiftlang-1300.0.24.13 clang-1300.0.25.10)'). Please select a toolchain which matches the SDK.

    What did you expect to happen?

    it should build project successfully.

    What happened instead?

    Its throwing error. Same problem was in Kingfisher GitHub repository, They created new branch with fix, changed deployment target from v10 to 12

    Alamofire Environment

    Alamofire Version: 5.2.1 Dependency Manager: Swift Package Manager Xcode Version: Version 13.0 beta 3 (13A5192i) Swift Version: Swift 5 Platform(s) Running Alamofire: iOS macOS Version Running Xcode: 12.0 Beta (21A5284e)

    Reviewed by phiren at 2021-07-16 11:27
  • 6. Feature - MultipartFormData

    This pull request adds support for uploading MultipartFormData to Alamofire. I would love feedback from the community to make sure everything here is in tip-top shape before rolling it in. Any feedback would be much appreciated.


    The general idea is that you append body parts to the larger MultipartFormData object, then encode it when you want the cumulative result. Encoding can be performed in two different ways:

    1. Encoding In-Memory
    2. Encoding Data by Streaming to Disk

    Encoding In-Memory

    Encoding in-memory should only be used with small datasets. If the contentLength of the MultipartFormData is too large, you run the risk of your app being terminated due to memory usage.

    Encoding Data by Streaming to Disk

    Sometimes you need to upload a very large dataset to a server such as a bundle of large images or videos. In these cases, your dataset is too large to perform the encoding in-memory. For these cases, the MultipartFormData class supports encoding the data using a combination of input and output streams keeping the memory footprint very small.

    Uploading from Manager

    The upload methods for uploading MultipartFormData support the idea of a memory threshold. To make it as easy as possible, the memory threshold is used to determine whether the MultipartFormData can be encoded in-memory or whether it needs to be written to disk first. The default value for the memory threshold is currently set to 10MB.

    In order to make the encoding process asynchronous, the upload methods could not return a Request object directly. To handle this case, the MultipartFormDataEncodingResult enumeration was added and exposed in an encodingCompletion closure. The resulting Request object is contained as an associated value in the .Success case which can then be used to chain additional methods against. While this is a bit different than the other public APIs, it still is quite simple to use.

        URLString: "http://httpbin.org/post",
        multipartFormData: { multipartFormData in
            multipartFormData.appendBodyPart(fileURL: unicornImageURL, name: "unicorn")
            multipartFormData.appendBodyPart(fileURL: rainbowImageURL, name: "rainbow")
        encodingCompletion: { encodingResult in
            switch encodingResult {
            case .Success(let upload, _, _):
                upload.responseJSON { request, response, JSON, error in
            case .Failure(let encodingError):


    This was a fairly complicated feature to put together, so I'd really love to gather everyone's feedback. If you have a solid grasp of RFC 2388 and 2045, then please take the time to review these changes before we merge it in.

    Reviewed by cnoon at 2015-06-22 00:21
  • 7. How to debug crash in SessionDelegate.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data)?

    I'm seeing a fairly common EXC_BREAKPOINT crash in Crashlytics caused by a delegate handler in Alamofire. See below for the stack trace. The app in question is iOS 10 only, and the crash seems to happen on all devices and 10.x versions.

    Crashed: NSOperationQueue 0x170034f60 :: NSOperation 0x1708519a0 (QOS: DEFAULT)
    0  libswiftFoundation.dylib       0x100dc2e4c static Data._unconditionallyBridgeFromObjectiveC(NSData?) -> Data (__hidden#3516_:1698)
    1  Alamofire                      0x10061388c @objc SessionDelegate.urlSession(URLSession, dataTask : URLSessionDataTask, didReceive : Data) -> () + 184
    2  CFNetwork                      0x185672b1c __67-[NSURLSession delegate_dataTask:didReceiveData:completionHandler:]_block_invoke.242 + 36
    3  Foundation                     0x185993fb0 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    4  Foundation                     0x1858d8aa8 -[NSBlockOperation main] + 96
    5  Foundation                     0x1858c90a4 -[__NSOperationInternal _start:] + 620
    6  Foundation                     0x18599635c __NSOQSchedule_f + 228
    7  libdispatch.dylib              0x183d2e1bc _dispatch_client_callout + 16
    8  libdispatch.dylib              0x183d3c3dc _dispatch_queue_serial_drain + 928
    9  libdispatch.dylib              0x183d319a4 _dispatch_queue_invoke + 652
    10 libdispatch.dylib              0x183d3e34c _dispatch_root_queue_drain + 572
    11 libdispatch.dylib              0x183d3e0ac _dispatch_worker_thread3 + 124
    12 libsystem_pthread.dylib        0x183f372a0 _pthread_wqthread + 1288
    13 libsystem_pthread.dylib        0x183f36d8c start_wqthread + 4

    Due to the crash being EXC_BREAKPOINT I'm assuming it's a failing assertion somewhere and may actually be happening in the Swift/Obj-C compatibility layer before the actual delegate code is even called. But I'm not sure how to debug this and was hoping someone on here has an idea why this would happen.

    I use Alamofire for standard HTTPS requests to a JSON backend. I have one standard session manager and one background session manager. I'm setting the backgroundCompletionHandler in the app delegate as well.

    Reviewed by blixt at 2017-06-05 23:18
  • 8. Self-Signed Certificate not accepted


    I'm using Alamofire for a https connection. I use a nodejs https server. When using curl and providing the CA using --cacert <ca-file> it works just fine. However when testing in Alamofire I get this error:

    Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made." UserInfo={NSURLErrorFailingURLPeerTrustErrorKey=<SecTrustRef: 0x60c000047980>, NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, NSErrorPeerCertificateChainKey=<CFArray 0x60600015e840 [0x10c05b7b0]>{type = immutable, count = 1, values = (
        0 : <cert(0x61600007e680) s: localhost i: localhost>
    )}, NSUnderlyingError=0x6040000abe90 {Error Domain=kCFErrorDomainCFNetwork Code=-1200 "(null)" UserInfo={_kCFStreamPropertySSLClientCertificateState=0, kCFStreamPropertySSLPeerTrust=<SecTrustRef: 0x60c000047980>, _kCFNetworkCFStreamSSLErrorOriginalValue=-9802, _kCFStreamErrorDomainKey=3, _kCFStreamErrorCodeKey=-9802, kCFStreamPropertySSLPeerCertificates=<CFArray 0x60600015e840 [0x10c05b7b0]>{type = immutable, count = 1, values = (
        0 : <cert(0x61600007e680) s: localhost i: localhost>
    )}}}, NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made.

    My source looks like this:

    class Networking {
      static let manager: Manager = {
        let serverTrustPolicies: [String: ServerTrustPolicy] = [
          "localhost": .DisableEvaluation
        let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
        configuration.HTTPAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders
        return Alamofire.Manager(configuration: configuration,
          serverTrustPolicyManager: ServerTrustPolicyManager(policies: serverTrustPolicies))
      func test() {
        Networking.manager.request(.GET, "https://localhost:3000/", parameters: nil)
          .responseJSON { (response: Response<AnyObject, NSError>) in
            // nothing interesting

    I'm using Alamofire from the xcode7.1 branch.

    Reviewed by moritzsternemann at 2015-10-23 00:54
  • 9. Multiple encoding methods in single request

    I need to make a POST request with an HTTP Body with a JSON object, but I also need to use url query parameters in the same request.

    POST: http://www.mysite.com/api/create?param1=value&param2=value
    HTTP Body: { foo : [ bar, foo], bar: foo}

    Is this supported? How would I go about doing this?


    Reviewed by AnthonyMDev at 2015-03-06 21:56
  • 10. Xcode 12 Beta Archive issue

    Since Xcode 12 is available in beta I've had to give it a try. There is some issue when trying to archive Alamofire.

    Undefined symbols for architecture armv7: "type metadata for Swift._StringObject.Variant", referenced from: outlined init with take of Swift._StringObject.Variant in HTTPHeaders.o ld: symbol(s) not found for architecture armv7

    When it comes to this issue I am aware that it may be fault of new Xcode, I just would like to start the discussion on this topic.

    What did you do?

    I've tried to archive Alamofire using new Xcode12-beta

    What did you expect to happen?

    Successful archive.

    What happened instead?

    Archive failed with error Undefined symbols for architecture armv7: "type metadata for Swift._StringObject.Variant", referenced from: outlined init with take of Swift._StringObject.Variant in HTTPHeaders.o ld: symbol(s) not found for architecture armv7

    Alamofire Environment

    Alamofire version: 5.2.1 Xcode version: 12-beta Swift version: 5.3 (swiftlang-1200.0.16.9 clang-1200.0.22.5) Platform(s) running Alamofire: iOS macOS version running Xcode: 10.15.4

    Reviewed by kamzab95 at 2020-06-24 07:46
  • 11. Duplicate response when using Alamofire from 5.0.0.rc3

    Try to request to server

    Duplicate response from server

    Issue not happen if I try to use Alamofire 5.0.5-rc2. We also tried to check result from server by using ProxyServer. We found the result from server is correct. But data received by Alamofire was duplicated.

    Alamofire Environment

    **Alamofire version:After 5.0.0-rc2 **Xcode version:Any **Swift version:4.2 **Platform(s) running Alamofire:iOS

    Demo Project

    I tried to reproduce this issue with demo project. But I can not.

    Reviewed by ngminhduong at 2020-05-14 07:56
  • 12. Swift Concurrency - Docs Unclear - Upload Request Progress


    The current docs around swift concurrency are unclear. How do you get the progress from AF.upload(file, to: url)

    Feature Request

    Please update the docs with an upload example.

    Value to Alamofire

    This will make the new concurrency more accessible to new developers like myself!

    Reviewed by thatMacAdmin at 2022-01-31 21:30
  • 13. AuthenticationInterceptor blocks the refresh token request

    What did you do?

    Create AuthenticationInterceptor to manage the refresh token.

    private struct CustomCredential: AuthenticationCredential {
        var authRepository: AuthRepository
        var requiresRefresh: Bool { true }
    // MARK: - Authenticator.
    private final class CustomAuthenticator: Authenticator {
        // MARK: - Authenticator.
        func apply(_ credential: CustomCredential, to urlRequest: inout URLRequest) { }
        func refresh(_ credential: CustomCredential,
                     for session: Session,
                     completion: @escaping (Result<CustomCredential, Error>) -> Void) {
            let authRepository = credential.authRepository
            guard let refreshToken = authRepository.refreshToken else {
            let request = RefreshTokenRequest(refreshToken: refreshToken)
            _ = credential.authRepository.refreshToken(with: request) { result in
                switch result {
                case .success(let response):
                    completion(.success(CustomCredential(authRepository: authRepository)))
                case .failure:
        func didRequest(_ urlRequest: URLRequest,
                        with response: HTTPURLResponse,
                        failDueToAuthenticationError error: Error) -> Bool {
            return response.statusCode == 401
        func isRequest(_ urlRequest: URLRequest, authenticatedWith credential: CustomCredential) -> Bool {
            return credential.authRepository.refreshToken != nil
    enum AuthenticatorError: Error {
        case noRefreshTokenStored
        case requestRefresToken

    What did you expect to happen?

    The response of the refresh token request.

    What happened instead?

    When the refresh method is called and it execute the refreshToken request the request is block. No finish and no is executed.

    Alamofire Environment

    Alamofire Version: 5.4.4 with Moya 14.0.1 Dependency Manager: Swift Package Manager Xcode Version: 13.1 Swift Version: 5.5 Platform(s) Running Alamofire: iOS macOS Version Running Xcode: macOS 11.6

    Demo Project

    ℹ Please link to or upload a project we can download that reproduces the issue.

    Reviewed by ginesdeka at 2021-10-27 10:41
  • 14. Enable Manual Response Caching

    ℹ Please fill out this template when filing a feature request. 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.

    Feature requests should code examples whenever possible.

    Per our *CONTRIBUTING guidelines, we use GitHub for bugs and feature requests, not general support. Other issues should be opened on Stack Overflow with the tag alamofire.

    Please remove this line and everything above it before submitting.


    I would like to retrieve the response returned by the webservice and modify its header before it is interpreted by the Alamofire library such as a Response Interceptor. This functionality seems to be present using a ResponseCacher to modify a response before caching it. However, if you want to modify the headers to allow the response to be cached, there is currently no solution.

    Feature Request

    Have the ability to intercept the response and modify any header. This feature is available with the OkHttp library on Android https://square.github.io/okhttp/interceptors/#rewriting-responses.

    Value to Alamofire

    As mentioned above, this would allow the behavior of the response to be changed on the client side and, for example, to be able to cache the response.

    Reviewed by Alexandredenis35 at 2021-08-18 14:38
  • 15. Super slow uploads (10x time) on 1% packet loss connection

    I'm running two different network connections. One is over WIFI with 25MBit/s upload at 1% packet loss. One is over mobile with 24MBit/s upload at 0% packet loss. The first connection takes 10x as long to upload files to a Django server, while the mobile connection is a lot faster. This app is the only place where I'm experiencing slowdowns. I use this connection every day for everything else. As far as I can tell, Alamofire is the only part of the chain that could cause these slowdowns.

    Alamofire Environment

    Alamofire Version: 5.4.3 Dependency Manager: SPM Xcode Version: 12.5.1 Swift Version: 5 Platform(s) Running Alamofire: iOS 14.6 macOS Version Running Xcode: 11.4

    Demo Project

    ℹ Please link to or upload a project we can download that reproduces the issue.

      public static func uploadVideo(
        from url: URL, progress: ((Double) -> Void)? = nil, completion: ((String?) -> Void)?
      ) -> UploadRequest {
        let ext = url.absoluteString.split(separator: ".").last ?? ".binary"
        return AF.upload(multipartFormData: {
          $0.append(url, withName: "video", fileName: "video.\(ext)", mimeType: "application/octet-stream")
        }, to: "\(server)file_upload/")
        .uploadProgress {
        .response {
          let data = $0.data ?? Data()
          let string = String(data: data, encoding: .utf8) ?? ""
          let json = JSON(parseJSON: string)
          completion?(json["url"].array?.compactMap { $0.string }.first)
    Reviewed by yspreen at 2021-06-26 19:27
  • 16. Crashed: org.alamofire.session.rootQueue EXC_BREAKPOINT 0x0000000195995fb0

    What did you do?

    ℹ Work normally.

    What happened instead?

    Crashed: org.alamofire.session.rootQueue
    0  libswiftCore.dylib             0x195995fb0 _assertionFailure(_:_:file:line:flags:) + 488
    1  libswiftFoundation.dylib       0x1958777a8 Data.InlineSlice.append(contentsOf:) + 1152
    2  libswiftFoundation.dylib       0x19587f00c Data._Representation.append(contentsOf:) + 408
    3  Alamofire                      0x1028940d4 $s9Alamofire11DataRequestC10didReceive4datay10Foundation0B0V_tF + 400
    4  Alamofire                      0x10290f500 $s9Alamofire15SessionDelegateC03urlB0_8dataTask10didReceiveySo12NSURLSessionC_So0i4DataF0C10Foundation0J0VtF + 344
    5  Alamofire                      0x10290f69c $s9Alamofire15SessionDelegateC03urlB0_8dataTask10didReceiveySo12NSURLSessionC_So0i4DataF0C10Foundation0J0VtFTo + 124
    6  CFNetwork                      0x192744838 _CFNetworkHTTPConnectionCacheSetLimit + 155056
    7  Foundation                     0x193249cc8 __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 16
    8  Foundation                     0x193146b18 -[NSBlockOperation main] + 100
    9  Foundation                     0x19324bf80 __NSOPERATION_IS_INVOKING_MAIN__ + 20
    10 Foundation                     0x1931467d4 -[NSOperation start] + 784
    11 Foundation                     0x19324c978 __NSOPERATIONQUEUE_IS_STARTING_AN_OPERATION__ + 20
    12 Foundation                     0x19324c444 __NSOQSchedule_f + 180
    13 libdispatch.dylib              0x191b9193c _dispatch_block_async_invoke2 + 104
    14 libdispatch.dylib              0x191be2280 _dispatch_client_callout + 16
    15 libdispatch.dylib              0x191b8afa8 _dispatch_lane_serial_drain$VARIANT$mp + 612
    16 libdispatch.dylib              0x191b8ba84 _dispatch_lane_invoke$VARIANT$mp + 424
    17 libdispatch.dylib              0x191b95518 _dispatch_workloop_worker_thread + 712
    18 libsystem_pthread.dylib        0x1d7d175a4 _pthread_wqthread + 272
    19 libsystem_pthread.dylib        0x1d7d1a874 start_wqthread + 8

    Alamofire Environment

    **Alamofire Version: 5.4.3 Dependency Manager: **Xcode Version: 12.5 **Swift Version: 5.3 **Platform(s) running Alamofire: iOS **macOS version running Xcode: macOS Big Sur 11.4

    Demo Project

    Unfortunately I haven't repeatable test case to reproduce this crash

    Reviewed by hson252850 at 2021-05-28 04:38
🏇 A Swift HTTP / HTTPS networking library just incidentally execute on machines
🏇 A Swift HTTP / HTTPS networking library just incidentally execute on machines

Thus, programs must be written for people to read, and only incidentally for machines to execute. Harold Abelson, "Structure and Interpretation of Com

Jun 24, 2022
Simple asynchronous HTTP networking class for Swift

YYHRequest YYHRequest is a simple and lightweight class for loading asynchronous HTTP requests in Swift. Built on NSURLConnection and NSOperationQueue

May 18, 2022
ServiceData is an HTTP networking library written in Swift which can download different types of data.

ServiceData Package Description : ServiceData is an HTTP networking library written in Swift which can download different types of data. Features List

Nov 11, 2021
Easy HTTP Networking in Swift a NSURLSession wrapper with image caching support
Easy HTTP Networking in Swift a NSURLSession wrapper with image caching support

Networking was born out of the necessity of having a simple networking library that doesn't have crazy programming abstractions or uses the latest rea

Jun 11, 2022
An elegant yet powerful iOS networking layer inspired by ActiveRecord.
An elegant yet powerful iOS networking layer inspired by ActiveRecord.

Written in Swift 5 AlamoRecord is a powerful yet simple framework that eliminates the often complex networking layer that exists between your networki

Aug 7, 2020
Extensible HTTP Networking for iOS

Bridge Simple Typed JSON HTTP Networking in Swift 4.0 GET GET<Dict>("http://httpbin.org/ip").execute(success: { (response) in let ip: Dict = respo

Apr 8, 2022
QwikHttp is a robust, yet lightweight and simple to use HTTP networking library for iOS, tvOS and watchOS

QwikHttp is a robust, yet lightweight and simple to use HTTP networking library. It allows you to customize every aspect of your http requests within a single line of code, using a Builder style syntax to keep your code super clean.

Mar 20, 2022
Http - Demo for Http Layer

http Example To run the example project, clone the repo, and run pod install fro

Jan 24, 2022
Robust Swift networking for web APIs
Robust Swift networking for web APIs

Conduit Conduit is a session-based Swift HTTP networking and auth library. Within each session, requests are sent through a serial pipeline before bei

Mar 22, 2022
A type-safe, high-level networking solution for Swift apps
A type-safe, high-level networking solution for Swift apps

What Type-safe network calls made easy Netswift offers an easy way to perform network calls in a structured and type-safe way. Why Networking in Swift

Apr 27, 2022
A Swift Multiplatform Single-threaded Non-blocking Web and Networking Framework
A Swift Multiplatform Single-threaded Non-blocking Web and Networking Framework

Serverside non-blocking IO in Swift Ask questions in our Slack channel! Lightning (formerly Edge) Node Lightning is an HTTP Server and TCP Client/Serv

Jan 29, 2022
RSNetworking is a networking library written entirly for the Swift programming language.

RSNetworking is a networking library written entirly for the Swift programming language.

Feb 25, 2018
A networking library for Swift
A networking library for Swift

Nikka Nikka is a super simple Swift HTTP networking library that comes with many extensions to make it modular and really powerful. Installation Usage

Sep 14, 2021
Declarative and Reactive Networking for Swift.

Squid Squid is a declarative and reactive networking library for Swift. Developed for Swift 5, it aims to make use of the latest language features. Th

May 19, 2022
AsyncHTTP - Generic networking library written using Swift async/await

Generic networking library written using Swift async/await

May 6, 2022
A lightweight generic networking API written purely in Swift

SwiftyNetworking SwiftyNetworking library is a generic networking library writte

Dec 24, 2021
Swift implementation of libp2p, a modular & extensible networking stack
Swift implementation of libp2p, a modular & extensible networking stack

Swift LibP2P The Swift implementation of the libp2p networking stack Table of Contents Overview Disclaimer Install Usage Example API Contributing Cred

Jun 10, 2022
Type-safe networking abstraction layer that associates request type with response type.

APIKit APIKit is a type-safe networking abstraction layer that associates request type with response type. // SearchRepositoriesRequest conforms to Re

Jun 14, 2022
Lightweight Concurrent Networking Framework
Lightweight Concurrent Networking Framework

Dots Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8.0+ / macOS 10.10+ /

Mar 25, 2022