Questions tagged [swiftui-navigationlink]

For questions about NavigationLink - a component in Apple's SwiftUI framework that triggers a navigation presentation when pressed. When using this tag also include the more generic [swiftui] tag where possible.

Links:

974 questions
14
votes
3 answers

SwiftUI NavigationLink memory leak

I have a question on how memory management works in SwiftUI's NavigationView stack. I have a view, in which I have declared NavigationView and NavigationLink, inside destination parameter of NavigationLink is my TestView. Navigation works good, but…
Róbert Oravec
  • 213
  • 4
  • 10
13
votes
2 answers

SwiftUI - List / ForEach in combination with NavigationLink and isActive doesn't work properly

I'm trying to do a NavigationLink within a List or ForEach Loop in SwiftUI. Unfortunately I get a really weird behavior (e.g. when clicking on Leo it opens Karl, Opening Max points to Karl, too). I've already figured out that it's related to the…
SwiftUIRookie
  • 591
  • 7
  • 16
13
votes
2 answers

Using NavigationLink in Menu (SwiftUI)

Can you use a NavigationLink as a Menu's item in swiftUI? It seems to do just nothing: Menu { NavigationLink(destination: Text("test1")) { Text("item1") } NavigationLink(destination: Text("test2")) { Text("item2") } }…
Leo
  • 1,508
  • 13
  • 27
13
votes
1 answer

How to use variable inside the body of the view using swiftUI?

i'm trying to using a variable and modify inside the foreach of swiftui. below are the code i'm using. please let me know how can i modify the value inside the body of the view. struct SearchView : View { var chatmember = ChatMember(with:…
Sourav Mishra
  • 501
  • 4
  • 21
13
votes
2 answers

SwiftUI custom animated transition in navigationView?

is there a way in SwiftUI to change the standard behaviour of NavigationView/NavigationLink, which is to slide from one view to the next? I'd like to have a custom animation/transition like fade in/out. I'm trying out things for a while now and…
jboi
  • 11,324
  • 4
  • 36
  • 43
12
votes
3 answers

SwiftUI Navigation popping back when modifying list binding property in a pushed view

When I update a binding property from an array in a pushed view 2+ layers down, the navigation pops back instantly after a change to the property. Xcode 13.3 beta, iOS 15. I created a simple demo and code is below. Shopping Lists List Edit List…
12
votes
3 answers

Why does NavigationLink buttons appear "disabled" in a custom UIViewControllerRepresentable wrapper

I have created a wrapper that conforms to UIViewControllerRepresentable. I have created a UIViewController which contains a UIScrollView that has paging enabled. The custom wrapper works as it should. SwiftyUIScrollView(.horizontal, pagingEnabled:…
11
votes
5 answers

How to Navigating from SwiftUI View to UIKit UIViewController

As of now, I have an application built entirely using UIKit. However, I wish to be able to start implementing some SwiftUI Views to replace some UIViewControllers. I've been able to do this to navigate from the UIViewController to SwiftUI View on…
11
votes
2 answers

@EnvironmentObject doesn't work well through navigationLink

I use my @EnvironmentObject to let my TeamData can use by different but it doesn't work well. When I go to another view by navigationLink in List, it's fine. When I tap a button to the same View, it crashed.. I think I put something wrong. Can…
frank61003
  • 205
  • 3
  • 16
11
votes
1 answer

SwiftUI List rows in Edit Mode do not allow Buttons actions/NavigationLinks to work?

SwiftUI List rows in Edit Mode do not allow Buttons actions to work I note (as well as NavigationLinks too). Is there a way to get this working? Goal - Want to have NavigationLink or Modal view to the following depending on the edit mode. This…
Greg
  • 34,042
  • 79
  • 253
  • 454
11
votes
1 answer

NavigationLink freezes when trying to revisit previously clicked NavigationLink in SwiftUI

I am designing an app that includes the function of retrieving JSON data and displaying a list of retrieved items in a FileBrowser type view. In this view, a user should be able to click on a folder to dive deeper into the file tree or click on a…
Vapidant
  • 2,532
  • 2
  • 12
  • 26
10
votes
1 answer

SwiftUI: NavigationLink pops out immediately on WatchOS 8.1RC in Tabview

I have discovered a regression in watchOS 8.1RC with NavigationLink triggered from a TabView. It's immediately dismissed. It was working in watchOS 8.0 or in Simulator (watchOS 8.0). Do you know a workaround ? Thanks Sample code: import…
9
votes
1 answer

SwiftUI dismissing view by setting NavigationLink tag to nil

I'm trying to implement the logic of programmatic view pop in SwiftUI I set a tag on the items and create a corresponding variable for the selected item, but when I click the button on the DetaiView screen, nothing happens. The problem disappears if…
9
votes
1 answer

SwiftUI's NavigationView Is Missing The Back Button On Apple Watch

I created an Apple Watch app using SwiftIU. The main view of the app is a List, with NavigationLink to another List. When I'm in one of the internal Lists, the back button isn't on the top of the view. But when I swipe from the side of the screen…
Shahar Melamed
  • 1,534
  • 5
  • 15
  • 23
9
votes
1 answer

SwiftUI TextField takes max width

I have a navigation list with each list item being in this format: HStack { TextField("Insert something here.",text: self.$userData.pages[i].title) .border(Color.blue) Spacer() } This results in the following…
user4500882
  • 303
  • 3
  • 8
1
2
3
64 65