How to use Core Data with @FetchRequest in SwiftUI | Continued Learning #14

  Переглядів 26,598

Swiftful Thinking

Swiftful Thinking

3 роки тому

In this video we jump into the world of Core Data! We will first create a new Xcode project, review some of the template Core Data code that Apple provide us, and then we will customize the code for our iOS application. In this video we will implement CRUD functions by learning how to Create, Read, Update, and Delete data within Core Data. As noted in the title, this video explores how to use the @FetchRequest, which enables us to easily connect Core Data to our SwiftUI View. In the next video, however, we will learn another implementation of Core Data using MVVM architecture - that no longer uses the @FetchRequest. Both implementations are useful and good to know!
Next video: • How to use Core Data w...
Last video: • Sort, Filter, and Map ...

КОМЕНТАРІ: 65
@arturolatorre371
@arturolatorre371 2 роки тому
By far the best SwiftUI channel out there! You deserve a lot more subscribers!
@rungxanh2901
@rungxanh2901 Рік тому
Thank you Nick for the preface at 0:55. It clears it up that I don't need to have both an @FetchRequest variable and Core Data view model at the same time. Very neat 🤝
@IvanObodianskyi
@IvanObodianskyi 10 місяців тому
Great explanation, thank you! It's already 2023 and your tutorial still top, good job Nick👍
@mmmaria18
@mmmaria18 2 роки тому
I really can't thank you enough, you are a savior!! Keep the awesome work!! :)
@douglasrutledge1325
@douglasrutledge1325 2 роки тому
I'm back watching Continued Learning. You have the best show on the internet! The best part is, every time I watch, it's like the first time! hahaha
@ZefsAl
@ZefsAl 2 роки тому
The best channel, there is nothing on the Internet about this topic!
@Stevesvideoshelf
@Stevesvideoshelf 2 роки тому
WooHoo!! Core Data! I've been looking forward to this one! Thanks Nick. Great video!
@SwiftfulThinking
@SwiftfulThinking 2 роки тому
You are cruising though these playlists 😂🥳🥲
@natgenesis5038
@natgenesis5038 Рік тому
You just make core data easy to me ;thanks so much man
@douglasrutledge1325
@douglasrutledge1325 2 роки тому
Thanks for your great training: My first goal is to make a 'Simple' journal app. Tag each entry with the current date:time. Save the entries automatically into CoreData. Recall entries in ScrollView based on Date. Then later automatically tag each entry with current weather:temperature; my current location during entry, then edit entries, allow for dictation, eg. as my knowledge increases.
@umarmohammad6841
@umarmohammad6841 3 роки тому
hands down the most useful swiftui videos on youtube
@SwiftfulThinking
@SwiftfulThinking 3 роки тому
Wow, thanks Umar! :)
@redstonerepeater2476
@redstonerepeater2476 8 місяців тому
I love the "new"(from the Beginner course) edits! Honestly man, you are a life saver!
@SwiftfulThinking
@SwiftfulThinking 8 місяців тому
Happy to help!
@nevemra5
@nevemra5 11 місяців тому
Very useful information, thanks!
@TechRagh
@TechRagh 3 роки тому
Thanks for your videos! Keep 'em coming👍🏻
@SwiftfulThinking
@SwiftfulThinking 3 роки тому
Thanks Tech Rag, will do! :)
@mig12394
@mig12394 3 роки тому
Thanks. It is the first time that I see somebody who mark core data in the project and use it, the others remake everything
@SwiftfulThinking
@SwiftfulThinking 3 роки тому
Yea, it's great that Apple gives us some template code but it can be hard to understand. I'm happy this helped!
@natgenesis5038
@natgenesis5038 Рік тому
Thanks so much bro I learn swift in project ,swiftui ,filesytem ,GCD ,core data from you ,…..
@andrejkling3886
@andrejkling3886 3 роки тому
Thank you for sharing your knowledge...
@SwiftfulThinking
@SwiftfulThinking 3 роки тому
Glad you're enjoying the videos :)
@bbulliard
@bbulliard 2 роки тому
Such an excellent video! Well done! Thank you
@SwiftfulThinking
@SwiftfulThinking 2 роки тому
Thanks again Bob!!
@simonbogh
@simonbogh 2 роки тому
Probably the best video tutorial/walkthrough I have watched, really nice to see even the standard core data code in the project really well explained, thank you. Question: Do you have a video or could you make an example of using multiple entities and also showcasing one-to-one, one-to-many etc. relations, how it works and how it can be used? /cheers
@simonbogh
@simonbogh 2 роки тому
Well, I kept watching your videos and it seems like one on core data relationships is coming 😂 thanks mate
@thisrabbit3673
@thisrabbit3673 2 роки тому
A huge thanks for this series, it helps a lot! While in my trying, I wonder what are the best practices for making core data works with the preview in SwiftUI, in other words, how to preview my customized view component with different (mocked) input data (for example, a blank state, and a state with some data) if this view directly pull data from the core data database using the @FetchRequest?
@yrac2409
@yrac2409 2 роки тому
Hello! love your tutorials, it's so easy to understand compared to many others I have watched. I've already started with firebase for the backend and I was wondering if you've ever thought of doing a tutorial on that? Thanks a lot!
@SwiftfulThinking
@SwiftfulThinking 2 роки тому
Hi Amy! Yes, I am planning on doing a Firebase course soon. I just haven't gotten to it yet!
@yrac2409
@yrac2409 2 роки тому
@@SwiftfulThinking Awesome! Love your videos!
@vamsi3877
@vamsi3877 3 роки тому
Thanks 👍
@SwiftfulThinking
@SwiftfulThinking 3 роки тому
No problem 👍 You are always watching my latest vids! Thanks!
@Srijonlucky0111
@Srijonlucky0111 2 роки тому
Awesome work! Could you please help me, if I have three Entities called Country, State, and Districts. I would like to filter Districts entity depending on selection of State. How it should be done?
@Nunny25
@Nunny25 3 роки тому
Thanks,.. I was so afraid to start with CoreData, because it looks so complicated for me. Believe I will understand it with You finally.
@SwiftfulThinking
@SwiftfulThinking 3 роки тому
Yes, it can definitely be challenging. Let me know if you have any questions Charlie :)
@Nunny25
@Nunny25 3 роки тому
@@SwiftfulThinking Hi, I have questions :-) If You have model data (array with inserted data), can You some simply way insert it to entity in one step (structure is the same), or You have to pass array in cycle and insert each item separately? How You can delete all items in entity? Thank You
@Nunny25
@Nunny25 3 роки тому
@@SwiftfulThinking And other very important thing is to get number of items in entity, ... is empty or not.?
@Jump_Jay
@Jump_Jay Рік тому
Question: I can NEVER pick color literal! Is the a setting you have to adjust in the menus to get that to work? As always, love the great content/education!
@angelrangel404
@angelrangel404 Рік тому
Hey men, I want to be like you when I're big!
@andresraigoza2082
@andresraigoza2082 2 роки тому
Thank you so much!!! 🙂 I wanted to ask you, how to decide when to use core data or remote data?
@SwiftfulThinking
@SwiftfulThinking 2 роки тому
This is a big question but I'll try to simplify... If there is data that (1) other users need access to, or (2) you want to be saved for the current user to use across multiple devices, then you need to store it in a remote location so that other devices can access it. If it's data only for the current user on the current device, then you can save it locally. There are several options for saving locally, most common is (1) UserDefaults for small pieces of data, (2) FileManager for large data blobs, such as Images/Videos/Audio, and then (3) CoreData when you have a larger data sets that you want to save, such as data Models in your app.
@andresraigoza2082
@andresraigoza2082 2 роки тому
@@SwiftfulThinking Thank you for your quick reply. Very clear answer. You’re great 👍🏻
@joywu1
@joywu1 Рік тому
Hi Nick, I found there is one miss function you didn't introduce in coreData: "move", I can add/ delete/update item, but when I want to do .onMove function, I found when I move the ForEach .onMove it will back to the original order in the entity. even I add saveData() after func move, it more badly afterI click Done it immediately back to the origin order. Can you help to have some advise, or core data cannot use .onMove function?
@bgriffin5447
@bgriffin5447 2 роки тому
Your cpu fan is 🐐
@SwiftfulThinking
@SwiftfulThinking 2 роки тому
It's not good 😭
@alkhafajihassan
@alkhafajihassan 5 місяців тому
Im having a lot of trouble following along, there's been an update and trying to do exactly as you do the view isn't updating with the newFruit to the list. I've searched and I can't seem to find what I am doing wrong
@ushadesai6306
@ushadesai6306 2 роки тому
Following Compiler error appear in the CoreData template app: 1. Generic parameter 'Content' could not be inferred' (in the ***App.swift) 2. Cannot find 'FruitEntity' in scope (in Persistence.swift and ContentView.swift) I have followed the same steps as in the tutorial.
@relaxingvibes5560
@relaxingvibes5560 Рік тому
Everything works when I use a List to render out the words...but what if I want to create card components? I tried and I only get the last word, not all the words from Core Data
@nicoballmann3400
@nicoballmann3400 3 роки тому
Hey there! Is there a possibility to put the tapGesture on the entire row?
@SwiftfulThinking
@SwiftfulThinking 3 роки тому
Hey Nico, yea you should be able to add a TapGesture to any View in Swift (you can't put it on the ForEach but you can put it on a view inside the ForEach closure).
@rasheed1andrew
@rasheed1andrew 2 роки тому
can you always add core data to an already existing project later on?
@pawelpow
@pawelpow 2 роки тому
Yes!
@aashutoshrimal
@aashutoshrimal Рік тому
I am getting the error "executeFetchRequest:error: A fetch request must have an entity.", although I had implemented the same as your code.
@manzoorahmaddeveloper8111
@manzoorahmaddeveloper8111 2 роки тому
@user-fg3bb1qn8x
@user-fg3bb1qn8x 10 місяців тому
他是真的想教会我,我哭死。 He really wants to teach me, I cry to death。 ty
@santiagocotanos1735
@santiagocotanos1735 2 роки тому
I dont know why at FecthedResults the editor says that item is not in the scope
@SwiftfulThinking
@SwiftfulThinking 2 роки тому
Did you figure it out? You might have to restart Xcode. It happens sometimes..
@user-yd9xy3rb4x
@user-yd9xy3rb4x 2 роки тому
Core Data is the most difficult topic I've ever happened to deal with.
@SwiftfulThinking
@SwiftfulThinking 2 роки тому
Yea it can be challenging haha. I hope this video helped.
@user-yd9xy3rb4x
@user-yd9xy3rb4x 2 роки тому
@@SwiftfulThinking yeah it helps a lot.
@lamsungfai
@lamsungfai 2 роки тому
Nick
@SwiftfulThinking
@SwiftfulThinking 2 роки тому
Hammer Lam
@paulmax9155
@paulmax9155 Рік тому
guard let index = offsets.first else { return } - (...index is not optional) This is extra code, completely useless((
How to use Core Data with MVVM Architecture in SwiftUI | Continued Learning #15
29:55
How to use Timer and onReceive in SwiftUI | Continued Learning #24
26:17
Swiftful Thinking
Переглядів 20 тис.
Bro smelt it & passed out 😂 #comedy
00:10
MrTalalaa
Переглядів 7 млн
Kitten has a slime in her diaper?! 🙀 #cat #kitten #cute
00:28
iOS Core Data QuickStart Tutorial 2020
1:10:58
CodeWithChris
Переглядів 97 тис.
Sort, Filter, and Map data arrays in Swift | Continued Learning #13
28:36
Swiftful Thinking
Переглядів 19 тис.
Big Tech AI Is A Lie
16:56
Tina Huang
Переглядів 53 тис.
Donny Wals: Using Core Data in a Modern SwiftUI Application
41:18
Swift Heroes
Переглядів 13 тис.
SwiftData! Updating a Simple ToDo List App (Ch. 5 BONUS)
21:21
John Gallaugher
Переглядів 3,3 тис.
SwiftData Basics in 15 minutes
15:18
CodeWithChris
Переглядів 33 тис.
SwiftUI - Intro to MVVM | Example Refactor | Model View ViewModel
11:55
Bro smelt it & passed out 😂 #comedy
00:10
MrTalalaa
Переглядів 7 млн