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

Change color of Navigation Button SwiftUI

How to change the color of Navigation "Back Button" (it's created automatically) to black, and the color of DisclosureGroup "Chevron" to another color? I've tried to do .buttonStyle(PlainButtonStyle()) and .foregroundColor(.black) struct…
MikeMaus
  • 385
  • 3
  • 22
1
vote
1 answer

Use same `navigationBarTitle` and `navigationBarItems` on two views which are shown based on condition

I have a View which shows Text view to show help text for user to tap on plus icon to add group. Once group is added, it shows List view. To show navigation bar, I need to call navigationBarTitle and navigationBarItems on both Text and List view.…
Naveen
  • 6,786
  • 10
  • 37
  • 85
1
vote
1 answer

Is there a problem with the way I'm structuring my SwiftUI project that causes .navigationTitle to not appear?

My SwiftUI project refuses to display the navigation title after a certain point. I'm using a navigation structure that I haven't seen implemented on any example projects I've seen, but it makes sense to me and has been seeming to work thus far. My…
YourManDan
  • 277
  • 1
  • 14
1
vote
1 answer

Popping views using SceneDelegate.toView()

I have a UI where you can navigate/push views like this: AView -> BView -> CView -> DView I want to pop a couple of views (get to BView from DView) instead of placing a new view (BView) on top of existing stack and I found the way to do…
eugene_prg
  • 948
  • 2
  • 12
  • 25
1
vote
3 answers

SwiftUI Navigation bar items disappear on iOS 14

Discovered in my app that navigation bar items in some views disappear when orientation of the device changes. This seems to occur only in a view that is opened using NavigationLink, on main view navigation bar items work as expected. It appears…
1
vote
1 answer

SwiftUI - TabView Light Mode UIColor Appears in Preview, not in Sim or Device

I am using Swift 5.3 on MacOS 11.01 and created a new "Multiplatform" app for iOS 14.2. I created custom color assets for light/dark modes but am having trouble getting the light mode background color to show on my TabView. The TabView dark mode…
dmiannay
  • 115
  • 1
  • 2
  • 10
1
vote
0 answers

SwiftUI: Button with offset not working in ScrollView

I'm trying to make this Profile Button to work inside a ScrollView, that when tapped, a modal view should come up. But for some reason, when I add some offset to the Button, to make it inline with the Navigation Title, the Button stops working. Does…
joaquin737
  • 41
  • 3
1
vote
1 answer

SwiftUI - Navigation View opening with Back button and half grey screen / weird behavior

I am trying to add navigation view to my app, but it is causing issues. My main UI is an infinitely swipe-able carousel of pages. It originally looks like this: Then when I wrap it in a navigation view, it opens like this, with a back button and…
1
vote
1 answer

SwiftUI NavigationLink: how to call a function before showing destination view

I would like to call a function, after clicking on an item, and before displaying the destination view. The code below doesn't seem to work: myFunction is called, but the destination view is not shown. It looks like the onTapGesture overwrites the…
Daniele B
  • 19,801
  • 29
  • 115
  • 173
1
vote
1 answer

SwiftUI NavigationView displaying incorrectly

I'm learning SwiftUI and following through with Apple's 'Landmark' tutorial and then taking the examples and trying to make my own using that knowledge. However, I'm really missing some understanding because I can't see why I'm getting non-standard…
iOSProgrammingIsFun
  • 1,418
  • 1
  • 15
  • 32
1
vote
1 answer

Cannot make my status bar color to match my UINavigationBar color in SiwftUI

My problem appears to be a simple one. But I just spent hours looking for a solution! I just have to make the status bar's background color conform to my UINavigationBar background's color (red in this sample). I wrote a minimal code sample to…
1
vote
1 answer

SwiftUI: Weird behaviour of Slider when it is in the leading/trailing of navigation bar items

I'm having trouble placing a Slider as a view in the trailing of navigation bar. Since it's hooked to a state, changing the state of it is very jumpy and not smooth at all. Here's my sample code: struct ContentView: View { @State var…
P. Sami
  • 2,115
  • 2
  • 21
  • 39
1
vote
1 answer

SwifUI LandScape NavigationTopBar won't hide

I wanted only one landscape View between all Views so I added code bellow to the AppDelegate func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { return…
1
vote
1 answer

Why is SwiftUI presented view displayed incorrectly?

I've created a SwiftUI "multiplatform" (iOS and macOS) app from the Xcode 12 beta 6 (12A8189n) app template. My issue is that one of my views, AnotherView, is displaying incorrectly. Here's a gif showing the problem. Notice that AnotherView displays…
Daniel
  • 8,794
  • 4
  • 48
  • 71
1
vote
1 answer

Double List in NavigationView [Swift]

I'm trying to fit two categories of an item on two different list, named 'Wide-Field' and 'Deep-Sky', however I want the second list to be below the first. I was expecting it to look something like this: However, instead it splits the screen in…