title: How to set UINavigationItem from UINavigationBar class?
body: <p>Currently I am doing some custom navigation bar. For the requirement, I need to do it from code, and better if I can also do it from storyboard.</p>
  <pre><code>public class MyNavigationBar : UINavigationBar {
  
  public override init(frame: CGRect) {
      super.init(frame: frame)
      initView()
  }
  
  required init?(coder: NSCoder) {
      super.init(coder: coder)
  }
  
  public override func awakeFromNib() {
      initView()
  }
  
  private func initView()  {
      let leftBarButtonItem = UIBarButtonItem(title: &quot;Title&quot;, style: .plain, target: self, action: nil)
      let rightBarButtonItem = UIBarButtonItem(image: UIImage(named:&quot;Arrow&quot;), style: .plain, target: self, action: nil)
      let items = UINavigationItem()
      items.leftBarButtonItem = leftBarButtonItem
      items.rightBarButtonItem = rightBarButtonItem
      self.setItems([items], animated: false)
  }}
  </code></pre>
  <p>If I use storyboard and set navigation bar class, it set the bar buttons successfully.
  But If I try to do it by code like this:</p>
  <pre><code>let navigationController = UINavigationController(navigationBarClass: MyNavigationBar.self, toolbarClass: UIToolbar.self)
  let mainStoryboard: UIStoryboard = UIStoryboard(name: &quot;Main&quot;, bundle: nil)
  let secondViewController = mainStoryboard.instantiateViewController(withIdentifier: &quot;NewViewController&quot;) as! NewViewController
  navigationController.viewControllers = [secondViewController]
  UIApplication.shared.windows.first?.rootViewController = navigationController
  UIApplication.shared.windows.first?.makeKeyAndVisible()
  </code></pre>
  <p>The items can't be set successfully. (the iniView() method is called, and can find MyNavigationBar() in debug view hierarchy)</p>