How to create custom Property Wrappers in SwiftUI (PART 1/2) | Advanced Learning #30
ฝัง
- เผยแพร่เมื่อ 5 ส.ค. 2024
- In SwiftUI, a property wrapper is a Swift language feature that allows you to add a layer of custom behavior to properties. Property wrappers are used to augment the behavior of properties in a concise and reusable way. They are commonly used in SwiftUI for managing state, data binding, and more. We will learn how they work, why they work, and how to make your own!
🤙 WELCOME BACK 🤙
WEBSITE: www.swiftful-thinking.com
DISCORD: / discord
GITHUB: github.com/SwiftfulThinking/
SAY THANKS: www.buymeacoffee.com/nicksarno
00:00 Property Wrappers
03:12 Welcome back!
05:13 Code start
05:40 Custom Bindings
06:59 When to create Property Wrappers?
09:21 Primary Example Start
17:24 Building a custom Struct
23:13 Mutating Views / Property Wrapper magic
26:29 Dynamic Property
28:20 Converting to a Property Wrapper
35:34 @propertyWrapper
38:47 Adding custom keys
42:55 Initial Wrapped Value
45:32 Projected Value
50:03 Wrapping up
That "Ta-Da-DA!" moment is brilliant!
Excellent video, thanks.
Regarding 'atomically', best practice is to use "true" for almost all usage.
It's mostly a safety mechanism. It helps guarantee that the data is correctly written out before any original file is replaced.
one of the best tutorial ever!
Masterful breakdown on custom Property Wrappers - both parts are gold! 👏🔥
Pure brilliant, as always! Thanks, Nick
Great detailed explanation. Very easy to understand once it has been explained the way you explain it!
Very interesting! Looking forward for the next 3 videos in line :)
Brilliant!
Excellent video, I learned a lot here.
Thanks Nick for investigating property wrappers. And even more thanks for sharing what you've learned !!!! I like the way you share this with your step-by-step approach. It takes me to understand what, why, when and how to use custom property wrappers. Great job !!!
So well explained, Thank you so much!
Amazing content and explanation. Thank you!
Amazing.. it was an epic lecture for sure!
Amazing explanation, thank you!!!
Thanks, Nick. This content is worth your time in gold.
Thanks Jose! I love seeing familiar faces in the comments 👍
Thank you Nick,
Good tutorial.
thank you man
ty
but we keep using the @State inside FileManagerProperty... Will that change? I love your videos!
Thanx again for all u do. I could use a property wrapper for SpriteKit and nodes. They are a challenge with Views
Really useful.
Discord link invite is not working for me. Can you please help with that.?
Try this one: discord.gg/VDTvTNvcXP
Please make one complete app with proper business's logic in swiftui...
You are doing making really nice video.
Looks like you have not committed source code. Can we please have that? Thanks.