How to set navigation bar to solid color : <p>When I change the background color of the navigation bar, it is opaque like the following.</p>

<pre><code>UINavigationBar.appearance().backgroundColor = .black
</code></pre>

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

<p>Then if I set translucent to false, I don't see any color like the following</p>

<pre><code>UINavigationBar.appearance().backgroundColor = .black    
UINavigationBar.appearance().isTranslucent = true
</code></pre>

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

<p>Any idea on how to make a solid background color?</p>
