SwiftUI - @Binding Property Wrapper Explained - Passing Data

  Переглядів 29,905

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

КОМЕНТАРІ: 39
@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 😀
@TidalWaveDan
@TidalWaveDan Рік тому
I really appreciate the disclaimer and pointing me in the right direction for passing in at deeper levels. Thanks!
@traftonreynolds3528
@traftonreynolds3528 Рік тому
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!!!
@coolisfoolable
@coolisfoolable 2 роки тому
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 10 місяців тому
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.
@petersuvara
@petersuvara 3 роки тому
Nice little tutorial! 👍🏻
@seanallen
@seanallen 3 роки тому
Thanks Peter!
@legend_chronicles
@legend_chronicles 2 роки тому
really like this video. thank you
@seanallen
@seanallen 2 роки тому
Glad you enjoyed it, Nheng.
@edyarro4291
@edyarro4291 Місяць тому
Great content, i appretiate the disclaimer. Not because you can do it that you should #facts
@seanallen
@seanallen Місяць тому
I appreciate that
@ahmadkhattab5700
@ahmadkhattab5700 24 дні тому
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
@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. :)
@egorsev
@egorsev 2 роки тому
dude you are cool!
@willasaskara
@willasaskara 3 роки тому
Thanks!
@seanallen
@seanallen 3 роки тому
Happy to help, Willa.
@AZMerf
@AZMerf 2 роки тому
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.
@pren5948
@pren5948 Рік тому
thanks
@cashbackhouses
@cashbackhouses 3 роки тому
Great video. What's the proper way to pass a string that is a part of an array?
@yrac2409
@yrac2409 2 роки тому
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!
@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 😀 - ukposts.info/have/v-deo/bGh7jXiZbK97kac.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.
@oxirosmusic
@oxirosmusic 9 місяців тому
One thing to note is that binding properties don’t have to be named the same for them to be binded
@bronnstorm1563
@bronnstorm1563 9 місяців тому
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
@EnvironmentObject Explained in SwiftUI | iOS 17
21:16
AppStuff
Переглядів 3,6 тис.
когда одна дома // EVA mash
00:51
EVA mash
Переглядів 1,4 млн
SMART GADGET FOR COOL PARENTS ☔️
00:30
123 GO! HOUSE
Переглядів 18 млн
Мама и Чебурашка 🤪#shorts
00:33
INNA SERG
Переглядів 646 тис.
Your App Will Get Rejected | New Privacy Rules - 2024
11:26
Sean Allen
Переглядів 25 тис.
You might not need useEffect() ...
21:45
Academind
Переглядів 116 тис.
Data Flow in a SwiftUI App
33:15
CodeWithChris
Переглядів 51 тис.
8 Common SwiftUI Mistakes - and how to fix them!
28:05
Paul Hudson
Переглядів 49 тис.
Геймер с самым быстрым интернетом
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Переглядів 389 тис.
iPhone 19?
0:16
ARGEN
Переглядів 3,8 млн
Нужен ли робот пылесос?
0:54
Катя и Лайфхаки
Переглядів 706 тис.
The Worst Product I've Ever Reviewed... For Now
25:04
Marques Brownlee
Переглядів 7 млн