'NSOpenPanel malfunctioning

I have an 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 won't work anymore. I reverted all my files to the version when the NSOpenPanel worked, 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?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source