Skip to content

Instantly share code, notes, and snippets.

@wb-softwares
Created June 16, 2020 22:37
Show Gist options
  • Save wb-softwares/773e6060d34806dd2ec0b41b730aa6db to your computer and use it in GitHub Desktop.
Save wb-softwares/773e6060d34806dd2ec0b41b730aa6db to your computer and use it in GitHub Desktop.
import Foundation
import Apollo
class Network {
static let shared = Network()
let apollo: ApolloClient = {
let configuration = URLSessionConfiguration.default
configuration.httpAdditionalHeaders = [
"x-api-key": "<YOUR-API-KEY>"
]
let url = URL(string: "<YOUR-GRAPHQL-ENDPOINT>")!
return ApolloClient(
networkTransport: HTTPNetworkTransport( url: url, session: URLSession(configuration: configuration))
)
}()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment