NSOpenPanel malfunctioning

I have a app that needs to have a "choose file" function and I used a button hooked up to a function using NSOpenPanel to do that. But after I tried to add a drag&drop action, it wont work anymore. I revert all my files to the version when the NSOpenPanel work, but it's still the same. I also tried to restart my computer, all the same. Here's my function:

private func selectFile() {

        let openPanel = NSOpenPanel()

        openPanel.canChooseDirectories = false

        openPanel.allowsMultipleSelection = false

        openPanel.begin { response in

            if response == .OK {

                self.url = openPanel.url

            }

        }

    }

should I file a bug? should I reinstall xcode?

note: the func is embedded in a struct

NSOpenPanel malfunctioning
 
 
Q