Questions tagged [navigationlink]
73 questions
0
votes
1 answer
How to add a clickable button in a List without triggering NavigationLink event?
I have a button in a list item and when I click on it, the NavigationLink's event is also being triggered.
I only want to trigger the button event. How to do it?
following is my code:
ForEach(self.cares,id:\.id){ care in
HStack{
…

龙方哲
- 125
- 1
- 9
0
votes
0 answers
SwiftUI - dismiss NavigationLink destination View and update main NavigationView - EXC_BAD_ACCESS (code=2
I want tu update main NavigationView after dismissing subview from NavigationLink, but from one subview with Success and from another with "EXC_BAD_ACCESS (code=2..." in XCode.
I do it by @Binding var which I change its value from subview. I think,…

joey
- 1
- 1
0
votes
0 answers
How to pass State variables as parameters to a model class which is of ObservableObject type?
I want to save some data from a SwiftUI view to a Model so that I can use these data into another SwiftUI view. However, I came up with some error when I try to call the Model class and pass all the data as parameters. The error says:
Cannot use…

Shawkath Srijon
- 739
- 1
- 8
- 17
0
votes
1 answer
SwiftUI: How to Navigate from one view to another by clicking on a button
I am trying to move from one view to another, I have used NavigationLink as following:
@State private var isActive = false
NavigationLink(destination: DetailsView(),
isActive: $isActive) {
…

Haneen
- 17
- 1
- 6
0
votes
1 answer
How can I navigate to different views?
I am learning to use Swiftui and I need your help. The following pickers are present in my project:
Picker(selection: $selectedChoose, label: Text("Cosa ti serve?")) {
ForEach(0 ..< choose.count) {
…

Charles2020
- 1
- 1
0
votes
1 answer
SwiftUI - NavigationLink inside of NavigationLink Bug
im trying to create a NavigationLink List inside of my NavigationLink as a DetailView.
Sadly im getting weird UI Bugs. Here is the Code:
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
List…

Max
- 683
- 2
- 8
- 12
0
votes
0 answers
In SwiftUI why does updating a View due to an ObserverObject change makes the Navigation pop there automatically?
I have a view in the navigation stack that depends on an ObservedObject that is changed later in time. When this change happens the navigation controller automatically pops there. Why is this happening and how to avoid it?
This is part of the code…

Axy
- 374
- 2
- 15
0
votes
2 answers
SWIFTUI - How to navigate to a random view?
I have built a primitive quiz app. The ContentView has a navigationlink to question one. And in the view of question one (which is a view called questionOne) I have the question and another navigationlink to questionTwo. It goes on and on until the…

I Kaya
- 417
- 5
- 22
0
votes
1 answer
SwiftUI - "Type of Expression is ambiguous without more context" on Text() call
I'm currently trying to pass an array of values into a detail view using a navigation link. However, whenever I attempt to pass the array, the text function call I specify to display the navigation link gives me the "Type of Expression is ambiguous…

Sydney
- 1
0
votes
1 answer
SwiftUI - How to auto push 2th-DetailView when 1st-DetailView goback to MasterView using navigationView
I'm newbie
my xcode version is 11.2.1 and swift is 5.1.2
When I use NavigationView in MasterView, and I have two DetailViews
I want to automatically enter the second DetailView when the first DetailView is closed
This is my approach, but it…

HiChu
- 1
- 1
0
votes
1 answer
SwiftUI sidebar list does not register first click
Using SwiftUI, I have a sidebar navigation in a Mac app to change views. Clicking an item in the sidebar changes the view on the right. However, when the app is launched, the sidebar List does not register the first click. It takes two clicks to…

wigging
- 8,492
- 12
- 75
- 117
0
votes
2 answers
SwiftUI - Trigger other actions when click NavigationLink
I create a list view with a button in an up layer. I want to hide the button immediately right after user clicks the NavigationLink and doesn't see it in a detail view.
I implement it successfully by using @State var showAddButton and control it by…

Liling Chen
- 43
- 8
0
votes
2 answers
How to have a List in SwiftUI able to point to multiple views based upon the row
A simple way to express this would be to go back to UITableView and have a didSelectRowAt(indexPath) function that behaved like this:
if (indexPath.row == 0) { ... } else { ... }
Where based upon the indexPath.row value, I can call a unique view…

CodeBender
- 35,668
- 12
- 125
- 132