How To Use JSON To Preload SwiftData ModelContainer 👀 | SwiftData Tutorial | #6

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

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

  • @mauricederegt
    @mauricederegt 9 месяцев назад +2

    Thank you for this tutorial, it was very handy. One question though, what to do if you want to UPDATE your data. Let's say you want to add another category when your app is already installed?

    • @tundsdev
      @tundsdev  9 месяцев назад +2

      Glad you enjoyed it 👌🏾 & you can just perform normal crud. I cover this in this video here.
      SwiftData For Beginners: How To Build A To-Do List App In SwiftUI | #1
      ruclips.net/video/kLNNNXD8X2U/видео.html

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

      @@tundsdev Cool thanks!

  • @jaimeacasta
    @jaimeacasta 2 месяца назад

    Amazing video! Greatly explains, however I've got a question...
    I tried this and the preload works, however, it preloads the data randomly. I want the data array in a certain order.
    I tried adding a "order" constant to the CategoryResponse and sort the array just before spending to context but this doesn't work.
    Did you figure out how to get the preloaded array sorted?

  • @IbrahimAkar
    @IbrahimAkar 10 месяцев назад +1

    This was extremely helpful - thank you. I have managed to get the container built and my JSON file imported OK. However, I have six JSON files to load and I was wondering if I have to create a function for each import or is there a way to import all six with one function call

    • @tundsdev
      @tundsdev  10 месяцев назад +1

      Glad to hear it helped, yep you’re going to need load each file separately 👌🏾

  • @simonransom_dxb
    @simonransom_dxb 7 месяцев назад

    Hello
    Is it possible to create a Button in our App to "repopulate" sample data that the User may have deleted? I know we can toggle the ShouldCreateDefaults but that would then require a restart for the user to get the Sample Data... can we do it without an App restart is the question?
    I am thinking I could put a button in my Setting view for the user to recreate Sample data, just in case.
    Thanks in advance, Simon

  • @Justin-BroskiMode
    @Justin-BroskiMode 9 месяцев назад

    Thanks this was useful and go arsenal! respect.

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

    Thanks bruhh for the content

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

      Glad you enjoy it 👌🏾

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

    Thank you for this!!!

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

      Glad you enjoyed it 🤝

  • @kichuntse4746
    @kichuntse4746 2 месяца назад

    What if i want to preload some images into the model? And the user can also further add images into the model

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

    Would this work if it was getting initial config from a network request that returned the JSON instead of loading it from local? Some sort of loading state would be needed I think

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

      Yep it would work, and I have a video course coming very soon that shows you how to do this also 👀

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

      @@tundsdev Amazing! Thanks so much for the great video and amazing comms as always ☺️

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

    Thanks so much for this video! I have been playing with SwiftData for a couple months with limited success. I was hoping someone could help with how to enable SwiftData's undoManager...
    If you are calling the container.create() function in your WindowGroup in the app.swift file, how can you set the isUndoManagerEnabled argument to true? I can't figure out where this would go. It's not a parameter in ModelConfiguration() or in ModelContainer(). It's only available with conformance to Scene, but if I call my custom Container within the App Scene, I cannot add isUndoEnabled without getting the error 'No exact matches in call to instance method 'modelContainer''

  • @DolHarubang-swift
    @DolHarubang-swift 8 месяцев назад

    Thanks very helpful video

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

    thanks for all these interesting videos, did you happen to see the new apple openapi generator presented at wwdc? It would be nice to see some evidence of use.

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

      Glad you found it useful 👌🏾 & nope I haven’t but I can check it out for sure 👀

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

    Do you have a video where you explain the same thing but for Core Data? please keep up the good work 👍

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

      Thanks & I don’t but I can create one 👌🏾

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

      @@tundsdev Thank you bro, I’m currently struggling to preload data into my app following your video, I setup the json file with its respective model, but got stuck knowing how to map it to CD.

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

    Will this work with nested models in JSON just as well?

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

      As long as you handle the mappings side of things, it should do yep

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

    Would I be possible to share the code snippet that would pre fill some default ToDo items please?

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

      I have a video for this pretty soon that shows you how to prefill data where there are relationships, that will cover having some default to dos 👌🏾

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

    sir can you plz help me
    I am a junior IOS Developer. My Company assigns a task. I am working on Mobile App which uses Realm to store data locally
    the task is daily at night 11 pm I have to send Local data from one table to Server through API
    I am trying silent push notification to accomplish this task but unfortunately, sometimes it delivers notification and some time, not its not a good solution
    can you plz tell me how I can achieve it??