Use #selector instead of explicitly constructing a Selector

Viewed 7096

In the following snippet, what is the reason why Xcode recommend "Use #selector instead of explicitly constructing a Selector"?

// addButton = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.Add, 
//             target: self, action: #selector(FoldersMaintenanceVC.addButtonPressed))
addButton = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.Add, 
            target: self, action: Selector("addButtonPressed"))

self.navigationItem.leftBarButtonItem = addButton

func addButtonPressed()
{
    myNslogSys2(self, funcName:#function)
}
3 Answers
Related