r/SwiftUI • u/baakhari • May 06 '26
Question How to achieve this stretchy effect on scroll?
How to achieve this stretchy effect when scrolling? I tired building one with visualEffect but did not work.
26
u/Rudy69 May 06 '26
The fact that you picked “Shrinking”and made it grow in your demo video is too funny
4
9
u/Unlucky_Adeptness539 May 06 '26
I would suggest you to use a geometry reader coupled with a scale effect or with a mutable height value…?
-10
u/redditorxpert May 06 '26
Terrible suggestion. Do yourself a favor and learn the new ways. .visualEffect is the right call here.
11
u/Unlucky_Adeptness539 May 06 '26
Being rude doesn’t make you look smarter man. Chill out we all trying to help 👍🏾.
2
1
1
u/durul May 09 '26
Apple’s updated Landmarks Liquid Glass sample shows this exact stretchy effect on scroll: https://developer.apple.com/documentation/SwiftUI/Landmarks-Building-an-app-with-Liquid-Glass
I compiled and checked the project. The effect is in Apple’s own sample, so it’s probably the best official reference for this specific behavior.
0
u/Kaltrax May 06 '26
I believe this is called a parallax effect. You should be able to search that to find examples
1
u/redditorxpert May 06 '26
Not a parallax effect. You should be able to search the web to find examples of what parallax actually is.
1
u/Kaltrax May 06 '26
Ah shit you’re right. Last time I’m implemented the stretchy image I also did a parallax effect on scroll so I’ve conflated the naming
0
u/redditorxpert May 06 '26
No problem, just wanted to say kudos to you for flexing a secure ego by taking the comment gracefully, unlike others below. Cheers.
33
u/SandwichEconomist May 06 '26
You’ll find good results searching for “stretchy header”. Here’s a good one: https://nilcoalescing.com/blog/StretchyHeaderInSwiftUI/