Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To turn off refreshable in a nested view that is displayed as a sheet or full screen cover in SwiftUI, you can use the following code:

.sheet(isPresented: $showSheet) {
    NestedView()
        .onAppear {
            UIScrollView.appearance().isRefreshingEnabled = false
        }
        .onDisappear {
            UIScrollView.appearance().isRefreshingEnabled = true
        }
}

In this code, NestedView is the view that contains the scroll view with the refreshable content. The onAppear and onDisappear modifiers are used to set the isRefreshingEnabled property of the UIScrollView.appearance() instance to false when the sheet is presented and to true when it is dismissed. This will disable the refresh control for the nested view when the sheet or full screen cover is displayed, and enable it again when the view is dismissed.