I want to show an alert with Confirmation when user clicks on back button. This is how I\'m trying to add action.
self.navigationItem.hidesBackButton = true
I think this answer should do the job.
You basically create your button with the default style and register a selector.
And you might try this for a backButton instead of leftButton:
Objective-C
UIBarButtonItem *backBtn = [[UIBarButtonItem alloc] init];
[desVC.navigationItem setBackBarButtonItem:backBtn];
Swift
let backBtn = UIBarButtonItem()
self.navigationItem.backBarButtonItem = backBtn