Description
I've encountered an issue with NavigationSplitView on visionOS when using a refreshable ScrollView or List in the detail view.
The Problem: When implementing pull-to-refresh in the detail view of a NavigationSplitView, the ProgressView disappears and generates this warning:
Trying to convert coordinates between views that are in different UIWindows, which isn't supported. Use convertPoint:fromCoordinateSpace: instead.
I discovered that if the detail view includes a .navigationTitle()
, the ProgressView remains visible and works correctly!
Below is a minimal reproducible example showing this behavior. When you run this code, you'll notice:
- The sidebar refreshable works fine
- The detail refreshable works only when
.navigationTitle("Something")
is present - Remove the navigationTitle and the detail view's refresh indicator disappears
minimal Demo
import SwiftUI
struct MinimalRefreshableDemo: View {
@State private var items = ["Item 1", "Item 2", "Item 3"]
@State private var detailItems = ["Detail 1", "Detail 2", "Detail 3"]
@State private var selectedItem: String? = "Item 1"
var body: some View {
NavigationSplitView {
List(items, id: \.self, selection: $selectedItem) { item in
Text(item)
}
.refreshable {
items = ["Item 1", "Item 2", "Item 3"]
}
.navigationTitle("Chat")
} detail: {
List {
ForEach(detailItems, id: \.self) { item in
Text(item)
.frame(height: 100)
.frame(maxWidth: .infinity)
}
}
.refreshable {
detailItems = ["Detail 1", "Detail 2", "Detail 3"]
}
.navigationTitle("Something")
}
}
}
#Preview {
MinimalRefreshableDemo()
}
Is this expected behavior? Has anyone else encountered this issue or found a solution that doesn't require adding a navigation title?