Core Data with SwiftUI

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

КОМЕНТАРІ • 67

  • @rebeloper
    @rebeloper  3 роки тому +6

    Do you use Core Data in an existing SwiftUI project? Let me know in the comments below!

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

      Like everyone else, everything is explained within the ContentView, nobody knows how to explain it with different views.

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

    I finally decided to use core data and was looking for something recent. UA-cam says you posted this 21 hours ago. Fresh from the oven.

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

      Hope you learned a lot. If you liked this video you will love my latest live stream about SwiftUI and Firebase Push Notifications: ua-cam.com/video/r1d8AFz97og/v-deo.html

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

    This tutorial has unlocked core data capability for my apps. Really made it easy to apply with multiple entities and relationships. Fantastic!

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

      Glad it helped! BTW if you liked this tutorial you will love my newest one about in-app purchases made easy: ua-cam.com/video/M6Whj-LztLY/v-deo.html

  • @ronicard
    @ronicard 2 роки тому +1

    This is probably the most elegant solution I've come across. Well done, sir! You just picked up a new subscriber because you saved me from a lot of code I'd been repeating. Thank you.

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

      Welcome aboard! Also, learn how to sell your apps here: ua-cam.com/video/EyzIhGG0Y0Q/v-deo.html

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

    This fixed the issue i was encountering! You and Paul Hudson are heroes, thank you!!!

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

      Great to hear! BTW if you want to publish your website as a native app on the App Store watch this: ua-cam.com/video/6QwdbyonXUg/v-deo.html

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

    It should be the most difficult tutorial for me, but it works !!! I Had issues with the prédicate in the fetchrequest for item, i delete it, and then, the app runs, i have Many catégories to choose in the sheet, and i dont know why, but it works, fantastic, thanks a lot , 😊

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

      You are welcome! Next learn about @Observable @Bindable in iOS17 - SwiftUI Data Flow 👇
      ua-cam.com/video/Igblg7c2T1o/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

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

    Thanks Alex that was my first intro into using Core Data. Definitely a heavy subject, so its good to get the stubs into my App with your style.

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

      Very welcome! BTW if you want to write codes faster take a look at men newest video: ua-cam.com/video/en5H7nOGKBc/v-deo.html

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

    A very useful tutorial. Thank you. I have a question: how to use swift charts with core data?

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

      It's not that easy, I have to tell you that. Let me show it to you in a mentoring session. Please book your call here: rebeloper.com/mentoring
      Also here are the Best Coding Habits to Adopt in 2023 👇
      ua-cam.com/video/8O6M7oo5rhk/v-deo.html

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

    amigo! thx for the tutorial! I was searching in order to add it to my proyect , saludos desde mexico!

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

      Glad I could help! BTW if you liked this video taken look my latest video: ua-cam.com/video/UOX2EN9kGas/v-deo.html

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

    This guide is VERY, VERY good. I learned A LOT from it. One thing to take in mind though, next time you should show the preview canvas while filming because it is very hard to understand what you are doing without having a visual look at in while in the middle of the work. Nonetheless, as I already sayed, this one is gold.

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

      Thanks for the suggestion. I'll keep it in mind. BTW if you did like this video you will love the one about the new SwiftUI 3: ua-cam.com/video/c5tLMdTYQYg/v-deo.html

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

      Agreed.

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

    Good stuff man, keep it up. I was having my problem after not using CoreData in years and this was a great a refresher, I was messing up the part where I load the container 🤦🏻‍♂️

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

      Great to hear! BTW if you liked this video I really think you should check out how to query data in Firestore: ua-cam.com/video/vEt_m4KDwNM/v-deo.html

  • @deltaKilo-M
    @deltaKilo-M 2 роки тому

    Who had UnsafeRawBufferPointer compiling error? What is the reason? I did review of code for several times, changed xCode version, but still negative result. Tnx!

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

    Thank you so much for this video!
    Edit: Your video solved my problem.... I really appreciate you sooooooo x999 much!!

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

      You're welcome! BTW if you liked this video I really think you should check out how to query data in Firestore: ua-cam.com/video/vEt_m4KDwNM/v-deo.html

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

    Hi Alex
    can you create some example searchable using multiple objects like start date and end date for fetch filtering? Thanks You

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

      That's a bit complex for a UA-cam video. I can show it to you in a mentoring session. Book your call here: rebeloper.com/mentoring
      Here are 10 Things iOS Developers Have STOPPED Doing - Are you doing them? 👉 ua-cam.com/video/tJ7_BjhoZtI/v-deo.html

  • @jersey-dude
    @jersey-dude 3 роки тому +1

    Thank you very much!

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

      You're welcome! If you liked this video you will love my latest live stream about SwiftUI and Firebase Push Notifications: ua-cam.com/video/r1d8AFz97og/v-deo.html

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

    I am getting an error Type 'Category' (aka 'OpaquePointer') does not conform to protocol 'NSFetchRequestResult' in " ) var categories: FetchedResults" but not for Items does anyone know why

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

      Have you set up an Entity called "Category"? Also, Quit and re-open Xcode. BTW take a look at my latest video: Making MONEY just got EASIER on the App Store (and you didn't even know it!) 👉 ua-cam.com/video/7AVX4r8iV-k/v-deo.html

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

    Which fits better with swiftUI, Core Data or Realm? Thanks.

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

      I prefer CoreData :) BTW check out the top 10 apps I use on my Mac: ua-cam.com/video/TqljK2Uyf2U/v-deo.html

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

    Hi, thanks for this tutorial.
    I have occurred an issue that the except for the last item added to the category, other items will have the category displayed as Unknown, does anyone know how this happened?
    Thanks in advance.

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

      Hmm... did you get to solve this? BTW if you liked this video check out my lates one where I create a Custom Camera from scratch in SwiftUI and AVFoundation: ua-cam.com/video/ZmPJBiwgZoQ/v-deo.html

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

    I watched many videos but you make CoreData easy like nobody. can you just add how can I filter data with a TextField

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

      Yes, I can show it to you in a mentoring session: rebeloper.com/mentoring
      If you enjoyed this video make sure to check out my newest tutorial about iOS15 availability: ua-cam.com/video/u1SMCxmYMvE/v-deo.html

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

    Thank you so much, this is very helpful!! I followed along, but when trying to build, it gives me the following error message:
    cannot assign value of type ‘FetchedResults.Element’ (aka ‘Item’) to type ‘Category’
    Do you have any idea on how to fix that or what I might have done wrong?

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

      Ahhhh I think I found my mistake!

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

      You are trying to fetch an Item but your request is of type Category. Make sure you have one or the other only. BTW if you liked this video I really think you should check out how to query data in Firestore: ua-cam.com/video/vEt_m4KDwNM/v-deo.html

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

    How do you add categories and items (dynamically with TextFields) since you cannot bind anything to a FetchRequest predicate???

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

      Categories and items should be separate Entities and you should add relationships to them. I can explain it to you on a mentoring session: rebeloper.com/mentoring
      BTW if you liked this video you will love my newest tutorial about async/await in SwiftUI: ua-cam.com/video/ZC2ljzBv8uA/v-deo.html

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

    Nice video, but in my project when I want to link item.toCategory = category I get the error Cannot assign value of type 'FetchedResults.Element' (aka 'Item') to type 'Category?'

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

      My bad typical found my error categorys: FetchedResults not items: FetchedResults :D

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

      Glad you found it. BTW check out the top 10 apps I use on my Mac: ua-cam.com/video/TqljK2Uyf2U/v-deo.html

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

    Thank you. Can I copy or export xvdatamodeld one App to another App?

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

      I think you can copy and paste but if possible I would build it from scratch, to be on the safe side.
      BTW check out a video about THE MISSING view from SwiftUI: ua-cam.com/video/cUnxa87qNoQ/v-deo.html

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

    Hi, When creating an app as a freelancer how long are you responsible for supporting it on designated devices? Is it stated in the agreement between client and developer?

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

      Yes, it has to be added into the contract. I usually support my apps 6 months. But of course not for free.

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

    Can you send the Xcode project.

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

      You can download all the resources from here: store.rebeloper.com/youtube-channel-resources
      BTW if you did like this video I think you will enjoy "How to Publish an App to the App Store": ua-cam.com/video/ykiD5wqwSe4/v-deo.html

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

      @@rebeloper Thank you

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

    I am using third-party database store framework

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

      That's also fine. In that case most probably you don't need CoreData. BTW if you liked this video you will love my video on why not to use Alamofire and what to use instead. Check it out here: ua-cam.com/video/RM5uKTBr20c/v-deo.html

  • @jersey-dude
    @jersey-dude 3 роки тому

    Is migrating your core database by adding a new version through Xcode with a mapping model considered safe for existing users?

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

      Yes, but you have to be really careful about what entities you add/ delete/change. If you liked this video you will love my latest live stream about SwiftUI and Firebase Push Notifications: ua-cam.com/video/r1d8AFz97og/v-deo.html

  • @jersey-dude
    @jersey-dude 3 роки тому

    If an app is released with a core data stack and the developer wants to make a minor change to the DB structure (like adding a new index), without affecting previous users, can that be done by just updating the app and not changing the hash identifier?

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

      Adding a new index is considered safe.

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

    Hi, where could I download this SwiftUI Core Data project? Thanks

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

      In the description you can find a link to all the resources for my UA-cam Channel. BTW check out the top 10 apps I use on my Mac: ua-cam.com/video/TqljK2Uyf2U/v-deo.html

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

    I love your tutorials but your onscreen text covers the screen and makes it very difficult to follow.

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

      Thanks for the feedback. Will make sure I don't do it in next ones. BTW do you know how to THINK like a programmer? Find out how here: ua-cam.com/video/uAUbE6am2Ok/v-deo.html

  • @alexvaiman4966
    @alexvaiman4966 6 місяців тому

    I would not use this setup, when user kills the app, no guaranty what so ever, save/delete will be done, I know swift-data, works same way, but this is apple in house implantation, and they sure will guaranty db will be updated, before app killed. + if any bug happens, data will not be saved, I would not use this approach. you have big db? you need performance? forget about swift/core data all together.

    • @rebeloper
      @rebeloper  6 місяців тому

      Thanks for your input. Appreciate a different point of view.
      Next check out my latest video about Mastering SwiftUI Error Alerts: Fix Your App in Seconds! 👇
      ua-cam.com/video/glg1koMSyLA/v-deo.html&ab_channel=Rebeloper-RebelDeveloper

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

    transformable?

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

      That's also a part of CoreData, it's just a bit more advanced than this video. BTW if you liked this video you will love my newest tutorial about async/await in SwiftUI: ua-cam.com/video/ZC2ljzBv8uA/v-deo.html