title: how to create an action a tabbar item programmatically
body: <p>I have created a tabbar with code, but I do not know how to capture when someone clicks on an item, some idea of ​​how I can do it?</p>
  
  <pre><code>private func setNav()
  {
      tabBar = UITabBarController()
      menuItemNavList = Array&lt;UINavigationController&gt;()
      for i in (0..&lt;menuItemModelList.count) {
          menuItemNavList.append(createNavController(title: menuItemModelList[i].title ?? "", imageName: menuItemModelList[i].iconUrl ?? "p"))
      }
      tabBar.viewControllers = menuItemNavList
      tabBar.tabBar.tintColor = .white
      tabBar.tabBar.barTintColor = UIColor(red: 31/255, green: 192/255, blue: 241/255, alpha: 1.0)
      self.view.addSubview(tabBar.view)
  }
  
  private func createNavController(title: String, imageName: String)-&gt; UINavigationController
  {
      let viewController = UIViewController()
      let navController = UINavigationController(rootViewController: viewController)
      navController.tabBarItem.title = title
      let url = URL(string: imageName)
      let data = try? Data(contentsOf: url!)
      navController.tabBarItem.image = data != nil ? UIImage(data: data!) : UIImage(named: "icono_home")
      return navController
  }
  </code></pre>