swiftui-navigationlink

Mapview shows White overlay on Interaction

吃可爱长大的小学妹 提交于 2021-02-10 05:46:09
问题 I am using GMSMapView with SwiftUI, in map-view I have to display some markers with lat and long. Upon clicking any marker I have to Move to another view. I am doing this by putting MapView in NavigationLink . This thing is working fine By using code. NavigationView { NavigationLink(destination: Text(""), isActive: $abc) { MapView().edgesIgnoringSafeArea(.all) } } And the issue is NavigationLink , after putting mapview in NavigationLink every-time when i interact with map, white overlay

SwiftUI .onDelete throws Fatal Error: Index out of range

£可爱£侵袭症+ 提交于 2021-01-29 22:33:49
问题 I have list of Account s that each of them has a detail page and they are connected through @Binding in the AccountDetailView . Current code work well, updates are fine. No problem at all. However when I added the onDelete modifier to the ForEach below and tried swipe to delete gesture in app, it crashes and says Fatal Error: Index out of range twice. I made some search and learned that ForEach somehow does not get notified -or ignores it, idk much detail- and looks for the last index of the

SwiftUI - Navigation bar colour change not being applied to status bar

时光毁灭记忆、已成空白 提交于 2021-01-28 11:57:47
问题 I have the following: var body: some View { NavigationView { VStack { Text("Hello") }.navigationBarTitle("Edit Profile", displayMode: .inline) .background(NavigationConfiguration { nc in nc.navigationBar.barTintColor = .red nc.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.black] }) }.navigationViewStyle(StackNavigationViewStyle()) } For the configuration of the nav bar i have: struct NavigationConfiguration: UIViewControllerRepresentable { var configuration:

Navigation Link in bar Items goes back to top of NavigationView

核能气质少年 提交于 2021-01-28 01:57:23
问题 struct Testing: View { var body: some View { NavigationView{ VStack { Text("View 1") Text("View 1.3") NavigationLink(destination: TestView(), label: { Text("View 1 navigation") }) } } } } struct TestView: View { var body: some View { VStack { Text("View 2") } .navigationBarItems(trailing:NavigationLink( destination: Text("View 3"), label: { Text("Navigate") })) } } When clicking the NavigationLink inside of TestViews navigationBarItems it navigates to View 3. When I click the back button it

Create a SwiftUI Sidebar

我只是一个虾纸丫 提交于 2021-01-02 08:07:25
问题 I want to build a very simple iOS 14 sidebar using SwiftUI. The setup is quite simple, I have three views HomeView , LibraryView and SettingsView and an enum representing each screen. enum Screen: Hashable { case home, library, settings } My end-goal is to automatically switch between a tab view and a sidebar depending on the size class but some things don't quite work as expected. The global state is owned by the MainNavigationView , which is also the root view for my WindowGroup . struct

SwiftUI .toolbar disappears after following NavigationLink and coming back

纵然是瞬间 提交于 2020-12-29 12:27:28
问题 I've added a .toolbar to the top level of a NavigationView that will eventually be used to select items in a list without using swipe gestures (up button, down button, etc.). I also have a .navigationBar going on, to access other views for Account and Settings. For the most part it's looking really good, but when I follow a NavigationLink (in .navigationBarItems) within NavigationView, and then use the built-in back navigation , my .toolbar disappears from the top level. Am I putting the

NavigationLink hides the Destination View, or causes infinite view updates

爷,独闯天下 提交于 2020-12-15 07:08:52
问题 Let us consider the situation when you have ContentView and DestinationView . Both of them depend on some shared data, that typically lies inside the @ObservedObject var viewModel , that you pass from parent to child either via @EnvironmentObject or directly inside init() . The DestinationView in this case wants to enrich the viewModel by fetching some additional content inside .onAppear . In this case, when using NavigationLink you might encounter the situation when the DestinationView gets

NavigationLink hides the Destination View, or causes infinite view updates

折月煮酒 提交于 2020-12-15 07:07:40
问题 Let us consider the situation when you have ContentView and DestinationView . Both of them depend on some shared data, that typically lies inside the @ObservedObject var viewModel , that you pass from parent to child either via @EnvironmentObject or directly inside init() . The DestinationView in this case wants to enrich the viewModel by fetching some additional content inside .onAppear . In this case, when using NavigationLink you might encounter the situation when the DestinationView gets

SwiftUI NavigationView, going back if NavigationLink is inside a NavigationBarItem

ε祈祈猫儿з 提交于 2020-12-15 06:48:46
问题 As there are some problems with iOS 13.4 and Xcode 11.4 with presentationMode.wrappedValue.dismiss() I am looking for an alternative approach to go back programmatically. I found this solution from MScottWaller: iOS SwiftUI: pop or dismiss view programmatically Unfortunately, in my case it does not work: struct MasterView: View { @State private var showDetail = false var body: some View { VStack { Text("MasterView") .navigationBarItems(trailing: HStack { NavigationLink(destination: DetailView

SwiftUI NavigationView, going back if NavigationLink is inside a NavigationBarItem

女生的网名这么多〃 提交于 2020-12-15 06:48:29
问题 As there are some problems with iOS 13.4 and Xcode 11.4 with presentationMode.wrappedValue.dismiss() I am looking for an alternative approach to go back programmatically. I found this solution from MScottWaller: iOS SwiftUI: pop or dismiss view programmatically Unfortunately, in my case it does not work: struct MasterView: View { @State private var showDetail = false var body: some View { VStack { Text("MasterView") .navigationBarItems(trailing: HStack { NavigationLink(destination: DetailView