Created
January 6, 2023 18:48
-
-
Save navsing/ff4439c0c2424db04e67d8ab9828790b to your computer and use it in GitHub Desktop.
Network Layer
This file contains hidden or 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