Stop using GeometryReader in SwiftUI
ฝัง
- เผยแพร่เมื่อ 13 มิ.ย. 2024
- GeometryReader is commonly used to control the size of a View w.r.t its parent View/container. Let's explore a simple ViewModifier in iOS 17 that makes this so much easier and nicer to read.
🚀 LaunchBuddy: apple.co/3iFcjjW
📚 Try CWC+: bit.ly/cwc_flo
☕️ Buy me a coffee: ko-fi.com/flowritescode
Join this channel to get access to perks:
/ @flowritescode
👋 Links: flowritesco.de
🛠 Forge: apple.co/3riG8MQ
Chapters:
0:00 GeometryReader Example
2:10 containerRelativeFrame
Affiliate Links ❤
📕 SwiftUI & Combine Books: www.bigmountainstudio.com/a/t...
🔬 Get Reports about your apps: appfigures.com/r/5by3g
📊 Privacy focused analytics: dashboard.telemetrydeck.com/r...
💻 The most powerful mac app for developers: devutils.app/?ref=flo
☕️ Support me: ko-fi.com/flowritescode
If you have any video suggestions please feel free to let me know by a comment.
Get in contact via
Twitter: / flowritescode - วิทยาศาสตร์และเทคโนโลยี
How will you use this API?
Sehr guter Tipp! Danke fürs zeigen 👍
Very useful information! Thanks for sharing Flo! 🙌🏻
My pleasure!!
Awesome! I'm right in the process of GeoReader and considering a second option. I think this will work! Thank you!
Glad it was helpful!
I don’t think this modifier works relative to the parent view like geometry reader does. Instead it works relative to a container which is a window, scroll view or navigation stack
Good tips !!
Thanks!
Awesome Flo - thank you for the clear demo! I didn't know about his modifier! I'd image I'll use it for all sorts of things, including a custom bottom sheet (when your app doesn't support the SwiftUI iOS version to use detents) combined with ScaledMetric or something. Anyway, thanks again!
Hey Scott! This sounds great, but unfortunately this API was only introduced in iOS 17... So it's not really suitable for you use case :/
Thank you...
GeometryReader is good for all iOS devices if you wanna keep the same size based screen size
Ein tutorial zum thema animationen wäre richtig cool 🎉
Welche Art von Animationen würdest du gerne lernen? .animation, .symbolEffect oder PhaseAnimator?
@@FloWritesCodeist .animation nicht veraltet? Ansonsten sowohl symboleffect als auch phase wäre ganz cool. Vielleicht als Video Idee für dich "Introduction into Animations"
🔥🔥🔥
Maybe this uses GeometryReader behind the scene?
We'll probably never know :/
Swift is open sourced though :)
@@meowpeow765 Yup, but this is about SwiftUI, which isn't :/
Stop using iOS 17 only)
Tell Apple to stop shipping SwiftUI updates that aren't backwards-compatible...
@@FloWritesCode New title: "Stop using GeometryReader in SwiftUI (iOS 17+)"