'I am having problem with fetching data from GraphQL
This is the GraphQL and I just want to access the character names
Even tho,I could access the movie names with the code
var films: [AllFilmsQuery.Data.AllFilm.Film] = []
and I can easily display the movie names on table cell with this
cell.textLabel?.text = film.title , I have no idea how to display characterConnection> Characters > names for a specific movie on tableView.
Here is how I retrieve data with Apollo
let query = AllFilmsQuery()
Apollo.shared.client.fetch(query: query) { result in
switch result {
case .success(let graphQLResult):
if let films = graphQLResult.data?.allFilms?.films?.compactMap({ $0 }) {
self.films = films
self.filmsTableView.reloadData()
}
case .failure(let error):
print("Error loading data \(error)")
}
}
}```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
