|
I have multiple buttons in an HStack in SwiftUI 2 (iOS 14). When i tap on a single button, the whole stack gets highlighted and the actions for ALL of the buttons gets executed.
So if I tap on the Call button not only does it bring up the Calling UI but it navigates to the Schedules Text (second option.) Is this a Swift 2 bug that I should be filing a Feedback on or am I doing something wrong here? |
|
Was able to put this view into an XCode 11 proect and it operates the same way. So the question is, how to I limit the execution to the tapped button's action when there are multiple buttons in an HStack? I tried setting the .contentShape (Rectangle()) on each button but that didn't help. |
|
|
|
I just lost 3 days because because the action triggert a backend function and I was looking there! Thanks so much |
|
|
|
I almost went down a rabbit hole with this problem. Happy that it has a quick fix. Thank you. |
|
|
|
|
|
SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.