Hey, I raised the earlier issue (#1) and just wanted to let you know of a problem I found:
When ZoomableScrollView
is used within a container that has .edgesIgnoringSafeArea(.all)
set, the image has some padding on top and bottom added, see the white bars on top and bottom:
They are also there when zooming in and what it means is that if you scroll all the way to the top/bottom of an image, there's still padding there.
I've done quite a bit of experimentation and searching and ultimately landed on this being a problem with UIHostingController
and sizeThatFits
, see this blog post and linked tweets (and FB8176223): https://noahgilmore.com/blog/swiftui-self-sizing-cells/
There is a hack to potentially fix it: https://twitter.com/b3ll/status/1193747288302075906
But IMO it's too much. I'm currently looking at either adapting the view so that it only handles images (because it's easy to get the correct size of an image, and no need to use UIHostingController
), or keep the current Content
but also allowing to specify the exact content size.
(Another thing I want to do is double tap to zoom to the tapped position (not just center), but that turns out to be hard with the current centerContent
way of doing things because it offsets the position.)