On macOS I'm seeing that only one .fileImporter modifier is called when two are defined. Anybody seeing the same issue?
The scenario I have is two different file sources share the same file extension but they need to be loaded by two slightly different processes.
Select the first option. Nothing happens. Select the second option, it works. Seeing this also in another project.
Because the isPresented value is a binding, it isn't straightforward to logically OR the boolean @States and conditionally extract within the import closure.
@main
struct Dual_File_Importer_ExpApp: App {
@State private var showFirstDialog = false
@State private var showSecondDialog = false
var body: some Scene {
DocumentGroup(newDocument: Dual_File_Importer_ExpDocument()) { file in
ContentView(document: file.$document)
.fileImporter(isPresented: $showFirstDialog, allowedContentTypes: [.commaSeparatedText]) { result in
print("first")
}
.fileImporter(isPresented: $showSecondDialog, allowedContentTypes: [.commaSeparatedText]) { result in
print("second")
}
}
.commands {
CommandGroup(after: .importExport)
{
Button("Import First")
{
showFirstDialog.toggle()
}
Button("Import Second")
{
showSecondDialog.toggle()
}
}
}
}
}```