-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support UIViewController contentScrollView #723
base: main
Are you sure you want to change the base?
Support UIViewController contentScrollView #723
Conversation
Is there any update to this issue? |
+1 |
if #available(iOS 15.0, *) { | ||
if computeScrollSize, let scrollView = viewController.contentScrollView(for: .top) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some cases this is misleading, for example, computeScrollSize: true
on the caller site, but without effect when the project's deployment target is less than iOS 15.
Having an alternative for backward compatibility that looks for the top-most or bottom-most(?) scrollView
would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense. Just to better understand, can you expand a little about what do you think should be the alternative for devices with target < iOS 15 ? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking about something that traverses through the subviews and returns the first (topmost) one which matches the predicate of view is UIScrollView
.
https://stackoverflow.com/questions/32301336/swift-recursively-cycle-through-all-subviews-to-find-a-specific-class-and-appen
https://stackoverflow.com/questions/32151637/swift-get-all-subviews-of-a-specific-type-and-add-to-an-array/45297466
I'm not saying that these implementations are correct, so please use them with a grain of salt, but the idea is something like this.
Edit: The above is not going to be good, because we want to assess those at the current depth level, and only then go deeper.
I added an optional argument to the
.image
snapshot strategy that try to retrieve theUIViewController.contentScrollView
(when it's available).This should improve the sizing of the target
UIViewController
in the case aUIScrollView
is used.This proposal should provide a better way of working around the issue #264.