How to make navigation bar color clear per view?

Hi there,

I would like to make the navigation bar clear in my view.

Currently I am using the init() method to achieve this:

UINavigationBar.appearance().setBackgroundImage(UIImage(), for: UIBarMetrics.default)
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().isTranslucent = true
UINavigationBar.appearance().tintColor = .clear
UINavigationBar.appearance().backgroundColor = .clear

But this makes the navigation bar clear app-wide.

How can I make the navigation bar clear for specific view and ensure that view navigating to other views/popping modal they are returned to the default values?

P.S I tried using the onAppear method and that doesn't do anything.

How to make navigation bar color clear per view?
 
 
Q