Closed otymartin closed 3 years ago
Recreating this problem with a vanilla UIPageViewController
subclass was giving the error Unbalanced calls to begin/end appearance transitions for UIViewController
Apparently the ChildViewControllers
are being presented before the ParentViewController
has been fully presented.
I solved this by delaying the loading of data source in viewDidLoad. Is there a better way Tabman can address this problem?
override func viewDidLoad() {
super.viewDidLoad()
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.loadViewControllers()
self.addTabBar()
self.dataSource = self
}
}
@otymartin hmm I'll take a look at the Example today and see if I can figure anything out...
Quick one though - have you ever thought about just using UIKit
/ UITabBarController
for the tabs and then use SwiftUI for the VCs etc? In my experience the rough edges of SwiftUI are usually solved by interoperability with UIKit π
Hi @msaps
I've actually never used UITabBarController in my life Tabman spoiled me in that regard. I also chose it due to the TabBar delegate giving me control when user selects a tab where i need to present a VC modally - i hear that requires extra work for UITabBar
@otymartin ah sorry I might have got confused here - you're using Tabman as the tab bar and then NavigationView
etc within each child view controller (the tabs)?
Yesπ
@otymartin the example project link seems to be broken! π¬
@msaps Fixed! π
@otymartin I've managed to do a workaround that seems to behave itself - by using UINavigationController
rather than NavigationView
. Seems to be something to do with wanting the TabmanViewController
to ignore safe areas that causes it (otherwise it behaves).
Little example project attached here (this is also iOS 14 / Xcode 12 so mileage with 13 might vary?).
@msaps I'm actually blown away right now. I didn't know UINavigationController
could act as a stand-in for SwiftUI NavigationView
. That you could even set it's title within SwiftUI
π€― This is incredible thanks so much!!
Issue Description
@msaps I'm experiencing a weird NavigationBar Glitch. Since
SwiftUI's TabView
resets views when you navigate from them (iOS 13), I use Tabman and add mySwiftUI View's
asChildController
with frame equal to the host view controllers frame. On initial launch, theFirst View's
NavigationBar is laid out above the status bar but upon navigating to another Tab and coming back, the NavigationBar is properly laid out. Why is that, I can't trace the cause? I recreated the problem in this Example Project.Other useful things