|
I have a scrollView with an Image, which the user can pan and zoom, like in the Apple Photos App. I would like to get the location (xy) the user long pressed (being the pixel x and pixel y coordinates of the Image). In my UIKit app this was rather simple:
I can't seem to figure out how to achieve the same in SwiftUI. Any help appreciated! |
|
|
|
|
|
Sorry, been a while. I managed to get the location with a sequenced gesture. Though the numbers are roughly half what I expect to get back, perhaps a points vs pixel thing? Here's the ImageZoomView
More exploring and thinkering to do, but it's a start ... |
|
|
|
I have the same problem as @JetForMe I can't get it to work without releasing the long press |
|
To achieve a similar effect in SwiftUI, you can use a combination of a
Explanation:
Notes:
|
SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.