SwiftUI - @Binding Property Wrapper Explained - Passing Data

  Рет қаралды 31,374

Sean Allen

Sean Allen

Күн бұрын

In today's video I show you how to pass data between two views in SwiftUI. In this particular example we use the @Binding property wrapper in SwiftUI. I show you how a button tap from a modal view can change the data on the parent view. This tutorial was created in Xcode 12.4.
If you like my teaching or presentation style, I've started creating my own courses:
seanallen.teachable.com/
Twitter:
/ seanallen_dev
Link to my book - How I Became an iOS Developer:
gumroad.com/l/sean-allen-origin
Hired.com:
hired.com/x/1n01g
Check out my podcast, iOS Dev Discussions:
itunes.apple.com/us/podcast/i...
Book and learning recommendations that help out the channel if you decide to purchase (Affiliate Links):
Ray Wenderlich Books:
store.raywenderlich.com/a/208...
Ray Wenderlich Videos:
store.raywenderlich.com/a/208...
Paul Hudson's Hacking With Swift:
gumroad.com/a/762098803
Learn Advanced Swift Here:
gumroad.com/a/656585843
Links to my iOS Dev Setup & iOS Dev Book Recommendations
www.amazon.com/shop/seanallen
#swift #softwaredeveloper #iosdeveloper

