Hi, Alex here from rebeloper.com and welcome back to the channel and welcome back to
this awesome tutorial series on SwiftUI inside UIKit. That is right SwiftUI
inside UIKit and today we are going to hide the navigation bar but not as you
might think of. So let's just jump right into it.
Okay! Today we are going to hide
the navigation controller, navigation item, a navigation bar may yeah so in the
previous episode I have talked about how you can navigate with DuckUI make sure
that you have updated to the latest of cocoa pod version of DuckUI and let
me just build and run this so I can show you what we have achieved here.
So basically we have three buttons a navigation controller, we have a root
here and let's just navigate from left to right, okay. And when we tap on this
close button it will pop to the left. So that is navigation controller pop to
left and let me just really easily show you pop to you let's say button.
Okay! Let's just build and run again. Go ahead and make sure that you are
going to take a look at the whole playlist or at least at the previous
episode. So we want to push from a bottom or rather yet to push from top right now.
So we have slided that down and now we want to push to bottom, okay. And if you do
that it's okay. So it doesn't really matter as long as you it makes sense for
you. But today we want to let me just again
show this so here we have our default navigation bar and I want to remove all
of this greyish stuff. I want to have only the title and this button. So what we
want to do here is a make sure that we have this UINavigationController
process within the DuckUI cocoa pods
framework and if you scroll all the way up you will see that set navigation item
background hidden. There is that function for you and we are going to use
that right now. So where do you want to add that? You want to add that in the
view will appear. So let's see navigation controller. Do we have
something or set navigation bar hidden and if we set this to true maybe
animated true what that will do is hide all of the animations. So let's just
build a new one and see how that looks like. So there we go. No navigation, we
can't see the title, or the close button. But we want to use this set navigation
item background to be hidden. So Let see set navigation item background to be hidden
true, okay. And let's just build run and see that we will have the title and
button show up but not the background. Okay! Real nice, real nice and if you
would have an image here it would be showed. Let's just close that and as you
can see we have our background for the route again hidden. So what you want to
do is set the navigation item background in the view will disappear to false, okay.
And that will have the invert effect and that will just simply show the
navigation item background on the root view controller. Now that is it for me
today. Hope you enjoyed this really short video if you did go ahead and give it a
thumbs up, subscribe to the channel and hit that notification bell to get
notified of new videos as they do come out and as usual I will see you in the next one.