Skip to content

Instantly share code, notes, and snippets.

View imthath-m's full-sized avatar
💭
developmentMode

Mohammed Imthathullah imthath-m

💭
developmentMode
View GitHub Profile
@imthath-m
imthath-m / 0_UIKitTabView.swift
Created April 8, 2020 02:02 — forked from Amzd/UIKitTabView.swift
SwiftUI tab bar view that respects navigation stacks when tabs are switched (unlike the TabView implementation)
import SwiftUI
/// An iOS style TabView that doesn't reset it's childrens navigation stacks when tabs are switched.
struct UIKitTabView: View {
var viewControllers: [UIHostingController<AnyView>]
@State var selectedIndex: Int = 0
init(_ views: [Tab]) {
self.viewControllers = views.map {
let host = UIHostingController(rootView: $0.view)