0

I am using XCode7 beta2 to play around with Swift 2. Trying to use a File-Selection Dialog (NSSavePanel) brought me into some trouble.

Running the following code by clicking the associated button won't bring up the dialog as a sheet (not at all) but make my window's decoration disappear, leaving it in a broken state where otherwise functional sheets open as dialogs without decoration. Using the call to the deprecated API beginSheetModalForWindow, like in the commented line, works like expected.

@IBAction func openFileClicked(sender: AnyObject) {
        let openPanel = NSSavePanel()
        openPanel.canCreateDirectories = true
        //openPanel.beginSheetModalForWindow(self.view.window!, completionHandler: {
        openPanel.beginSheet(self.view.window!, completionHandler: {
            (result) -> Void in
            print("opening:\(result)" )
        })
    }

Is my code broken somehow or is there a issue with the API I am calling.

techshack
  • 359
  • 2
  • 18

0 Answers0