Swift: how to hide back button on the first view controllers of tab bar controller?
<p>My Tab Bar Controller controls 5 view controllers and I want that in those 5 main pages all the back buttons are disabled and not visible. How can I do that correctly? I have tried all Swift commands seen here in SO but none has worked up to now.</p>

<p><a href="https://i.stack.imgur.com/Lr0x3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Lr0x3.png" alt="enter image description here"></a></p>

<p>I have tried with</p>

<pre><code>override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationItem.hidesBackButton = true
}

override func viewWillAppear(animated: Bool) {
    self.navigationItem.hidesBackButton = true
}
</code></pre>

<p>but they don't work. I have also tried with</p>

<p><code>self.tabBarController?.navigationItem.hidesBackButton = true</code> </p>

<p>but this is the strange result</p>

<p><a href="https://i.stack.imgur.com/1BohI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1BohI.png" alt="enter image description here"></a></p>