Created
June 16, 2020 22:37
-
-
Save wb-softwares/773e6060d34806dd2ec0b41b730aa6db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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