Пікірлер: 40
@seanallen
@seanallen 3 жыл бұрын
If you enjoy my teaching/presentation style, I've started creating my own iOS development courses at seanallen.teachable.com. You can watch the first ~10% for free to get a feel for them.
@prettygirl6146
@prettygirl6146 2 жыл бұрын
You literally saved me from stop coding forever. Love it.
@KimbrellBrad
@KimbrellBrad 3 жыл бұрын
As always, very clear explanation. I really appreciate your content and style! Thanks for what you do for the community!
@seanallen
@seanallen 3 жыл бұрын
Thanks for the kind words, Brad 😀
@traftonreynolds3528
@traftonreynolds3528 2 жыл бұрын
I'm making an app for my internship this summer (Never used swift before last month) and this is exactly what I was looking for. You're a lifesaver, thank you!!!
@TidalWaveDan
@TidalWaveDan Жыл бұрын
I really appreciate the disclaimer and pointing me in the right direction for passing in at deeper levels. Thanks!
@coolisfoolable
@coolisfoolable 3 жыл бұрын
Love your channel Sean. Subscribed!!!!
@KFrench1123
@KFrench1123 3 жыл бұрын
Good stuff! Thanks, Sean!
@andrevdw747
@andrevdw747 2 жыл бұрын
Thanks Sean!
@danrleiribeiro7959
@danrleiribeiro7959 2 жыл бұрын
Amazing content! Thanks a lot !
@delask7601
@delask7601 Жыл бұрын
Nice tutorial, getting lots of tips from the video
@peterplass9458
@peterplass9458 3 жыл бұрын
Thank you very much. Your videos are really great and useful. Peter
@seanallen
@seanallen 3 жыл бұрын
Glad you like them!
@mayankbhaisora2699
@mayankbhaisora2699 3 жыл бұрын
Thanks for this easy to understand video :)
@seanallen
@seanallen 3 жыл бұрын
Happy to help, Mayank!
@mayankbhaisora2699
@mayankbhaisora2699 3 жыл бұрын
@@seanallen Thank you so much... Can you please share a video showing the exact structure of the project in MVC and MVVM and where should we keep our API calling code in UIKit and also the structure of SwiftUI project... Showing some demo code with best practices in folder structure and where to write specific code like networking, logical code etc. I never got exposed properly with best practices as I am the only iOS developer in my company and learnt iOS development myself but I am always confused whether i am properly following the best practices or not.
@legend_chronicles
@legend_chronicles 3 жыл бұрын
really like this video. thank you
@seanallen
@seanallen 3 жыл бұрын
Glad you enjoyed it, Nheng.
@edyarro4291
@edyarro4291 3 ай бұрын
Great content, i appretiate the disclaimer. Not because you can do it that you should #facts
@seanallen
@seanallen 3 ай бұрын
I appreciate that
@petersuvara
@petersuvara 3 жыл бұрын
Nice little tutorial! 👍🏻
@seanallen
@seanallen 3 жыл бұрын
Thanks Peter!
@terrykuo501
@terrykuo501 3 жыл бұрын
Great Video👍🏽🤩, SFsymbols actually can use the .font modifier to change the size tho. Apple have seen that as a Text even though it’s called inside Image().
@falcontomto
@falcontomto 3 жыл бұрын
Thanks for sharing that knowledge! didn't know that and I'm gonna try that in my playground project later. :)
@willasaskara
@willasaskara 3 жыл бұрын
Thanks!
@seanallen
@seanallen 3 жыл бұрын
Happy to help, Willa.
@egorsev
@egorsev 3 жыл бұрын
dude you are cool!
@ahmadkhattab5700
@ahmadkhattab5700 3 ай бұрын
Thanks for sharing this awesome video!, But i have a question is it possible to pass @Published property in ViewModel to custom SwiftUI View expecting @Binding property
@pren5948
@pren5948 Жыл бұрын
thanks
@AZMerf
@AZMerf 3 жыл бұрын
How do you do this exact same thing but using @AppStorage? I figure I could replace the @State with a properly formatted @AppStorage but that didn’t work. I only updates the first string with the first thing typed in the modal (I am trying to pass a string). Of course when I close it or do something else on the first screen it updates, but not when I slide the modal back down. Thanks.
@cashbackhouses
@cashbackhouses 3 жыл бұрын
Great video. What's the proper way to pass a string that is a part of an array?
@yrac2409
@yrac2409 3 жыл бұрын
Like .constant(false) in the preview section, what do you write down when your binding is a string not a bool? love your videos btw! very easy to understand!
@prajaktanisal2247
@prajaktanisal2247 Ай бұрын
What if the variable in parent is optional ?
@oxirosmusic
@oxirosmusic Жыл бұрын
One thing to note is that binding properties don’t have to be named the same for them to be binded
@fantomchris
@fantomchris 3 жыл бұрын
Really cool, but what is the meaning of @State and the usage of dollar before variables call?
@seanallen
@seanallen 3 жыл бұрын
It's a lot to type out, but I did a video just like this one for the @State property wrapper that explains it here 😀 - kzfaq.info/get/bejne/ap56jKWTmt-uYKc.html
@fantomchris
@fantomchris 3 жыл бұрын
@@seanallen Thanks for your answer. Sorry for having missed that video. Nice work, as always.
@seanallen
@seanallen 3 жыл бұрын
No problem!
@gjermundification
@gjermundification 3 жыл бұрын
The dollar symbol is 2 way data binding in several frameworks; angular and Combine for sure.
@bronnstorm1563
@bronnstorm1563 11 ай бұрын
The contrast between the bald head and the lush beard made me feel so interesting that I was a little distracted. Dude, don't get me wrong, I mean very sexy
SwiftUI Link - Open Website in Safari | iOS 14 | Xcode 12.4
3:58
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 37 МЛН
DEFINITELY NOT HAPPENING ON MY WATCH! 😒
00:12
Laro Benz
Рет қаралды 31 МЛН
SwiftUI List with Custom Cell & Passing Data
36:27
Sean Allen
Рет қаралды 115 М.
Swift Closures Explained
14:23
Sean Allen
Рет қаралды 60 М.
How to use @Binding property wrapper in SwiftUI | Bootcamp #22
12:40
Swiftful Thinking
Рет қаралды 33 М.
iOS Core Data QuickStart Tutorial 2020
1:10:58
CodeWithChris
Рет қаралды 100 М.
How to use @EnvironmentObject in SwiftUI | Bootcamp #51
26:48
Swiftful Thinking
Рет қаралды 36 М.
SwiftData Basics in 15 minutes
15:18
CodeWithChris
Рет қаралды 40 М.
How to Get User Location on a Map - Swift
26:11
Sean Allen
Рет қаралды 62 М.
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 4,9 МЛН
Choose a phone for your mom
0:20
ChooseGift
Рет қаралды 6 МЛН
Игровой Комп с Авито за 4500р
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 2,1 МЛН
НЕ ПОКУПАЙ СМАРТФОН, ПОКА НЕ УЗНАЕШЬ ЭТО! Не ошибись с выбором…
15:23
Tag her 🤭💞 #miniphone #smartphone #iphone #samsung #fyp
0:11
Pockify™
Рет қаралды 38 МЛН