0

I'm working on a flutter package for all 6 Platforms and now I'd like to open a Save As dialog (I'm total amateur in Swift), so I'm getting an exception when Initializing the object of NSSavePanel, I tried multiple ways, the most basic was

let panel = NSSavePanel()

and well here I'm getting a exception breakpoint which says Thread 1: EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)

So here is my full class where I'm getting the exception

class Dialog {
func openSaveAsDialog(params: Params){
    let panel = NSSavePanel()
    panel.directoryURL = FileManager.default.urls(for: .desktopDirectory, in: .userDomainMask).first
    panel.nameFieldStringValue = params.fileName!+"."+params.ext!
    panel.level = .modalPanel
    panel.runModal()
    }
}

and as per @EricAya's suggestion in the comment, I'm calling this method as

let params = Params(arguments)
DispatchQueue.main.async {
   let dialog = Dialog()
   dialog.openSaveAsDialog(params: params)
}
Hassan Ansari
  • 318
  • 1
  • 3
  • 11

0 Answers0