SwiftUI Tutorial: What's the difference between @State, @ObjectBinding, and @EnvironmentObject?

Поділитися
Вставка
  • Опубліковано 21 сер 2024

КОМЕНТАРІ • 238

  • @twostraws
    @twostraws  4 роки тому +9

    Watch next: How to fix slow List updates in SwiftUI - ua-cam.com/video/h0SgafWwoh8/v-deo.html
    Questions? Comments? Tweet me @twostraws.

  • @simonbachmann2120
    @simonbachmann2120 4 роки тому +268

    IMPORTANT: ObjectBinding/BindableObject are deprecated now! @ObjectBinding is become @ObservedObject and BindableObject protocol is become ObservableObject as well as willChange become objectWillChange.

    • @niklasnickel
      @niklasnickel 4 роки тому +3

      Simon Bachmann Thank you so much! This indeed saved a lot of trouble...

    • @sreekumarmenon
      @sreekumarmenon 4 роки тому

      Was going to ask the same, I started swiftui recently and was confused with seeing ObjectBinding in this video! thanks

    • @MattiaRighetti
      @MattiaRighetti 4 роки тому +1

      I was going to ask when to use ObservableObject and BindableObject, thanks! 😊

    • @flexmcpee
      @flexmcpee 4 роки тому

      Ah that makes sense. Only started learning SwiftUI of late and was confused seeing those. Thanks for clearing up.

    • @LazarofShalev
      @LazarofShalev 3 роки тому

      thank you 👌

  • @abcd123906
    @abcd123906 3 роки тому +34

    If you are learning SwiftUI, you literally NEEEEED to watch this video! This scratched so many cognitive "itches" I had about Swift, it's almost scary. Thank you, thank you, thank you!

  • @frimpongopokuagyemang8052
    @frimpongopokuagyemang8052 3 роки тому +1

    Saying that this video is "HELPFUL" would be an understatement. However, I have no bigger words. LOL! In short, THANK YOU DUDE! The way you make things clear, is just something else.👌👌👌👌👌

  • @chrisual
    @chrisual 3 роки тому +3

    Much of this video is not appropriate anymore, but the description of what state, binding, etc are is TOTALLY worth watching. I have watched so many videos, but this is the first time I have understood these concepts. Well done Paul!!

    • @chezchezchezchez
      @chezchezchezchez Рік тому

      I’m just getting started. What would you recommend is the perfect video right now for this information? Thank you very much.

  • @kevin-u7719
    @kevin-u7719 3 роки тому

    I have saved 1 hour while watching you 20 minutes concrete and robust explanatory video. Thank you Paul.

  • @BroadcastYOzZelf
    @BroadcastYOzZelf 4 роки тому +1

    I'm used .Net's, old Xaml's and to Qt Qml's (super elegant) property bindings. I was exactly looking for an intro on how SwiftUI does this. You found the perfect level between giving an overview and going into detail. Thanks!

  • @brandonr.8784
    @brandonr.8784 Рік тому

    Been stuck on these concepts for days, this video really help improve my understanding!

  • @ZoeSummers1701A
    @ZoeSummers1701A Рік тому

    I think this is the best tutorial video you’ve ever made.

  • @coolisfoolable
    @coolisfoolable 3 роки тому +1

    This is THE best tutorial I've seen so far! And boy I've seen many.
    Thanks Paul!

  • @nexplusedinburgh5545
    @nexplusedinburgh5545 5 років тому +4

    Wow! Best SwiftUI video in the whole UA-cam! Thank you!

  • @MatthewCawley
    @MatthewCawley 4 роки тому +1

    I've watched a few different videos on @State, @ObjectBinding and @EnvironmentObject and it didn't make that much sense. Your explanation was amazing, clear and high descriptive. Great job :)

  • @uberunix
    @uberunix 3 роки тому +1

    This is an absolutely fantastic explanation for someone like me who doesn't know enough yet to distinguish the significant bits of what the docs are saying. Thank you so much! :D

  • @oliverbarreto1838
    @oliverbarreto1838 5 років тому +6

    Great great tutorial... first division university class... core concepts really well explained and introduced vía telling an incremental story... a must watch... Apple should absolutely use this video and upload it to SwiftUI developer library
    💪🏻😀😎

  • @rickstrickland2464
    @rickstrickland2464 5 років тому +64

    Your clarity is awesome. Can you do one that uses Core Data?

    • @alihodroj9559
      @alihodroj9559 5 років тому

      maybe he already did one go check : )

    • @rickstrickland2464
      @rickstrickland2464 5 років тому +6

      Core Data with SwiftUI

    • @alihodroj9559
      @alihodroj9559 5 років тому

      @@rickstrickland2464 oh now i get it : )

    • @brunofulber4688
      @brunofulber4688 5 років тому +2

      I wasn't able to make it work too, got to figure a good way to make managed objects conform to bindableObject

    • @stephencollins2831
      @stephencollins2831 4 роки тому

      I’ve been an iOS dev for 1 week :) i think you can pull initial startup data out of core data in the scene delegate. Then pass that data into EnvironmentObjects so it can be accessible to all child view from main. Then each sub view can perform CRUD operations on it with core data. This method may not be great if you’re pulling a lot of data into memory. Perhaps there is a better way? Would love to hear!

  • @24Doggi
    @24Doggi 3 роки тому

    Nest video for a guy who comes from java and python. Thanks!

  • @farukenstein
    @farukenstein 4 роки тому +1

    "please just stop and thnik for one moment how amazing that is" is the one possible definition when it comes to swiftui.

  • @triXtyle
    @triXtyle 9 місяців тому

    Amazing video, teaches us core concept in a very good way. BUT The Victor Hugo reference nailed it!!!

  • @koz
    @koz 5 років тому +8

    Absolutely great stuff. You're making my Swift-learning experience a lot clearer.
    I'm intrigued about "who taught you?" though.
    Because I get the feeling you had a good teacher.
    (This is where you say you're self-taught too)

  • @AndreaCiani
    @AndreaCiani 4 роки тому +1

    This is the best video about this things I have ever watched. You make simple and more complicated examples and you describe them extremely well. Congrats and thanks!

  • @marlhex6280
    @marlhex6280 Рік тому

    Please make more! I love the way you talk with passion and interest! Also the way you edit the videos with a final touch! Awesome job!!!

  • @JVancity
    @JVancity 5 років тому +1

    Been messing around with all three for a few days now, getting things to 'work'! This video really hit the nail on the head and now I truly understand the why. Thanks Paul, you're a legend :)

  • @ac12484
    @ac12484 2 роки тому

    Best no bs intro (experienced programmer here)

  • @JacksMacintosh
    @JacksMacintosh 5 років тому +3

    Oh my goodness. This @EnvironmentObject thing might just save my life. Thank you thank you!

  • @dhavalnena7386
    @dhavalnena7386 5 років тому +1

    Every time I watch your videos it gives me a deeper understanding of the topic explained. Thank you so much!

  • @robertsan2654
    @robertsan2654 4 роки тому +1

    Being an iOS & React developer feels great with SwiftUI. :)

  • @mistermagic4507
    @mistermagic4507 4 роки тому

    Finally my company decided to start the next project using SwiftUI on iOS 13 and here I am, BOOOM :)

  • @dlbYT8
    @dlbYT8 2 роки тому

    Your content is gold. Thanks Paul!

  • @user-xe4qm5bn6i
    @user-xe4qm5bn6i 7 місяців тому

    Just learning Swift.. this was really helpful. And I caught your bread and 24601 reference… Cheers for that one!!! 🥃

  • @JellyLancelot
    @JellyLancelot 4 роки тому

    These videos are soooooo good. Your teaching style is amazing and easy to follow, but not slow enough that I'm skipping around for the info. Clear, concise and concentrated. Superb! Also, you explain the WHY. It's so important, but what so many people miss.

  • @rixantos
    @rixantos 8 місяців тому

    Great video @twostraws very well explained and delivered! Time to write some SwiftUI...

  • @PeterPurmonen
    @PeterPurmonen 5 років тому +2

    Excellent! All gaps flled. Thank you. 👍🏻

  • @petersuvara
    @petersuvara 5 років тому

    Paul, we generally keep state as a completely different place to the UI components themselves, this provides a layer between state/transport and UI.

  • @michaelrogers6935
    @michaelrogers6935 5 років тому

    Apple should've just let Paul see SwiftUI a week early and link all of their documentation to hackingwithswift.com. That would've saved a lot of developers a lot of time. What an awesome explanation!

  • @Mriceman2002
    @Mriceman2002 5 років тому

    You explain very easily even without the help of your two
    dogs :) You are the best ! Hope you continue to make many more videos!

  • @shivammahendru6122
    @shivammahendru6122 3 роки тому

    Much needed explanation!! Thanks Paul

  • @Nicolas-is3gq
    @Nicolas-is3gq 4 роки тому +1

    Excellent tutorial, I finally understand these concepts after trying a few other sources. Thanks Paul!

  • @petrulutenco6600
    @petrulutenco6600 2 роки тому +2

    For anyone watching in 2022 ❗❗
    @ObjectBinding was renamed to *@ObservedObject*
    BindableObject was renamed to *ObservableObject*
    and finally, in the new ObservableObject, didChnage was renamed to *objectWillChange*

  • @idembele
    @idembele 5 років тому

    5:46 beautiful example on how @State keyword works

  • @littletalk8860
    @littletalk8860 5 років тому +3

    Great explanation, love your professional tutorial

  • @drinkitapp8121
    @drinkitapp8121 4 роки тому +1

    3:59 is my favourite part of the the video 🤯

  • @yixe2253
    @yixe2253 5 років тому

    You're a great teacher, easy to understand.

  • @wizzards44
    @wizzards44 5 років тому

    Paul you are smashing it again!!! Great breakdown of new tools!!!

  • @haraprasadsenapati6662
    @haraprasadsenapati6662 4 роки тому

    Awesome video Paul

  • @1sndct
    @1sndct 3 роки тому

    Great explanation, been trying to grasp this concept for a loooooong time, its finally coming together. Thank you

  • @SehajChawla
    @SehajChawla 5 років тому +3

    Love all your tutorials. Would be great to have in depth tutorials on Combine framework as well.

  • @guitaripod
    @guitaripod 4 роки тому

    Now this now a year later, it's so clear. Thanks

  • @piyushgeorge1847
    @piyushgeorge1847 5 років тому

    Best tutorial for the states. Loved it

  • @arkemal
    @arkemal Рік тому

    I've learned a lot from this. Thank you!

  • @sergehulne
    @sergehulne 3 роки тому

    Excellent tutorial! Thanks!

  • @priceringo1756
    @priceringo1756 5 років тому +9

    Should be required viewing to get your SwiftUI badge.

  • @torcelly
    @torcelly 3 роки тому

    Hi Paul. Thank you for this awesome video. Excellent tutorial. Your explanation is accurate, concise, and clear. Congrats!

  • @di_nerd_apps
    @di_nerd_apps 4 роки тому

    BEST EXPLANATIONS !! BIG UP!!!

  • @doanvietios
    @doanvietios 5 років тому +2

    I love SwiftUI n I love this Tutorial too. This is awesome.

  • @niklasnickel
    @niklasnickel 4 роки тому

    Thank you very much! This was the first time I really understood what was going on...

  • @farkhodkh2760
    @farkhodkh2760 Рік тому

    This is Great! Thank you Paul

  • @marcoespinoza3327
    @marcoespinoza3327 4 роки тому

    Stumbled upon your tutorials and explanations and it’s amazing. I am currently doing QA work and do some dev work too as I’m learning. However, this is preparing me for the future and I really appreciate your videos and explanations. I still want to transition from QA to dev because it’s more interesting but I know I have a while to go.

  • @nirb16
    @nirb16 3 роки тому

    Great explanation! Thank you

  • @andrevdw747
    @andrevdw747 4 роки тому +1

    What a clear explanation! Thanks! Also understandable for a beginner like me :-)

  • @MeteoraEra
    @MeteoraEra 4 роки тому

    Your videos are awesome man.

  • @kimtipatel7
    @kimtipatel7 Рік тому

    U r superb explaining ❤

  • @egormerkushev
    @egormerkushev 4 роки тому +1

    Thank you for this tutorial!

  • @thealchemist1480
    @thealchemist1480 5 років тому

    This is well described and very helpful video indeed. Keep the good work up,,, you are doing a commendable job for the community.

  • @dimiutube
    @dimiutube 4 роки тому

    Thanks for the great explanation, Paul! Now most of the magic behind SwiftUI is much clearer for me :-)

  • @francescofuscaldo2364
    @francescofuscaldo2364 5 років тому +1

    Great videos, thank you so much. I'd like to suggest you a subject for the next videos, it would be great to see how to work with CoreData and SwiftUI!

  • @limtc
    @limtc 5 років тому

    This is the best explanation so far! However, I do hope you can add in explanation of @Binding besides these 3.

  • @olepetersen4460
    @olepetersen4460 3 роки тому

    Another great video - thank you.

  • @vipullal7689
    @vipullal7689 3 роки тому

    Loved it! Clear tutorial.

  • @kimsaypov162
    @kimsaypov162 3 роки тому

    Great explanation. Thanks.

  • @TK-tg1hx
    @TK-tg1hx 3 роки тому

    You are really brilliant smart.... What a wonderful explain!? Thank you sooooo much!

  • @greggy16d
    @greggy16d 5 років тому +3

    This is priceless. Thank you

  • @jacks-projects5238
    @jacks-projects5238 3 роки тому

    This is a superb video.

  • @SudipBhattacharyya
    @SudipBhattacharyya 3 роки тому

    Excellent. Thank you so much ☺️☺️👍

  • @pbalinov
    @pbalinov 2 роки тому

    Great video! Thank you!

  • @olepetersen4460
    @olepetersen4460 3 роки тому +3

    You make really great videos, and thank you for that. Regarding this one: My projects have no SceneDelegate, so an update would be highly appreciated. Where and how do you set up the global varible in the .app file?

  • @hilalalhakani9139
    @hilalalhakani9139 3 роки тому

    Great explanation

  • @fortune1109
    @fortune1109 5 років тому

    Hi Paul, thank you for the tutorials you are making. Helps me alot.

  • @thomasanderson1416
    @thomasanderson1416 Рік тому +1

    Can we refactor all the states out of view structs in a single file for example, and still access and control them from all views?
    That would be so awesome.

  • @muzikjay
    @muzikjay 2 роки тому

    Thank you so much for this!!

  • @max500k
    @max500k 3 роки тому

    Awesome video, super concise!

  • @daspisch
    @daspisch 2 роки тому

    Swift loves structures, but to do almost every single move in not a helloworld like apps we need a classes) Also i love how siwft hide uglycity under the property wrappers and operators overloading

  • @enzmondo
    @enzmondo 2 роки тому

    Didn't think I'd find a Les Mis reference in a video about how to pass around updated data in an app.

  • @alexanderfitterling
    @alexanderfitterling 3 роки тому

    Thank you so much for this video. You have amazing good teaching skills!

  • @readmore2019
    @readmore2019 5 років тому +1

    ~AMAZING~ This is SOOO helpful!!!

  • @jimscodecorner5108
    @jimscodecorner5108 2 роки тому

    Great video! Thank you

  • @tomtubbs6254
    @tomtubbs6254 5 років тому +1

    Thanks Paul - great visuals for the video along with your clear instruction.
    +1 for the request for a basic Swifty I app that uses core data.

  • @shivaskanthan6144
    @shivaskanthan6144 5 років тому

    Excellent explanation!

  • @charlesbessonnet2693
    @charlesbessonnet2693 4 роки тому

    really great video 👍

  • @ChristianLeovido
    @ChristianLeovido 4 роки тому

    Thank you so much, your explanation of these concepts is very clear

  • @koustav2008
    @koustav2008 5 років тому

    EXCELLENT Explanation !!!

  • @pogosanesyan9999
    @pogosanesyan9999 4 роки тому

    Very good material thanks

  • @anandmishra3926
    @anandmishra3926 3 роки тому

    Love❤️ this Video.

  • @lvkd_
    @lvkd_ 5 років тому

    Awsome Teacher.. thank you for your great lecture

  • @marcaupont9145
    @marcaupont9145 5 років тому

    Great vid!! Love the explanations!

  • @kronosDE
    @kronosDE 4 роки тому

    The Textfield mentioned in the video doesn't work anymore. The new API is now something like that: TextField("placeholder text", text: $myInput)

  • @layerlapse7645
    @layerlapse7645 5 років тому

    Environment = Source of Truth

  • @cularu1
    @cularu1 5 років тому

    Very cool! Much simpler than managing state in android.

  • @neiljsmith11
    @neiljsmith11 5 років тому

    Paul Hudson providing the instruction manual that should've been included in the box.

  • @HeretikKee
    @HeretikKee 5 років тому +1

    Awesome video Paul!!! I've been watching them (and listening at your podcast) and I must say, you have overdone it whit that one. Thanks.

  • @alondob
    @alondob 5 років тому

    Great explanation!