Post

Replies

Boosts

Views

Activity

Navigation + Tabview + Sheet broken in iOS 15
It looks like Navigation + TabView + Sheet is broken in iOS 15. When I do this: ContentView -> DetailView -> Bottom Sheet When the bottom sheet comes up, the Detail view is automatically popped off the stack: https://www.youtube.com/watch?v=gguLptAx0l4 I expect the Detail view to stay there even when the bottom sheet appears. Does anyone have any idea on why this happens and how to fix it? Here is my sample code: import SwiftUI import RealmSwift struct ContentView: View { var body: some View { NavigationView { TabView { TabItemView(num: 1) .tabItem { Text("One") } TabItemView(num: 2) .tabItem { Text("Two") } } } } } struct TabItemView: View { private let num: Int init(num: Int) { self.num = num } var body: some View { NavigationLink(destination: DetailView(text: "Detail View \(num)")) { Text("Go to Detail View") } } } struct DetailView: View { @State private var showingSheet = false private let text: String init(text: String) { self.text = text } var body: some View { Button("Open Sheet") { showingSheet.toggle() }.sheet(isPresented: $showingSheet) { Text("Sheet Text") } } } This works on iOS 14.
1
0
794
Dec ’21
iOS 15 Navigation broken with SwiftUI, Combine, and Realm
I have an app that uses Realm as a data storage solution and Combine as a declarative framework. Ever since I upgraded to iOS 15, my app has become unusable because of what looks like a navigation bug. It works fine with iOS 14. The gist of what I believe the bug is, is that when I navigate to a child view and the parent view is updated, the navigation jumps back to the parent view instead of staying in the child view (https://www.youtube.com/watch?v=c-PAPy-RCqg) So in my example, ContentView loads data Realm and creates a list of DetailViews to display the data. When the DetailView is displayed, it writes some back to the Realm table. I have a sample app demonstrating the problem here: https://github.com/skywalkerdude/navsample. Since it is using Cocoapods, make sure you open NavSample.xcworkspace and not NavSample.xcodeproj.
1
0
763
Sep ’21