Hello,
in my Mac Catalyst app, I have detail view with sections modeled as DisclosureGroups. The label view has a button, that shall trigger a file import view when pushed. The label view is defined as follows:
swift
HStack {
Text(LocalizedStringKey("Documents")).font(.title)
Spacer()
Button {
showFileImporter = false
// fix broken picker sheet
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
showFileImporter = true
}
} label: {
Image(systemName: "doc.badge.plus")
.padding(.horizontal, 10)
}
.disabled(!expanded)
.fileImporter(
isPresented: $showFileImporter,
allowedContentTypes: [.data],
allowsMultipleSelection: false) { result in
// add fileUrl.startAccessingSecurityScopedResource() before accessing file
NSLog("\(result)")
}
}
Unfortunately the file import view is not showing, when the button is pushed, although the state changes to true.
Does anybody have any hints?
BTW the repo is available at https://github.com/thbonk/repti/tree/ui-refactoring
The view in question is https://github.com/thbonk/repti/blob/ui-refactoring/Repti/Source/UI/Views/IndividualDetails/DocumentsSubview.swift
Thanks & Best regards
Thomas