Questions tagged [swiftui-navigationview]

For questions about NavigationView - a view in Apple's SwiftUI framework that presents a stack of views representing a visible path in a navigation hierarchy. When using this tag also include the more generic [swiftui] tag where possible.

Links:

583 questions
1
vote
1 answer

App Lost all selection info of navigation and tab, after update a AppStorage state

I want to realize a function which could change the color scheme of app. However, whenever I click theme style in ThemeView, it will pop to SettingsView and Tab will reselect to Home. Is there a way that I can change the color scheme of app, and…
1
vote
0 answers

NavigationStackView with .searchable modifier works as expected, NavigationSplitView is crashing

NavigationStackView with .searchable modifier is working as expected. struct NavStackListSearchView: View { @State private var items = ["Item1", "Item2", "Item3", "Item4", "Item5"] @State private var selectedItems: Set = [] …
KlausM
  • 193
  • 12
1
vote
1 answer

How to call Task in NavigationLink destination in SwiftUI?

I've created a list using LazyVStack and inside of the list there are ListItemViews. What I'm trying to do is, when a ListItemView gets tapped, I want to make an async call depending on the selected item, and then navigate to the view with the data…
1
vote
1 answer

How to Pop Particular view in SwiftUI NavigationView

View1 -> View2 -> View3 -> View4 How can I pop from View4 directly to View2 considering that we do not have control over the navigation stack ? I try to Pop to the Root View in a SwiftUI NavigationView. Add a helper to your SwiftUI App import…
1
vote
1 answer

SwiftUI How to change Background Color of NavigationView with Form?

Is there possibility to change background color of this view? Note: I dont want to change form sections color, i want to change background color of view. `.background(Color.red) does not effect. init(){ UITableView.appearance().backgroundColor =…
Raycon
  • 13
  • 2
1
vote
0 answers

Button gets overlapped by navigation bar SwiftUI watchOS

I have recently been developing an app for Apple Watch using SwiftUI. I have integrated NavigationView and embedded another View into it. This embedded view has got few buttons, which I can't figure out how to size properly. The top row is…
1
vote
1 answer

List in NavigationView is calling init for every row

I'm making a Mac app using SwiftUI. I have a simple 2 column NavigationView. The first view is a Sidebar containing a list, the second view is a detail view. (I know NavigationView has been deprecated, but I can't use NavigationSplitView at the…
Martin
  • 1,570
  • 3
  • 19
  • 32
1
vote
2 answers

How to set the view on top in ios SwiftUI?

I had tried this code, I have also tried with stacks but not able to align with top . I just want the view to appear on top with auto layout as like UIKit . import SwiftUI struct ItemDetail: View { let item : MenuItem var body: some View { …
1
vote
0 answers

Navigating a SwiftUI List using arrow keys

In a Mac SwiftUI project, I have a simple list inside a NavigationView. When I try to navigate using up/down arrow keys, the list will only scroll to one element off the screen in either direction. In other words, in screenshot below, if I click…
1
vote
2 answers

SwiftUI Providing destination for NavigationLink in the view init resulting in "Type 'any View' cannot conform to 'View'"

I am trying to make a NavigationLink and provide the destination in its init but I am receiving an error: Type 'any View' cannot conform to 'View' struct MenuButton: View { let iconName: String let destination: () -> any View …
Vadim F.
  • 881
  • 9
  • 21
1
vote
0 answers

How do you use multiple NavigationLinks in a single list row in SwiftUI?

I want to navigate to HelloWorldView when "Hello" is clicked. However, if the text "Bye" is clicked, then I want to navigate to the ByeWorldView. In the past, I was able to use isActive on the multiple NavigationLinks to get this to work, but Apple…
jh95
  • 379
  • 2
  • 12
1
vote
0 answers

Swift iOS 16.0 NavLink stops working after 14 pages

I am working on a book app that allows the user to flip through pages at the bottom of the screen. These buttons are Navigation Links and work perfectly, up until page 14. At page 14 the app screen goes blank. Is there some sort of limit on how many…
JakeW
  • 103
  • 1
  • 1
  • 4
1
vote
1 answer

Swiftui Preview Crashing using Navigationstack (Problem Report included)

I can't figure out why my preview is crashing each time I press the "Hello World" text. I have a programatically navigationstack setup, and each time a view is appended it crashes in the preview. The app on my phone works great though, but I thought…
Axxi
  • 193
  • 1
  • 10
1
vote
0 answers

navigationDestination(isPresented:destination:) iOS16 doesn't send to view

Im trying to put a navigationDestination(isPresented:destination:) for a button on Xcode14/iOS16, it executes the func and so when I press the button but it doesn't send me to the new view and also i cant see if it is passing the information from…
1
vote
1 answer

Make List items selectable in edit mode, EditMode example from documentation not working

I want to add the possibility to select items in a list when edit mode is selected, additionally to the delete and move option. Ideally I want to use the existing edit, delete and move buttons instead of writing my own. I tried the example from the…