Skip to content

Instantly share code, notes, and snippets.

@navsing
Created January 6, 2023 18:49
Show Gist options
  • Save navsing/b117a42c7fc848a4315be5e6cfb376b1 to your computer and use it in GitHub Desktop.
Save navsing/b117a42c7fc848a4315be5e6cfb376b1 to your computer and use it in GitHub Desktop.
Fetch GraphQL
Network.shared.apollo.fetch(query: ListPersonQuery) { result in
switch result {
case .success(let graphQLResult):
if let items = graphQLResult.data?.listPerson?.items {
for conf in items {
if let curPerson = conf {
//Do whatever here with your Graphql Result
print(curPerson)
}
}
}
self.loading = false
case .failure(let error):
print("Failure! Error: \(error)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment