SwiftUI - @Binding Property Wrapper Explained - Passing Data

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • 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 ปีที่แล้ว +6

    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 ปีที่แล้ว +4

    You literally saved me from stop coding forever. Love it.

  • @TidalWaveDan
    @TidalWaveDan ปีที่แล้ว +2

    I really appreciate the disclaimer and pointing me in the right direction for passing in at deeper levels. Thanks!

  • @traftonreynolds3528
    @traftonreynolds3528 2 ปีที่แล้ว +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!!!

  • @KimbrellBrad
    @KimbrellBrad 3 ปีที่แล้ว +11

    As always, very clear explanation. I really appreciate your content and style! Thanks for what you do for the community!

    • @seanallen
      @seanallen  3 ปีที่แล้ว +2

      Thanks for the kind words, Brad 😀

  • @coolisfoolable
    @coolisfoolable 3 ปีที่แล้ว

    Love your channel Sean. Subscribed!!!!

  • @KFrench1123
    @KFrench1123 3 ปีที่แล้ว

    Good stuff! Thanks, Sean!

  • @andrevdw747
    @andrevdw747 3 ปีที่แล้ว +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 ปีที่แล้ว +1

    Thank you very much. Your videos are really great and useful.
    Peter

    • @seanallen
      @seanallen  3 ปีที่แล้ว

      Glad you like them!

  • @legend_chronicles
    @legend_chronicles 3 ปีที่แล้ว +1

    really like this video.
    thank you

    • @seanallen
      @seanallen  3 ปีที่แล้ว

      Glad you enjoyed it, Nheng.

  • @edyarro4291
    @edyarro4291 4 หลายเดือนก่อน +1

    Great content, i appretiate the disclaimer. Not because you can do it that you should #facts

    • @seanallen
      @seanallen  4 หลายเดือนก่อน

      I appreciate that

  • @petersuvara
    @petersuvara 3 ปีที่แล้ว +1

    Nice little tutorial! 👍🏻

    • @seanallen
      @seanallen  3 ปีที่แล้ว

      Thanks Peter!

  • @mayankbhaisora2699
    @mayankbhaisora2699 3 ปีที่แล้ว +2

    Thanks for this easy to understand video :)

    • @seanallen
      @seanallen  3 ปีที่แล้ว +1

      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.

  • @terrykuo501
    @terrykuo501 3 ปีที่แล้ว +2

    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 3 ปีที่แล้ว

    dude you are cool!

  • @willasaskara
    @willasaskara 3 ปีที่แล้ว +1

    Thanks!

    • @seanallen
      @seanallen  3 ปีที่แล้ว

      Happy to help, Willa.

  • @pren5948
    @pren5948 ปีที่แล้ว

    thanks

  • @ahmadkhattab5700
    @ahmadkhattab5700 4 หลายเดือนก่อน

    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

  • @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.

  • @prajaktanisal2247
    @prajaktanisal2247 2 หลายเดือนก่อน

    What if the variable in parent is optional ?

  • @cashbackhouses
    @cashbackhouses 3 ปีที่แล้ว +1

    Great video. What's the proper way to pass a string that is a part of an array?

  • @yrac2409
    @yrac2409 3 ปีที่แล้ว +1

    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!

  • @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 ปีที่แล้ว +2

      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 😀 - th-cam.com/video/48JYBb5yJ0s/w-d-xo.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 ปีที่แล้ว

    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