Integrating Core Data with SwiftUI

preview_player
Показать описание
In this video, Mohammad Azam will explain how to integrate Core Data with SwiftUI application.

If you want to support my work then please consider buying one of my courses below. The links below already has coupon attached which will give you the best deal possible. Thank you for your support!

SwiftUI - Declarative Interfaces for any Apple Device

Mastering RxSwift in iOS

MVVM Design Pattern Using Swift in iOS

Mastering ARKit for iOS

Intermediate and Advanced iOS - Build Real World Apps

The Complete Guide to JSON Parsing in Swift

Data Structures and Algorithms in Swift

Design Patterns in iOS Using Swift

Mastering MapKit for iOS

Machine Learning in iOS Using Swift

Mastering Firebase for iOS Using Swift

Mastering Server Side Swift Using Vapor 3

NodeJS - The Complete Developer Bootcamp

The Complete Guide to Lean Controllers in iOS
Рекомендации по теме
Комментарии
Автор

This is toooo much work!! Apple should really try to make this at least 10 times easier & more straightforward...

DrN
Автор

This is by far the best tutorial on this. Keep it up!

marlonerler
Автор

Thank you Mohammad Azam. Your videos and Udemy course have been very instrumental in my learning SwiftUI.

ronaldbowser
Автор

Thanks for your tutorial, it's great. But Xcode beta 5 brings new features:
- NSManagedObject now conforms to ObservableObject.
- managedObjectContext is now included in the environment.
You no longer need to create an extra class to have observable core data.

VictorKushnerov
Автор

OH MY LORD, Thank you Thank you. I hope that you will create a complete course on Udemy. There is presently a person who has a course on CoreData, but I am sure that you can do a better. Thank you again for creating these course. And by the way, I started today with your SwiftUI course and I am not disappointed.

hcri
Автор

You don't need a CoreDataManager anymore, you can subclass NSPersistentContainer and use the viewContext in your get orders method. However for that you should be using a NSFetchedResultsController and not a fetch because you won't receive changes the order list. Also rather than use singletons it would be better to use dependency injection, SwiftUI must support that somehow.

indiekiduk
Автор

very thank you for the tutorial !
Sorry but can you explain why you use .map(OrderViewModel.init) in OrderListViewModel.swift ?

MattiaInc
Автор

Is there a way to avoid force unwrapping the OrderViewModel,
init(order: Order) self.name = order.name!

antonstandwerth
Автор

Great tutorial ! I also like that you use ViewModels, instead of turning of code generation for the CoreData models and then mix SwiftUI stuff into the Entity.... those shouln't intermingle like that. Bought your course on Udemy as well hope its good :-)

The only thing is, that you use that CoreDataManager. But I think it would be better to have an OrderService protocol with the getAllOrders function and then an CoreDataOrderService, cos A) once you have many entities, I think that thing gets messy, so having Services for each entity seems resonable to me. And B) by having an universal service-protocol one could reattach the UI to another Backend.

I think you want to keep it simple. So no hard feeling :D

kastor
Автор

where did those orders of John come from? there wasn't anything saved..

nickng