Hi everyone,
I'm having a problem with a refreshable list view in my App. This problem occurred just recently after making the switch to Xcode 15 + Sonoma + iOS 17 and did not occur with Xcode 14 + Ventura + iOS16.
Let me show you what's bothering me. Look at this simple list.
Now let's swipe down and reveal a file importer to choose a file and do some stuff (I edited the picture to hide the names of the files). This picture shows the file importer:
After selecting a file this happens. See the that "progress indicator" thing? I think it's from the refreshable action, however it doesn't disappear. It will stay there indefinitely until you actual start swiping on the list.
I'm pretty sure this "progress indicator" thing didn't stay there and disappeared when using Xcode 14 + Ventura + iOS16.
Is it just me or does anybody have the same issue with Xcode 15 + Sonoma + iOS 17 ?
Here is the code I used if you want to try it out for yourself. Here is the lContentView with the list:
//
// ContentView.swift
// ProblemDebug
//
// Created by Olison on 29.09.23.
//
import SwiftUI
struct ContentView: View {
@State var fileImporterVisible: Bool = false
var body: some View {
List {
Text("This is a refreshable list. Swipe down!")
Text("Let's see what happens ...")
}
// REFRESHABLE
.refreshable(action: {
fileImporterVisible.toggle()
})
// SHOW SHEET WHEN fileImporterVisible IS TOGGLED
.sheet(isPresented: $fileImporterVisible, content: {
ViewFileImporter(fileImporterVisible: $fileImporterVisible)
})
}
}
#Preview {
ContentView()
}
And here is the view with file importer:
//
// ViewFileImporter.swift
// ProblemDebug
//
// Created by Olison on 29.09.23.
//
import SwiftUI
struct ViewFileImporter: View {
@Binding var fileImporterVisible: Bool
var body: some View {
ZStack {
// DO SOMETHING ...
}
.fileImporter(isPresented: $fileImporterVisible, allowedContentTypes: [.plainText, .pdf], onCompletion: { result in
switch result {
case .success(let spxFileImporterURL):
if spxFileImporterURL.startAccessingSecurityScopedResource() {
print(spxFileImporterURL.absoluteString)
} else {
spxFileImporterURL.stopAccessingSecurityScopedResource()
}
case .failure(let spxFileImporterError):
print(spxFileImporterError.localizedDescription)
}
})
}
}
#Preview {
ViewFileImporter(fileImporterVisible: .constant(false))
}