title: How to create a custom navigation bar in Swift Xcode?
body: <p>I am working on a chat app for my graduation project in iOS. I designed the following navigation bar:</p>
  
  <p><a href="https://i.stack.imgur.com/EMgUO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EMgUO.png" alt="enter image description here"></a></p>
  
  <p>Now I am trying to develop above graphic in my Xcode project, but I don't know if this is the correct way to achieve this and doesn't get it like the graphic.</p>
  
  <p>I am using a xib file, that I load in my <code>ViewController.swift</code> using an instance of it. Than add it as the <code>titleView</code> of the <code>navigationItem</code>:</p>
  
  <pre><code>let helperView = HelperView()
  navigationItem.titleView = helperView
  </code></pre>
  
  <p>This is the result of above code snippet:</p>
  
  <p><a href="https://i.stack.imgur.com/Lh2fv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lh2fv.png" alt="enter image description here"></a></p>
  
  <p>The problem of this result is that it is overlapping the left bar button item and another problem, that I still doesn't figured out is, if the message bubble can have a dynamic height, when it have multiple lines (max is 3 lines).</p>
  
  <p><a href="https://i.stack.imgur.com/cG0Nf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cG0Nf.png" alt="enter image description here"></a></p>
  
  <p>Does anyone have experience with this kind of design within Xcode and is this the correct way to do this, or is there a better way to achieve this. Maybe a custom UINavigationController class? </p>