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
2 answers

Navigation Bar hide not working in SwiftUI iOS15

I am using xcode 13.2.1 iOS 15,i want to hide the navigational bar and the back arrow i have tried several methods. none of the answers worked var body: some View { NavigationView{ ZStack{ Text("Header") //Header View …
1
vote
0 answers

SwiftUI NavigationView Stuck after a Few Steps

I am walking my first steps with SwiftUI as I'm thinking about migrating my existing UIKit-based iOS app. It makes extensive use of split views. Ideally, there will be something like the iOS Mail app with a master/detail view as well as an…
user3386180
1
vote
0 answers

ToolbarItem: How to define which one should be hidden first if not enough space available

I have implemented a toolbar in a SwiftUI app as follows: var body: some View { NavigationView.toolbar { ToolbarItem(placement: .automatic) { Text("Not essential - should be hidden *first*") } ToolbarItem(placement: .automatic)…
Sebastian
  • 115
  • 1
  • 8
1
vote
1 answer

How can I deep link into the view stack of an app in SwiftUI?

I am attempting to set up deep linking into my app, but I can't figure out how Apple wants us to do this. I have 3 views. FirstView(), SecondView(), and ThirdView(). FirstView has a button on it. When the user taps on that button, I want the app to…
1
vote
0 answers

SwiftUI: Navigation view pops back when variable inside a filtered array is updated

I have a navigation view with a list in my content view. In my list there is a ForEach that is passed an array. If I pass the ForEach just the array, everything works fine. If I filter that array, it will pop back anytime a change is made to a…
Joseph Kessler
  • 93
  • 2
  • 11
1
vote
1 answer

SwiftUI App seems to change value of StateObject by itself when it goes to background

While building my app I stumbled upon a bug that keeps me up at night. I have a View which has a button that when pressed is supposed to change value of a field of a StateObject which should activate a NavigationLink. Up until now app works as…
1
vote
1 answer

How can I set up data to pass to another View with NavigationView?

I have to pass these data to my MapView and I keep getting the following error: Type '()' cannot conform to 'View' I need different data for the 3 cases so I thought I will set it up just before passing ig through the NavigationLink, but apparently…
Jakabffy
  • 19
  • 1
1
vote
2 answers

SwiftUI can't hide navigationBar on pushed view when previous view search bar active

I have a problem when pushing to a new view with a search bar active. In the pushed view I want the navigation bar to be hidden. It works in all cases except when the search field is active on the pushing view AND the navigation style is…
alionthego
  • 8,508
  • 9
  • 52
  • 125
1
vote
0 answers

Lock device orientation for SwiftUI UIViewControllerRepresentable

I have a UIViewController that I need to wrap and use as a SwiftUI view. I have implemented the methods needed to lock device orientation for that view controller. When I use the UIViewController in an UIKit context, the orientation could be…
1
vote
1 answer

Is there any way to turn off autocorrection / set keyboard type on the searchable navigation modifier in SwiftUI

In SwiftUI you can set a searchable modifier on a view in a NavigationView to show a search bar. However by default this search bar has autocorrection enabled, plus one might want to modify the keyboard or the auto-capitalization type. For example,…
shim
  • 9,289
  • 12
  • 69
  • 108
1
vote
1 answer

SwiftUI: NavigationLink pops back when variable is updated

I have this issue where the navigation link pops back when a variable is updated. It's a bit confusing because this behavior doesn't occur elsewhere in the application, but I am doing the same thing. To start, there is a Vehicle struct that conforms…
1
vote
0 answers

SwiftUI Navigation View Margins Around List

I have a SwiftUI app with a Navigation View. Inside that Navigation View is a List. The List contains Navigation Links. Everything works fine, but I'd like each List item to stretch out to the full width of the view and not have that gray margin…
John Gerard
  • 299
  • 4
  • 19
1
vote
0 answers

Is there a way to update the NavigationTitle of a NavigationView from a button in it's detail view?

I have a NavigationView showing a title with the number of records in a List: .navigationTitle("\(navBarTitle) (\(String(numberOfRecords)))") In the toolbar I have 2 buttons: show Unread - only show unread / show all show Favorites - only show…
JoostS
  • 21
  • 3
1
vote
1 answer

How to pass data between SwiftUI views using NavigationLink

I am engaging in a small SwiftUI exercise to learn how to pass data between views using NavigationLink. I set up ContentView to send a message to the SecondView after tapping the ContentView NavigationLink. Tapping NavigationLink in the SecondView…
1
vote
0 answers

Swiftui: Navigation bar tint isn't changing for the back button

In the app, the user can change the accent color based on a specific set of options. The accent color gets set in this way, however, there is an AccentColor asset that is set as well. I've tried removing this but it didn't resolve the issue. var…
Joseph Kessler
  • 93
  • 2
  • 11