Post

Replies

Boosts

Views

Activity

Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
I also face similar issue and wrote about it in another post: https://developer.apple.com/forums/thread/760041 I can confirm that the usage NavigationPath fixes this issue but the other issues appear. A views that weren't pushed appear in path and I have to pop the several times. So it seems that the combination TabView + NavigationStack inside is buggy. Two notes: I tried to use iOS 17+ @Observable approach. It didn’t help. Using @State var path: [RouterDestination] = [] directly inside View seems to help. But it is not what I want as I need this property to be @Published and located inside custom Router class where I can get an access to it, and use for programmatic navigation if needed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’24
Reply to iOS 18 beta bug: NavigationStack pushes the same view twice
@DTS Engineer thank you for your answer. But what I don't want to use the type-erased data representation and still want to use my custom data type. I need that for correct programmatic routing in my app and for understanding of the exact path of my current router. There is an Apple's API for that so I expect to use my custom type. It is still NOT FIXED in Xcode 16 beta 5 + iOS 18.0 beta 5 and the same issue happens. Any plans to fix it? Thank you. enum RouterDestination: Hashable { case next }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
@sjb_s @dderg @brebispanique @DTS Engineer Here is the full code (a modification of @sjb_s 's example) that still DOESN'T work well. The main reason is that navigationDestination is located in View extension. It is how it is designed in my real app where I have a single navigationDestination for the whole app and all possible routes inside it. Everything works well in iOS 17.x with this approach, but still doesn't work well in iOS 18.0 Beta 5. Any ideas? import SwiftUI class Item: Identifiable, Hashable { var name: String init(name: String) { self.name = name } static func == (lhs: Item, rhs: Item) -> Bool { lhs.name == rhs.name } func hash(into hasher: inout Hasher) { hasher.combine(name) } } class Model: ObservableObject { @Published var path = [Item]() } struct ContentView: View { var items = [ Item(name: "Item 1"), Item(name: "Item 2"), Item(name: "Item 3"), ] @StateObject private var model = Model() var body: some View { TabView { Text("Go to Tab 2") .tabItem { Label("Tab 1", systemImage: "storefront") } .tag("1") tab2() .tabItem { Label("Tab 2", systemImage: "globe") } .tag("2") } } @ViewBuilder func tab2() -> some View { NavigationStack(path: $model.path) { List(items) { item in NavigationLink(item.name, value: item) } .withAppRouter() } } } extension View { func withAppRouter() -> some View { navigationDestination(for: Item.self) { item in DetailView(item: item) } } } struct DetailView: View { var item: Item var body: some View { Text("Details...\(item.name)") } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
@sjb_s thank you for your feedback. You can see my code in the post above that contains the code that always fails (double-push always happens) and some explanation. Also I created the Bug report with the full descriptions and steps how to reproduce this bug: https://feedbackassistant.apple.com/feedback/14743917 @DTS Engineer we really your help here please.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’24
Reply to @Observable/@State memory leak
@okla I have exactly the same problem and wrote about it here: https://developer.apple.com/forums/thread/736239 Can someone from Apple engineers help with this and confirm that it is a bug that will be fixed?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’23
Reply to iOS 18 beta bug: NavigationStack pushes the same view twice
I found a similar issue reported by other developers here: https://developer.apple.com/forums/thread/759542 so the problem really exists and seems to be a bug
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
I also face similar issue and wrote about it in another post: https://developer.apple.com/forums/thread/760041 I can confirm that the usage NavigationPath fixes this issue but the other issues appear. A views that weren't pushed appear in path and I have to pop the several times. So it seems that the combination TabView + NavigationStack inside is buggy. Two notes: I tried to use iOS 17+ @Observable approach. It didn’t help. Using @State var path: [RouterDestination] = [] directly inside View seems to help. But it is not what I want as I need this property to be @Published and located inside custom Router class where I can get an access to it, and use for programmatic navigation if needed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
I can confirm that the issue IS NOT fixed in iOS 18 beta 4 Simulator (22A5316j).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
@brebispanique @sjb_s it is not fixed on my side, unfortunately. I can see the same issue on Simulator. Do you test on a real device or simulator? Could you please attach a full code of your solution so I'll be able to compile it and check?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to iOS 18 beta bug: NavigationStack pushes the same view twice
@DTS Engineer thank you for your answer. But what I don't want to use the type-erased data representation and still want to use my custom data type. I need that for correct programmatic routing in my app and for understanding of the exact path of my current router. There is an Apple's API for that so I expect to use my custom type. It is still NOT FIXED in Xcode 16 beta 5 + iOS 18.0 beta 5 and the same issue happens. Any plans to fix it? Thank you. enum RouterDestination: Hashable { case next }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
@sjb_s @dderg @brebispanique @DTS Engineer Here is the full code (a modification of @sjb_s 's example) that still DOESN'T work well. The main reason is that navigationDestination is located in View extension. It is how it is designed in my real app where I have a single navigationDestination for the whole app and all possible routes inside it. Everything works well in iOS 17.x with this approach, but still doesn't work well in iOS 18.0 Beta 5. Any ideas? import SwiftUI class Item: Identifiable, Hashable { var name: String init(name: String) { self.name = name } static func == (lhs: Item, rhs: Item) -> Bool { lhs.name == rhs.name } func hash(into hasher: inout Hasher) { hasher.combine(name) } } class Model: ObservableObject { @Published var path = [Item]() } struct ContentView: View { var items = [ Item(name: "Item 1"), Item(name: "Item 2"), Item(name: "Item 3"), ] @StateObject private var model = Model() var body: some View { TabView { Text("Go to Tab 2") .tabItem { Label("Tab 1", systemImage: "storefront") } .tag("1") tab2() .tabItem { Label("Tab 2", systemImage: "globe") } .tag("2") } } @ViewBuilder func tab2() -> some View { NavigationStack(path: $model.path) { List(items) { item in NavigationLink(item.name, value: item) } .withAppRouter() } } } extension View { func withAppRouter() -> some View { navigationDestination(for: Item.self) { item in DetailView(item: item) } } } struct DetailView: View { var item: Item var body: some View { Text("Details...\(item.name)") } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
@DTS Engineer I created and send Bug report in Feedback assistant: https://feedbackassistant.apple.com/feedback/14743917
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to iOS 18 beta bug: NavigationStack pushes the same view twice
@DTS Engineer I created and sent Bug report in Feedback assistant: https://feedbackassistant.apple.com/feedback/14743917 Thank you.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
@sjb_s thank you for your feedback. You can see my code in the post above that contains the code that always fails (double-push always happens) and some explanation. Also I created the Bug report with the full descriptions and steps how to reproduce this bug: https://feedbackassistant.apple.com/feedback/14743917 @DTS Engineer we really your help here please.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
The issue IS NOT fixed in Xcode 16 Beta 6 + iOS 18 Beta 7.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to iOS 18 beta bug: NavigationStack pushes the same view twice
@DTS Engineer The issue IS NOT fixed in Xcode 16 Beta 6 + iOS 18 Beta 7 and still persists :(
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24
Reply to SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
The issue isn't fixed and still can be represented on iOS 18.0 The solution of @kh_bb helps for the most of cases but the issue can be representated in some specific cases. @cutecutealien it didn't help me, unfortunately. Can you please send you example?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24
Reply to AVPlayerView. Internal constraints conflicts
@DTS Engineer thank you for the answer. The bug report has been created: FB21774181 (AVPlayerView. Internal constraints conflicts.)
Topic: Media Technologies SubTopic: Video Tags:
Replies
Boosts
Views
Activity
Jan ’26