I setup a UIToolBar inside a function named toolBarSetup inside a class.
public class Utility {
func toolBarSetup(inout toolBar: UIToolbar, inout toolBarLbl: UILabel, view: UIView) -> (UIToolbar, UILabel){
toolBar = UIToolbar(frame: CGRectMake(0, view.frame.height/7, view.frame.width, 44.0))
let toolBar_btn = UIBarButtonItem(title: "Cancel", style: UIBarButtonItemStyle.Plain, target: self, action: "picker_cancel")
//Codes to setup toolbar label
toolBar.setItems([toolBar_btn, flexSpace, text_info, flexSpace], animated: true)
return (toolBar, lbl_toolBar_cancel)
}
}
From another class I'm calling this function
class Class1: UIViewController {
var toolBar = UIToolbar()
var lbl_toolBar = UILabel()
override func viewDidLoad() {
super.viewDidLoad()
let toolBarSetup = Utility().toolBarSetup(&toolBar, lbl_toolBar: &lbl_toolBar, view: view)
toolBar = toolBarSetup.0
lbl_toolBar = toolBarSetup.1
}
func picker_cancel(){
}
}
Earlier the function picker_cancel() was working fine but yesterday I have updated my Xcode after that I'm getting this warning
No method declared with Objective-C selector 'picker_cancel()'
in the below line of class 'Utility'.
let toolBar_btn = UIBarButtonItem(title: "Cancel", style: UIBarButtonItemStyle.Plain, target: self, action: "picker_cancel")
I tried to solve by using selector but nothing worked. Please help.