Questions tagged [navigationlink]
73 questions
6
votes
1 answer
SwiftUI: How to dismiss a modal sheet and then execute a navigationlink together
I've got an onboarding process with a welcome view that has two buttons that open modal sheets for signup and login.
Once signup is completed, the button should close the modal view for Signup and transition to another Dashboard view.
How can I…

DanielSon
- 1,415
- 4
- 27
- 40
6
votes
5 answers
How to handle NavigationLink inside UIViewControllerRepresentable wrapper?
So I am trying to create a custom pagination scrollView. I have been able to create that wrapper and the content inside that wrapper consists of a custom View. Inside that custom View i have got two NavigationLink buttons when pressed should take…

Osama Naeem
- 1,830
- 5
- 16
- 34
5
votes
3 answers
SwiftUI List with NavigationLink how to make custom highlight on tap
How I can make custom overlay over List row that will highlight it on tap. I am using NaviagationLink and I've changed
UITableViewCell.appearance().cellSelectionStyle = .none
in order to not use default gray selection.
I've tried to add some…

Michał Ziobro
- 10,759
- 11
- 88
- 143
5
votes
0 answers
SwiftUI: NavigationLink and ScrollView drag gesture colliding
I'm trying to implement a UICollectionView like View in SwiftUI which basically works fine. But when I scroll/drag inside the scroll view to scroll down, the tap is recognized on the NavigationLink and then navigating to the detail view, even if I…

Melvil
- 51
- 3
4
votes
1 answer
SwiftUI: Select NavigationLink in a NavigationView / List with SidebarListStyle
I want to programmatically select a specific NavigationLink in a NavigationView / List.
The following code works fine on iPhones both in portrait or landscape mode == in situations where the List is not permanently visible besides its destination…

ixany
- 5,433
- 9
- 41
- 65
4
votes
1 answer
SwiftUi - hide "Back" button and navigation bar (appears for a fraction of second)
I'm using this code to hide a navigation bar and Back button but when the view is loaded i still can see the back button for a fraction of second and then it disappears. Is there any way to prevent it from being shown?
var body: some View {
…

eugene_prg
- 948
- 2
- 12
- 25
4
votes
2 answers
NavigationLink only works on long press SwiftUI
For some reason it seems that my NavigationLink is only working on long press. Here's a snippet of the View:
struct MainView: View {
@EnvironmentObject var user: UserObservable
var body: some View {
VStack {
…

Hayden Hong
- 135
- 1
- 9
4
votes
1 answer
SwiftUI - List Navigation not working on an iPhone
I got a NavigationView, trying to navigate into a NavigationLink for a second time without luck.
So A then B then A works fine. Tho A then A dose not work. The only way to get into A is to go to B first...
NavigationView {
List {
…

Heestand XYZ
- 1,993
- 3
- 19
- 40
4
votes
1 answer
How to edit an item in a list using NavigationLink?
I am looking for some guidance with SwiftUI please.
I have a view showing a simple list with each row displaying a "name" string. You can add items to the array/list by clicking on the trailing navigation bar button. This works fine. I would now…

Bob
- 159
- 2
- 8
4
votes
2 answers
How could I do something before navigate to other view by NavigationLink?
Let me show the simple source code:
struct ContentView : View {
@State var isPresented = false
var body: some View {
NavigationView {
HStack{
NavigationLink(destination:…

norains
- 743
- 1
- 5
- 12
3
votes
1 answer
I am using NavigationLink to navigate between views and it doesn't work in a single view in SwiftUI
When I want to log out of my app I want to show the initial view that has the "log in" / "create account" page using the NavigationLink. I used the exact same method in other places of the app and it works there, but here it doesn't. Here is my…

Susca Bogdan
- 991
- 1
- 9
- 23
3
votes
3 answers
SwiftUI: NavigationLink is always activated when in a List
I can't prevent SwiftUI's NavigationLink from being activated when in a List, I have this simple piece of code in which I need to do some kind of business check before deciding to show the details page or not (in a real world app, there might be…

JAHelia
- 6,934
- 17
- 74
- 134
3
votes
2 answers
Clip clickable parts of image as NavigationLink (SwiftUI)
When implementing an image in a NavigationLink closure and clipping that image, the unclipped image is clickable. Because of the clipping, the images are overlapping each other (see attached screenshots).
The first screenshot shows the original…

marco
- 148
- 1
- 3
- 15
3
votes
2 answers
SwiftUI Images disappearing when in NavigationLink
I am trying out SwiftUI and I am building a holiday app in which you can see where have you been what was the weather like there and how long did you stay there.
The problem is that when I put my HolidayCard in NavigationLink all images…

Petio Vishnevski
- 33
- 6
3
votes
1 answer
SwiftUI Scrollview Breaks NavigationLink Behavior
I'm having a problem where I toggle a setting in a details view, and immediately after the toggle of the setting, the navigation pops back to the main screen. This only happens when using a ScrollView instead of a List on the main screen. Does…

Richard Witherspoon
- 4,082
- 3
- 17
- 33