I have added one custom bar button in my app.I want to set it's title but i am not able to set its title.I am using below code in swift 3.Please advice the best solution.
let customButton=UIButton(frame: CGRect(x: 0, y: 0, width: 60, height:30))
customButton.backgroundColor=Constant.Color.customBlue
customButton.titleLabel?.text = "Add"
customButton.titleLabel?.textColor=UIColor.white
let barButton = UIBarButtonItem(customView:customButton)
barButton.title="Add"
barButton.tintColor=UIColor.white
self.navigationItem.rightBarButtonItem=barButton