• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: Navigating to detail view on button click in List Row(TableviewCell) in SwiftUI

Resolved: Navigating to detail view on button click in List Row(TableviewCell) in SwiftUI

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

I have List/TableView with Cells. Now each cell contains detail about given Item and some buttons like Edit the Item, Show Detail of Item, Show subview of given Item etc.
Now, for case of showing detail of Item, I have tried to add NavigationLink, but now if anyone clicks anywhere on that cell, it moves to detail screen.
I dont want to move to detail screen on clicking anywhere in screen, I want to push detail screen only when someone clicks “Show Detail” button in that cell.

Answer:

  1. Use the .hidden() modifier on the navigationLink to prevent the list item from capturing it’s action

  2. Change the .buttonStyle from automatic to something else on the list item to prevent it from capturing the button action. (for example borderless)


Working Demo



If you have better answer, please add a comment about this, thank you!

ios swiftui swiftui-list swiftui-navigationlink swiftui-navigationview
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Pandas Groupby Get Values from Previous Group

24/03/2023

Resolved: Can’t access static methods from outside until JavaScript’s static block is over?

24/03/2023

Resolved: Count number on values (which are measure) in a table

24/03/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.