Post

Replies

Boosts

Views

Activity

How to determine tap position on image in SwiftUI?
Is there any way to determine how to get the tap position (CGFloat) on an image View in SwiftUI, without resorting to UIKit? I am trying to use purely SwiftUI to build a guitar you can tap to add notes. Using HStacks and VStacks of Views or elements results in performance issues (it has to draw 6 x 24 views often). So, I was going to try an approach using an image, determine where was tapped, and add an overlay at that location. I am aware of one method using a drag gesture with minimum distance of 0, but I need the drag gesture to swipe between taps in a TabView.
8
0
4.5k
Dec ’20