How to use Core Data with MVVM Architecture in SwiftUI | Continued Learning #15

preview_player
Показать описание
In the last video in this series, we learned how to implement Core Data into SwiftUI applications using @FetchRequest. Although that method is more "SwiftUI", it's not always practical to use in production applications. In this video we will learn an alternative approach and connect Core Data to our app using a ViewModel in MVVM (Model-View-ViewModel architecture). As you'll see, the main benefit to this method is that we can separate our code so that the code relating to updating Core Data is totally separate from the code relating to the View (the UI).

If you've watched both videos... which method do you prefer?
Leave a comment below :)

🤙 WELCOME BACK 🤙

Рекомендации по теме
Комментарии
Автор

"I'm just doing this again for ppl who are just joining". Proof that heroes don't always wear capes, folks.

felipemarques
Автор

I litterly spend hours researching this and you saved me in 1/2h. Thank you so much

michaelmarx
Автор

Hi Nick! I'm looking for a few adventures in the mobile world as a senior full-stack web developer and thanks to your courses I've been learning a lot! Already built my first simple app and I'm planning to tackle a second one soon. Thanks to your patience, awesome teaching skills, and great content, I feel like I have all I need to go into these waters, as I don't always understand Apple's documentations. Thank you very much for putting such an effort to this, enabling myself and many other people like me.

moisesscn
Автор

This is the third time I've been watching this series, and every time I finished the course, I always learn new things! Thank you, Nick!🥳🥳

tomqin
Автор

when you create entity in core data model be sure after that to press cmd + s to save cuz Xcode mostly do not save file extension xcdatamodeld automatically

a.h.m
Автор

Though I learned to use CoreData somewhere else, your coding style is much more realistic that I can always learn something. That is why I keep watching your tutorials even on topics that I am familiar with. I am so thankful for your teachings of good qualities. Thank you!!

kjlee
Автор

I come from a deep background in data warehouses, relational databases, and REST API testing with backend databases. I have worked with both SQL and no-SQL databases. In data warehouse development and testing, the ETL concept is key. The developer typically should create a software design specification with a source-to-target matrix such that any data transformations are addressed. The transformations or the "T" in "ETL" for extract, transform and load can get somewhat complicated. I have seen software defects rooted in transformation errors. So, the MVVM model is ideal in separating the architecture into components such that the ViewModel deals with transformations. So, the MVVM video is great. I appreciate Nick's attention to details in his presentation on how MVVM works. Now, the only area that gets little coverage in my opinion for multiple Core Data tutorials from either Nick or other influencers is the concept of many-to-many tables. In relational SQL, the SQLite database with many-to-many tables should have an ER implementation such that the many-to-many relation uses a hybrid intermediate table with primary keys from both tables. This allows the queries and inner joins that could be done. I was able to implement that easily using MySQL and SQLite with PyQt. I haven't seen any Core Data video that goes from the ER relation of a many-to-many relation with two tables and primary keys and discusses how that "intermediate table" with primary keys from both tables is addressed in Core Data. The Microolap Database Designer web page has this definition "The only way to create many-to-many (N:M) reference between two tables in MySQL is using an intermediate table, which records set association between primary keys of first table and primary keys of second table." I haven't seen a Core Data tutorial that addresses that in its many-to-many tables by going from the ER software design to the code implementation. Usually, the influencers just write code without ever addressing the written design of an ER model. Such development patterns are ripe for errors in my experience with testing data warehouses. I worked with Informatica developers and was trained by a guy with about 45 years of experience in ETL database development.

manuelsteele
Автор

Glad I found your video - I was really struggling with Core Data in the MVVM pattern - I haven't found anywhere else that explains it so well - Thank you!

philslinkee
Автор

This changed everything for me - first time user of coredata

TheCodingRaconteur
Автор

I know you probably won’t see this, but thank you so much seriously. I didn’t know where I could learn SwiftUI and where to start but you help out so much . You deserve so much more subs

tas_araf
Автор

You always have a video for something I need to learn!
Thank you so much for these videos! You teach really well. :) <3

thaisfernandes
Автор

This is the video I was looking for! Thank you very much 🙂

HilaProdomo
Автор

Excellent video. I prefer this method rather than the last video.

MarvelousLXVII
Автор

Excellent and clear. It was very easy to understand how you fit together View, View models and model.

phrax
Автор

So 'on update' how would we load the name of the fruit in the list which has been tapped - into the textFieldText so it can be edited and resaved? Please

gabrielrml
Автор

Hello! Thank you so much for the cool material! That's what I was looking for my project! You are the best!

MrJacklightning
Автор

Absolutely essential stuff ignored by some paid subscription programs. Thank you.

danfeinstein
Автор

Thanks Nick! Simple and straightforward solution to the question of replacing @FetchRequest with ViewModel @ Published. It is unclear why Apple itself did not solve this issue, leaving the developers with a good, but primitive @FetchRequest

runpress.runningcompetitio
Автор

Hi Nick, thanks. It was clear for me. What I missed was possibility to sort data as you explained in the previous video.

Nunny
Автор

Definitely your explaination is very good. Easy to understand. Thanks!

Yani-jvpt
join shbcf.ru