'How to remove navigation bar colour clear in swift4?

I want to clear color of navigation bar. In my ViewController there is a background image on that, when i remove color of navigation barTintColor, navigationController.view.background and navigation background image then simulator shows me :- enter image description here

I have been trying alots of codes but there is no solution found. I want navigation Bar like that:- enter image description here

with clear navigation bar color. Is there any solution, let me know? Thanks!



Solution 1:[1]

Better you must avoid the navigation bar. Hide the navigation bar in the navigation controller and user custom view in your view controller to avoid this issue.

Solution 2:[2]

Swift 5:: Calling below in AppDelegate's didFinishLaunchingWithOptions function does the trick (This will be applied to your all navigationBars though, don't forget to switch your view controllers)

let navBarAppearance = UINavigationBarAppearance()
navBarAppearance.configureWithTransparentBackground()
            
navigationController?.navigationBar.standardAppearance = navBarAppearance
navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sureshkumar
Solution 2 alidinc