Double Tap Zoom to The Tap Location Swift 5 iOS 13
When I try find the way on the internet, it doesn't work like the way I want. Double tap to zoom working but it just zoom on the center not to the tap location. You need to combine UIScrollview with UIImageview to use gesture zoom. Because UIImageview itself doesn't use scrollview so it will not effect scrollview.
Maybe in iOS version before 13 the way on the internet it works. Because I see some posting get upvote and every comment say it works. But in new version of iOS we need to check again. So it's like swift version language. It has developed better again.
So I finally combine answer on the internet to make what I want. So this is the code
As you can see, I make if condition to catch event double tap. There is an answer that works but you need to combine with other answer to do zooming out. Because it just works with zooming in. The value when zooming out all the way is one ( 1 ). So I can check it with if condition then I give zooming out code to zoom out. And now the code works like a charm.
I don't give you the detail of my class. Because it jsut uses UIScrollview and UIImageview. You can do it at your own.
I'll give you the source, If you need to know deeper about the solution discussion.
source : https://stackoverflow.com/questions/3967971/how-to-zoom-in-out-photo-on-double-tap-in-the-iphone-wwdc-2010-104-photoscroll/33838414#33838414