Here is what I used previously,
var barButtonItem = UIBarButtonItem(image: backImgs, style: UIBarButtonItemStyle.plain, target: self, action: Selector("menuButtonTapped:"))
But there is some syntax changes for Swift 3. Thanks in advance.
Here is what I used previously,
var barButtonItem = UIBarButtonItem(image: backImgs, style: UIBarButtonItemStyle.plain, target: self, action: Selector("menuButtonTapped:"))
But there is some syntax changes for Swift 3. Thanks in advance.
for Swift 4 add in
viewDidLoad
:ex:-
One line of code on Swift 3 for iOS 10.1:
You just need to change your
selector
syntax as of from Swift 3 you need to specify the first parameter name of method in your function call so change your selector like this.And your method should be like this.
Make a UIBarButtonItem:
Add to NavigationItem:
Associated function:
If anyone is using
customView
: