How to use Structs in Swift | Swift Basics #9

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 28

  • @drendelous
    @drendelous 16 дней назад

    13:05 the sign of a good teaching

  • @808richforever
    @808richforever Год назад +6

    thank you for this series...it's like helping me read Swift's syntax and grammar and functionality. Which helps me understand how UIs and the tutorials work from the written aspect! Thank you so much!

  • @MosabbirSadman
    @MosabbirSadman Год назад

    I appreciate you explicitly making a video on the basics of structs, Nick. They're truly gems!

  • @m.d.2029
    @m.d.2029 7 месяцев назад

    Спасибо, Ник!!! Как всегда, на высоте!

  • @Traaaaa_
    @Traaaaa_ Год назад

    This video looks like getter and setter for encapsulation in struct. I ever learned getter and setter in c++ . Actually same but method how to make is different. Thankyou nick

  • @Aboutjailbreak_IOS
    @Aboutjailbreak_IOS 4 месяца назад

    Thank you very much buddy! You are goated. Really appreciate you))

    • @SwiftfulThinking
      @SwiftfulThinking  4 месяца назад +1

      Glad I could help

    • @Aboutjailbreak_IOS
      @Aboutjailbreak_IOS 4 месяца назад

      @@SwiftfulThinking I really started my first coding from you. I understood the whole base level just because of your wonderful skills and explaining. Keep it up🤝

  • @fran8a
    @fran8a Год назад

    Hi!
    Thank you for these handy videos.
    In this one, I don't understand why you mentioned in previous videos using structs as preferable, but inside the struct, you use funcs that are risky for threading...

    • @SwiftfulThinking
      @SwiftfulThinking  Год назад +1

      There are no threading issues with structs because they are handled differently in memory. Structs are passed by value and not reference

    • @fran8a
      @fran8a Год назад

      @@SwiftfulThinking even if you use a func inside a struct? this drives me crazy :S

    • @swiftodyssey
      @swiftodyssey 2 месяца назад +1

      @@fran8a You're partly right: mutable shared instances of structs can still be accessed or modified by multiple threads, leading to race conditions. This means you can't always guarantee you're reading the latest value. However, since structs are value types and are copied when passed around, changes to a copy won't affect the original, making them effectively thread-safe in those cases due to no shared resources.

  • @frodprefect
    @frodprefect Год назад

    Love these videos. Say you have 100 variables in your struct. How would you go about updating them individually?

  • @jgraz96
    @jgraz96 11 месяцев назад +5

    This one is a hard one. I completely lost the path from the previous videos. Even the one before this you mentioned was very “hard” it was very easy to me I got it completely. But this one right here… lost

    • @auroraj9648
      @auroraj9648 8 месяцев назад

      lol, Me too, I'm soooooo lost

    • @niritrachelbisconer5892
      @niritrachelbisconer5892 5 месяцев назад

      It is harder! I'll have to rewatch a few more times. Hopefully it will click

  • @luissda1
    @luissda1 Год назад

    Hiiiii men thank you for helping me so much in my career as iOS dev

  • @amaniduniaapps
    @amaniduniaapps 9 месяцев назад

    Well Done Nick!I like a lot how you comment out what u are doing and i wonder if u do it the same way when you write apps for yourself ?

  • @mosh_wash
    @mosh_wash Год назад

    Hey Nick!👋Thanks for the video!
    Question:
    If someone ever worked with Figma components, can we say that this analogy is true:
    Struct is a main component with parameters we defined.
    Mutating a struct is like creating an instance of that component + changing values of parameters we defined?

  • @FENTANYLJET
    @FENTANYLJET 5 месяцев назад

    how can we get access to this project file for learning purposes

  • @einfacheinschlafen7399
    @einfacheinschlafen7399 8 месяцев назад

    hello ,can t find the source code on the website

  • @simply6162
    @simply6162 Год назад

    when will you provide us reason why there is benefit of using mutating function instead of creating new struct itself?

    • @SwiftfulThinking
      @SwiftfulThinking  Год назад +1

      You can google it, there are a few StackOverflow posts about it. The differences are so minimal that it doesn’t make a material difference. It’s just how the change is technically handled in memory. If you’re just learning Swift, I wouldn’t worry about it.

  • @apuylingga4687
    @apuylingga4687 Год назад

    Thank you so much..! may God always bestow good fortune on you and your family and always be under God's protection. Amminn

  • @robnash4841
    @robnash4841 Месяц назад

    Be careful passing mutating func around when you start using concurrency. Value types aren’t as safe as you might think

  • @evgenij_lutz
    @evgenij_lutz Год назад

    Thank you, Nick 🫶