Post

Replies

Boosts

Views

Activity

SwiftUI : NavigationStack in new iOS 18 TabView pushes twice when path in parameter
Hello, With iOS 18, when NavigationStack is in new TabView, with path parameter containing current navigation state is set, the navigation destination view is pushed twice. See below with example that pushes twice on iOS 18 but is correct on iOS 17 @MainActor class NavigationModel: ObservableObject { static let shared = NavigationModel() @Published var selectedTab: String @Published var homePath: [Route] @Published var testPath: [Route] } struct ContentView: View { @StateObject private var navigationModel: NavigationModel = NavigationModel.shared var body: some View { TabView(selection: $navigationModel.selectedTab){ HomeView() .tabItem { Label("Home", systemImage: "house") } .tag("home") TestView() .tabItem { Label("Test", systemImage: "circle") } .tag("test") } } } struct HomeView: View { @StateObject private var navigationModel: NavigationModel = NavigationModel.shared var body: some View { NavigationStack(path: $navigationModel.homePath){ VStack{ Text("home") NavigationLink(value: Route.test1("test1")){ Text("Go to test1") } } .navigationDestination(for: Route.self){ route in NavigationModelBuilder.findFinalDestination(route:route) } } } } I don't what causes the issue because it works well on iOS 16 and iOS 17. I think the path is somehow reset but I don't why (maybe by the TabView ?) Note that the bug only occurs with TabView. Don't really know if it is a TabView bug or if it is on my side. I filed a feedback with sample project FB14312064
34
11
4.3k
Jul ’24
iOS 18 new ControlWidgetButton custom image/icon/symbol not displayed
Hello, I am trying to create a custom control with the new WidgetKit control widget APIs. In my custom control, I want to display a custom image, in fact a custom symbol. The custom symbol is not displayed with latest iOS 18 Seed 7 (22A5346a). Only system symbols are displayed. I don't find any information about it in the WidgetKit Apple Developer Documentation. ControlWidgetButton(action: MyIntent()){ Label(title: { Text("My Custom Control") }, icon: { Image("mycustomsymbol") //NOT DISPLAYED // Image(systemName: "rectangle.portrait.inset.filled") IS DISPLAYED }) } There was no issue with custom symbols in beta 4. Now since beta 5, custom symbols are not displayed. I wonder if this is a bug or this is intended. Can you help me ? I filed a feedback FB14888220 Thank you
2
2
616
Aug ’24