It works well, if it is the first view when the app start. Else, it doesn't work well within Navigation. why?? I have no clues.
struct TestView: View {
@StateObject var viewModel = TestViewModel1()
@State var data : [String] = ["one", "two", "three", "four", "five", "one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "five","one", "two", "three", "four", "bottom most" ]
@State var scrollToId = "hi"
var body: some View {
ScrollViewReader { proxy in
List{
ForEach(0..<data.count, id : \.self){ index in
Text(data[index])
.frame(minWidth : 0, maxWidth : .infinity)
}
Text("")
.frame(minHeight : 0, maxHeight: 0)
.id(self.scrollToId)
}
.onAppear{
proxy.scrollTo(self.scrollToId)
}
}
}
}
With navigation, "scrollTo" doesn't work
Without navigation, it works well
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm integrating Apollo GraphQL into a SwiftUI app and encountering the following error during a query execution:
result : failure(Apollo.MultipartResponseParsingInterceptor.ParsingError.cannotParseResponse)
failed : The response data could not be parsed.
The request hits the server, but the response fails to be parsed by Apollo. I'm using the default code generation setup and executing a simple query to fetch a list of countries.
Here’s a snippet of the function:
swift
Copy
Edit
private func fetchCountries() {
switch result {
case .success(let graphQLResult):
if let name = graphQLResult.data?.countries {
print(name)
} else if let errors = graphQLResult.errors {
print(errors)
}
case .failure(let error):
print("failed : (error.localizedDescription)")
}
}
This is run on an iPhone 16 Pro simulator with iOS 18.2. Any idea what's causing the parsing error or how I can inspect the raw response for debugging?
Thanks in advance!