iPhone Home bar interaction

How can I make the same interaction as the Home bar?
That when I swipe up and it hits a certain point, it opens the screen, and if it’s below a certain value it bounces back to its start position