<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Waseem Shigri on Medium]]></title>
        <description><![CDATA[Stories by Waseem Shigri on Medium]]></description>
        <link>https://medium.com/@wasimshigri?source=rss-125071865219------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*1-4_XdQrTkdKUkp4.png</url>
            <title>Stories by Waseem Shigri on Medium</title>
            <link>https://medium.com/@wasimshigri?source=rss-125071865219------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 02:51:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wasimshigri/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Hide TabBar in swiftUI]]></title>
            <link>https://medium.com/@wasimshigri/hide-tabbar-in-swiftui-8a27e617cc17?source=rss-125071865219------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a27e617cc17</guid>
            <category><![CDATA[hidesbottombarwhenpushed]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[navigationview]]></category>
            <category><![CDATA[tab-bar]]></category>
            <category><![CDATA[ios]]></category>
            <dc:creator><![CDATA[Waseem Shigri]]></dc:creator>
            <pubDate>Wed, 13 May 2020 13:30:05 GMT</pubDate>
            <atom:updated>2020-05-13T13:48:33.895Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*tZS4wtImZfKTcar9ys_4AA.jpeg" /></figure><p>In UIKit, we use hidesBottomBarWhenPushed to hide tabBar when a viewController is pushed. But in SwiftUI, unfortunately we don’t have any such control yet. But there are work arounds for it. I will show how i handled such situation.</p><p>What you will get after reading this tutorial?</p><blockquote>You will be able to present any view over tabBar from anywhere in the app.</blockquote><p>Lets tart…</p><p>Create a <strong>BaseNavigationView</strong>. We will use TabBarView as child of thisBaseNavigationView.</p><blockquote><strong>struct</strong> BaseNavigationView&lt;Content&gt;: View <strong>where</strong> Content: View {<br>@ObservedObject <strong>var</strong> model: BaseNavigationModel<br><strong>var</strong> content: () -&gt; Content<br><strong>var</strong> body: <strong>some</strong> View {<br>NavigationView {<br>GeometryReader { geometry <strong>in<br></strong>ZStack(alignment: .center) {<br><strong>self</strong>.content()<br><strong>if</strong> <strong>self</strong>.model.mainView != <strong>nil</strong> {<br>NavigationLink(destination: <strong>self</strong>.model.mainView!, isActive: <strong>self</strong>.$model.isPushActive, label: {<br>EmptyView()<br>}).isDetailLink(<strong>false</strong>)<br>}}}}}}</blockquote><p>Now create<strong> BaseNavigationModel </strong>class. This model class is the controller of the baseNavigationView. We will create an object of this class as environmentObject, and pass it to each View in the app.</p><blockquote><strong>class</strong> BaseNavigationModel: ObservableObject {<br>@Published <strong>var</strong> isPushActive: Bool = <strong>false<br></strong>@Published<br><strong>private(set)</strong> <strong>var</strong> mainView: AnyView?</blockquote><blockquote><strong>public</strong> <strong>func</strong> pushMain&lt;Main: View&gt;(view: Main) {</blockquote><blockquote>// First pop if any other view has been pushed<br>isPushActive = <strong>false</strong></blockquote><blockquote><strong>let</strong> container = PushContainer(content: view)<br><strong>self</strong>.mainView = AnyView(container)</blockquote><blockquote>// Push view<br>isPushActive = <strong>true</strong>}}</blockquote><p>Now, create the last class <strong>PushContainerView. </strong>This will carry your destinationView.</p><blockquote>struct PushContainer&lt;Content: View&gt; : View {<br>let main: AnyView<br>var body: some View {<br>GeometryReader { proxy in<br>self.generateBody(proxy: proxy)<br>}.animation(.default)<br>}</blockquote><blockquote>init(content: Content) {<br>self.main = AnyView.init(content)<br>}</blockquote><blockquote>func generateBody(proxy: GeometryProxy) -&gt; some View {<br>return ZStack {<br>self.main<br>}}}</blockquote><p>Now, the whole idea is:<br>1. Use <strong>BaseNavigationView </strong>as the rootView of your <strong>TabBarView. <br>2. </strong>Create instance of <strong>BaseNavigationModel</strong> and pass it to each View as environmentObject. Also pass this instance to BaseNavigationView like this:</p><blockquote>struct body: some View {<strong><br></strong>BaseNavigationView(model: baseNavigationModel) {<br>TabBarView {<br>}}<br><strong>}</strong></blockquote><p>3. when you are about to push any View over tabBar, you have to call the function <strong>pushMain(view: Main) </strong>of the BaseNavigationModel. This will show your new view over tabBar. You can show view over tabbBar from anywhere in the app, without any bound.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a27e617cc17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SwiftUI deep navigations and pop to root]]></title>
            <link>https://medium.com/@wasimshigri/swiftui-deep-navigations-and-pop-to-root-fdb7869176b2?source=rss-125071865219------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdb7869176b2</guid>
            <category><![CDATA[navigation]]></category>
            <category><![CDATA[navigation-link]]></category>
            <category><![CDATA[swiftui]]></category>
            <category><![CDATA[navigationview]]></category>
            <category><![CDATA[pop]]></category>
            <dc:creator><![CDATA[Waseem Shigri]]></dc:creator>
            <pubDate>Wed, 13 May 2020 12:39:04 GMT</pubDate>
            <atom:updated>2020-05-13T13:35:02.609Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*tZS4wtImZfKTcar9ys_4AA.jpeg" /></figure><p>It’s been a year since swiftUI has been launched, but it is still in beta version. It is meant to be advanced and light-weight than the UIKit, and also makes development easy and fast, but still there are corns of using it because it still lacks multiple normal UIKit views and controls. SwiftUI has <strong>NavigationView</strong> for the <strong>UINavigationController</strong> in UIKit, but the behaviours are not totally same, specially the <strong>push</strong> and <strong>pop</strong> behaviours. As a beginner to swiftUI, it is a pain to control deep navigations. Here i am gonna show how I handle navigations and<strong> pop-to-root.</strong></p><blockquote>Create a class with a publishable flag. I call it <strong>popToRoot. </strong>Create instance of it and pass to each view as<strong> </strong>environmental object .</blockquote><blockquote><strong>class</strong> Navigation: ObservableObject{<strong><br></strong>@Published <strong>var</strong> popToRoot = <strong>false</strong><br>}</blockquote><blockquote>Use <strong>isActive </strong>flag in NavigationLink to pup/pop the DestinationView, like below. The flag <strong>isPushActive</strong> will be false by default. When we set it true, the DestinationView() itself will be pushed as a new view.</blockquote><blockquote>NavigationLink(destination: DestinationView().environmentObject(<strong>self</strong>.model), isActive: <strong>self</strong>.$isPushActive) {…}</blockquote><blockquote>Use <strong>.onReceive() {..} </strong>to listen to any change in the environmentObject flag popToRoot. When this flag is set true, we will pop the presentedView from each view in the stack.</blockquote><blockquote>.onReceive(<strong>self</strong>.model.$popToRoot) { (popToRoot) <strong>in<br>if</strong> !popToRoot { <strong>self</strong>.isPushActive = false }<br>}</blockquote><p>We will set the .onReceive() function to each view in the stack, except the leaf-view. So from any where in the app, if user sets the flag(<strong>popToRoot</strong> ) from environmentObject true, it will pop all the views in the stack.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdb7869176b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NavController in Android]]></title>
            <link>https://medium.com/@wasimshigri/navcontroller-in-android-1094b456216f?source=rss-125071865219------2</link>
            <guid isPermaLink="false">https://medium.com/p/1094b456216f</guid>
            <category><![CDATA[fragments]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[jetpack]]></category>
            <category><![CDATA[navigation]]></category>
            <dc:creator><![CDATA[Waseem Shigri]]></dc:creator>
            <pubDate>Tue, 31 Jul 2018 10:34:00 GMT</pubDate>
            <atom:updated>2018-07-31T10:51:30.381Z</atom:updated>
            <content:encoded><![CDATA[<p>NavController is one of the latest component introduced by android.It is used for navigation between the screens (Activity, Fragment, etc) of the application. By default, the Navigation Architecture Component includes support fragments and Activities as destinations, but you can also <a href="https://developer.android.com/topic/libraries/architecture/navigation/navigation-add-new">add support for new types of destinations</a>. This component is a replacement for traditional methods of moving into different screens. A visual navigation graph is also introduced in this component which helps the user to have a visual view of the navigation flows of the screens, which is somehow similar to the storyboard in xcode for iOS.</p><p>Sample of navigation-graph is given below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SA4BCOQeAo5JvGmEK3mq9A.png" /></figure><h3>Pros:</h3><ol><li>Using Fragment Transaction by hand to show and hide the fragments, is a traditional way in android. Fragment Transaction takes place asynchronously. So there are possibilities of IllegalStateExceptions because of the data race scenarios. NavController will overcome this bug.</li><li>Android has introduced another safe way of transferring arguments among the screens using the navigation controller.</li><li>This component makes testing much easier.</li><li>Deeplinks are now much easier which navigates the user to a specific screen.</li></ol><p>NavController acts as a stack.It pushes the latest view on top, and pops the latest view from top, Last-In-First-Out(LIFO).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1094b456216f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>