{"id":15192367,"url":"https://github.com/graphql-community/apolloalamofire","last_synced_at":"2025-10-02T07:30:38.287Z","repository":{"id":56902122,"uuid":"131724758","full_name":"graphql-community/ApolloAlamofire","owner":"graphql-community","description":"Alamofire transport for Apollo iOS GraphQL library","archived":true,"fork":false,"pushed_at":"2020-05-07T01:05:25.000Z","size":234,"stargazers_count":61,"open_issues_count":4,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-30T01:51:06.782Z","etag":null,"topics":["alamofire","apollo","apollographql","graphql","graphql-client","ios","swift"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphql-community.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"MaxDesiatov","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-05-01T14:47:08.000Z","updated_at":"2023-01-28T10:54:41.000Z","dependencies_parsed_at":"2022-08-20T18:10:11.642Z","dependency_job_id":null,"html_url":"https://github.com/graphql-community/ApolloAlamofire","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/graphql-community/ApolloAlamofire","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-community%2FApolloAlamofire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-community%2FApolloAlamofire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-community%2FApolloAlamofire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-community%2FApolloAlamofire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphql-community","download_url":"https://codeload.github.com/graphql-community/ApolloAlamofire/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphql-community%2FApolloAlamofire/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277974403,"owners_count":25908396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-02T02:00:08.890Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alamofire","apollo","apollographql","graphql","graphql-client","ios","swift"],"created_at":"2024-09-27T21:22:47.028Z","updated_at":"2025-10-02T07:30:38.049Z","avatar_url":"https://github.com/graphql-community.png","language":"Swift","funding_links":["https://github.com/sponsors/MaxDesiatov"],"categories":[],"sub_categories":[],"readme":"# ApolloAlamofire\n\n### Alamofire transport implementation for Apollo GraphQL iOS library.\n\n[![CI Status](https://img.shields.io/travis/graphql-community/ApolloAlamofire/master.svg?style=flat)](https://travis-ci.org/graphql-community/ApolloAlamofire/)\n[![Version](https://img.shields.io/cocoapods/v/ApolloAlamofire.svg?style=flat)](https://cocoapods.org/pods/ApolloAlamofire)\n[![License](https://img.shields.io/cocoapods/l/ApolloAlamofire.svg?style=flat)](https://cocoapods.org/pods/ApolloAlamofire)\n[![Platform](https://img.shields.io/cocoapods/p/ApolloAlamofire.svg?style=flat)](https://cocoapods.org/pods/ApolloAlamofire)\n\n## Deprecation Notice\n\nSince all of the issues that ApolloAlamofire worked around have been fixed in [Apollo 0.27.0](https://github.com/apollographql/apollo-ios/releases/tag/0.27.0), you're encouraged to update to the latest version of Apollo and rely on those new features instead of using ApolloAlamofire. Thanks to our users and their support during the last few years! ApolloAlamofire is going to be deprecated and its repository archived. Please open an issue if you think there's still a use case for this library.\n\n## What's This For?\n\nIf you used [Apollo iOS](https://github.com/apollographql/apollo-ios) library,\nyou may have stumbled upon a few limitations of a standard `HTTPNetworkTransport`\nprovided with the library:\n\n- [Can't swap request headers without creating a new `ApolloClient` instance](https://github.com/apollographql/apollo-ios/issues/37)\n- [Can't send requests when the app is in background](https://stackoverflow.com/questions/50089546/how-to-correctly-use-apollo-graphql-on-ios-with-background-session-configuration)\n- [Can't log request/response data](https://github.com/apollographql/apollo-ios/pull/257)\n\nFortunately, Apollo iOS provides a public `NetworkTransport` protocol that allows\nus to override behaviour that's limited. Looks like [Alamofire](https://github.com/Alamofire/Alamofire)\nis the most popular iOS networking library and all of the mentioned limitations can be solved\nwith it. You also probably use Alamofire anyway to acquire authentication tokens for your\nGraphQL API, so it makes sense to integrate both Alamofire and Apollo iOS.\n\nThis package bundles a `NetworkTransport` implementation that wraps Alamofire\nand solves these limitations.\n\n## Example\n\nWhen initialising a new `ApolloClient` instance instead of\n\n```swift\nlet u = URL(string: \"http://localhost:8080/graphql\")!\nlet client = ApolloClient(url: u)\n```\n\nor instead of\n\n```swift\nlet u = URL(string: \"http://localhost:8080/graphql\")!\nlet client = ApolloClient(networkTransport: HTTPNetworkTransport(url: u))\n```\n\nuse\n\n```swift\nimport ApolloAlamofire\n\n//...\nlet u = URL(string: \"http://localhost:8080/graphql\")!\nlet client = ApolloClient(networkTransport: AlamofireTransport(url: u))\n```\n\nThere are additional parameters available for `AlamofireTransport` initialiser, e.g. for\na background session you can use it like this:\n\n```swift\nlet c = URLSessionConfiguration.background(withIdentifier: \"your-id\")\nlet u = URL(string: \"http://localhost:8080/graphql\")!\nlet s = SessionManager(configuration: c)\nlet t = AlamofireTransport(url: u, sessionManager: s)\nlet client = ApolloClient(networkTransport: t)\n```\n\nlike this for auth headers:\n\n```swift\nlet token = \"blah\"\nlet u = URL(string: \"http://localhost:8080/graphql\")!\nlet h = [\"Authorization\": \"Bearer \\(token)\"]\nlet t = AlamofireTransport(url: u, headers: h)\nlet client = ApolloClient(networkTransport: t)\n```\n\nor like this for request and response logging:\n\n```swift\nlet u = URL(string: \"http://localhost:8080/graphql\")!\nlet t = AlamofireTransport(url: u, loggingEnabled: true)\nlet client = ApolloClient(networkTransport: t)\n```\n\nBoth `headers` and `loggingEnabled` are also variable properties of `AlamofireTransport`.\nThis allows you to change headers without instantiating a new transport, e.g. when a user\nlogs out and a different user logs in you can swap authentication headers. If you switch\nlogging dynamically, `loggingEnabled` property can be controlled in the same way\nwithout creating a new `AlamofireTransport` instance.\n\nNice feature of Alamofire is that request logging prints a ready for use\n[curl command](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output), which you can directly copy and paste in terminal to test a request.\n\nAll of the initialiser parameters except `url` have sensible default values and can be used\nin a combination that works best for you.\n\nTo run the example project, clone the repo, and open `Example/ApolloAlamofire.xcworkspace` in Xcode.\n\n## Requirements\n\n- Xcode 10.0 or later\n- Swift 4.2 or later\n- iOS 9.0 deployment target or later.\n\nIf you integrate the library with CocoaPods, Alamofire and Apollo iOS\ndependencies are pulled automatically. Currently tested compatible versions are\nAlamofire 4.x and Apollo iOS 0.10.x.\n\nIf you need Xcode 9 and Swift 4.0 support in your project you can use earlier\nversion of ApolloAlamofire: [0.3.0](https://github.com/graphql-community/ApolloAlamofire/tree/0.3.0).\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager for Swift and\nObjective-C Cocoa projects. You can install it with the following command:\n\n```bash\n$ gem install cocoapods\n```\n\nNavigate to the project directory and create `Podfile` with the following\ncommand:\n\n```bash\n$ pod install\n```\n\nInside of your `Podfile`, specify the `ApolloAlamofire` pod:\n\n```ruby\npod 'ApolloAlamofire', '~\u003e 0.6.0'\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\nOpen the the `YourApp.xcworkspace` file that was created. This should be the\nfile you use everyday to create your app, instead of the `YourApp.xcodeproj`\nfile.\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a dependency manager that\nbuilds your dependencies and provides you with binary frameworks.\n\nCarthage can be installed with [Homebrew](https://brew.sh/) using the following\ncommand:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nInside of your `Cartfile`, add GitHub path to `ApolloAlamofire`:\n\n```ogdl\ngithub \"graphql-community/ApolloAlamofire\" ~\u003e 0.6.0\n```\n\nThen, run the following command to build the framework:\n\n```bash\n$ carthage update\n```\n\nDrag the built framework into your Xcode project.\n\n## Maintainer\n\n[Max Desiatov](https://desiatov.com)\n\n## License\n\nApolloAlamofire is available under the MIT license. See the [LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-community%2Fapolloalamofire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphql-community%2Fapolloalamofire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphql-community%2Fapolloalamofire/lists"}