|
I've implemented the "WebView" solution demonstrated by @NigelGee in "SOLVED: Unable to loadHTMLString" in order to display a lengthy HTML document in a SwiftUI contentView. I want the user to scroll to the end of the document before presenting a "Next" button. How do I let the parent contentView know the scrollView of the WKWebView is at its bottom? Thank you! --Bill Judd |
|
Looks like others in the forums were trying to solve a similar problem. Did you review this thread? See-> Fun with scrollView PS: Please tell me you're not trying to make a user scroll to the end of a User Agreement to imply that they read it? Please don't. |
|
@Obelix, thanks for the pointer. FYI, the document is not a EULA or anything like that. The app is part of a research study, approved by an Institutional Review Board. Users interested in participating will be signing an informed consent agreement. The study coordinators have specified the full text of the agreement should be presented to the user before the user can agree to participate. |
|
I honestly tried to think through this issue.
But the issue is your consent agreement might be larger than the view it's displayed in. Also, if a user has adaptive text turned on, the font, by their selection, might be a size larger than one that you calculate. Clearly you need to dynamically determine that your user has scrolled to the end. I read about See-> Scroll View Reader |
|
Thanks, @Obelix, for giving this some energy... I appreciate it. We've decided on an alternate presentation of the content, a seequential presentation of SwiftUI views, an agreement section at a time. Tedious for the user, yes, but they'll only go thru it once and never see it again, although they will receive a signed pdf of the agreement for their records. Thanks again! --Bill |
|
Hi @WBJ I don't know if I'm too late with a proposition. I've implemented a simple detection whether we reached the end of a scroll view by adding a hidden This is something which might also be usable to load new elements as soon as one reaches the end of a list.
See the video I've added to the Gist: |
SPONSORED Still waiting on your CI build? Speed it up ~3x with Blaze - change one line, pay less, keep your existing GitHub workflows. First 25 HWS readers to use code HACKING at checkout get 50% off the first year. Try it now for free!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.