How To Preload Relationships Into SwiftData ModelContainer ⚡️ | SwiftData Tutorial | #9

Поділитися
Вставка
  • Опубліковано 4 січ 2025

КОМЕНТАРІ •

  • @TarotPolitics
    @TarotPolitics 11 місяців тому +1

    Tunds your self-deprecating manner hides your GENIUS!!! I am following the entire class, I bought Paul Hudson's book on SwiftData and lemme tell ya, YOU got it. You explain it and expand it so much better. It's good to have his book as reference, however... your example is so much better!!! Plus you got STYLE. You are also an excellent designer and creative person. God Bless you, you have helped me so much!

    • @tundsdev
      @tundsdev  11 місяців тому

      Wow, thank you!

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

    I love your content … always instructive (and timely in this case :) )

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

    amazing, thank you Tund ! gonna play around with this

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

    Thanks Man. Amazing.

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

    Hey i have watched your videos and they are amazing, i would like to make a question to you not related to the swift it self, but i would like to know how did you build your UA-cam channel icon (the blue one). Did you hire someone?
    Thanks for sharing your knowledge with us

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

    hey Tunds I think I'm getting caught up on the itemContainer. Everything else is making sense and seems to be running fine but I think my container isn't reading the JSON correctly. Even when doing the dump I'm not seeing anything in the console. Besides running it on the simulator do I need to do anything else to see it in the console?

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

    Does this work if you want to have multiple items in the same category? It seems like it's going to create a new category for every instance you include in the JSON

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

      👋🏾 The category name is marked as unique so only one instance of that category would ever exist

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

      @@tundsdev Hi, in my project, the equivalent to your "category" class can't have its name marked as unique. Then should I add a "var id: UUID" to my model and mark it as unique to achieve the same result ? I would then encode this UUID and use it the same way you use the category name in your video. Is this the way or is there an easier/better way ?
      I wish I could use the modelPersistentId so as to not have 2 unique ids in my model, but it's (understandably) a get-only property so I can't decode it.

  • @Alan-uc4pf
    @Alan-uc4pf Рік тому

    Category.defaults not available, this is library or custom?

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

      This is custom logic, it's just an array of default categories. But I don't use it in this video

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

    items?forEach
    Would u explain that syntax?
    I'm new.
    items is optional, right?

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

      Yep items is optional. The function returns an optional value. But the foreach is a high order function that loops through all items.
      So if there are no items there is nothing to loop through. But if there are then it will loop through all the items
      Hope this helps

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

      @@tundsdev hey thanks a lot. Another question that’s simple. Where is the best place for a noob to get on a swift Forum and leave questions and get answers right away - as opposed to something like stack overflow where it seems like you have to build up a reputation and get “status “before you get respected for your questions.
      Thanks.
      My first question would be, why do I have a view, that when I put a form in there it works perfectly. When I remove the form, when I click a button, the action code of the other button gets fired. It’s the weirdest thing from my point of view. I don’t understand. Is there something special about a form that would cause button that you didn’t click to be executed?
      I put a break Point on button 2s code. I clicked button one. And it stops on the code of button two, after executing, the code on button one. What in the world is going on?
      Update:
      I found this.
      Don’t tell me this is the answer. This is a three-year-old problem and THIS is the answer??
      stackoverflow.com/questions/57947581/why-buttons-dont-work-when-embedded-in-a-swiftui-form