I would like to know if it is possible to add an item into a TabBarController without any ViewController associate. In this way if you press this item the screen don't go to any ViewController and you can create an action to this item.
I think that it is impossible if you try to add an item without any ViewController in through StoryBoard. So, I thought in added it manually but it doesn't let me modify the TabBar programmatically:
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Directly modifying a tab bar managed by a tab bar controller is not allowed.'
UPDATE:
This is an example of how I tried to add items programatically:
class TabBarViewController: UITabBarController {
override func viewDidLoad() {
super.viewDidLoad()
let item1 = UITabBarItem(title: "item1", image: nil, selectedImage: nil)
let item2 = UITabBarItem(title: "item2", image: nil, selectedImage: nil)
let items = [item1, item2]
self.tabBar.setItems(items, animated: true)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}