SwiftUI - @State Property Wrapper Explained

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

КОМЕНТАРІ • 23

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

    If you enjoy my teaching/presentation style, I've started creating my own courses at seanallen.teachable.com. You can watch the first ~10% of each course for free to get a feel for them.

  • @mikem1451
    @mikem1451 3 роки тому +5

    I like to think of @state as state of matter of water in a glass. The water can be a solid, liquid, or gas but it’s still the same water/ source truth. Usually a glass of water is private to you drinking it and depending on the what you do like go outside in the cold or placing it on a hot stove, the water can change state but it’s still same thing. When you go back inside or take the cup off the stove the ice, steam/view is destroyed and water defaults back to liquid.

    • @user-ec1dn3uz5k
      @user-ec1dn3uz5k 3 роки тому

      Thanks for that! Pretty good way to retain the info

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

    Like how you delve into the topic, keep up the good work. The whole world is looking at you 🤚🏻👍🏻

  • @adrewtube1
    @adrewtube1 3 роки тому +2

    Oh thank you for this! Apple should link to these videos from their documentation :)

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

      Thanks for the kind words 😀

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

    How I understood We can use @State only with structs. And we need @State to make a private variable on that view.

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

    You made it so simple and clear, thanks!

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

    Nice vid, are you going to be diving any deeper into State? Such as what it is behind the scenes, wrappedValue, projectedValue etc?
    You explain things so well, that would be a nice vid coming from you

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

      Potentially in the future. This video was aimed at those that are just getting started with SwiftUI and need to basics. A more involved video could come in the future.

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

    It would be cool if you can showcase some of your audiences' squarespace websites one day.

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

    @State is a View local variable for you, what do you use for app global storage? For night/day-mode I assume you make persistance related to some login credential? or do you persist for the current installation of your app only?

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

    Okay that makes a lot of sense, but how then would I use @StateObject? and @Published?

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

    I am in a @State of awe.

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

    How different is @State compared to UserDefaults in UIKit.

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

    Can you explaining the @Binding property wrapper

  • @elaf7092
    @elaf7092 7 місяців тому +1

    very helpful

    • @seanallen
      @seanallen  7 місяців тому

      Glad to hear that

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

    Great explanation

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

    Well done. Thanks

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

    Thanks Sean

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

    Hi Sean,
    Been following the channel for a while now, wondered if my entry into the industry is overkill
    I’ll be recreating Twitter Instagram Facebook Tinder & TikTok With Fire base Backend for my Portfolio and building each in Objective-C and Swift (UIKit Programmatic)
    Would I need anything else?
    Kind regards

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

    great explanation