1

I'm for some guidance in how I could implement an item/button popping up at the bottom of the screen if a user has scrolled past it in the view. An example of this is in the App Store, where the download app button shows up after the original button disappears from view:

Button before scrolling

Button after scrolling

fballjeff
  • 302
  • 3
  • 9

1 Answers1

0

This should get you going. The accepted answer is where I'd start. SwiftUI - Detect when ScrollView has finished scrolling?

Effectively what you want to do is detect when your view is off screen. To do that you need to watch for changes to your scrolling window. you can extrapolate, using math, to determine when your view is off screen, and when you need to present your new view.

So break it down into it's individual components.

  • Detect Scrolling
  • Detect distance scrolled
  • Determine view height for the original "Button" that is scrolled off screen. Geometry Reader will help with that.
  • Get screen height and do some math. screenHeight - scrolledDistance if it is greater than buttonHeight show your view on the bottom, otherwise wait.

This is extremely high-level and not very detailed because your original question is likely opinion based and there's a ton of different ways to handle this. So with that being said, if you add an attempt, I'd be more than happy to edit my answer to give some more clarifying details.

Please review this. https://stackoverflow.com/help/minimal-reproducible-example

xTwisteDx
  • 2,152
  • 1
  • 9
  • 25