Skip to content

developer-academy-unina/Tutorial-CoreData-with-MVVM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tutorial

CoreData with MVVM Pattern


Report a Bug · Ask a Question

coverage

Table of Contents


About

CoreData is a great framework to generate persistence and caching mechanisms, but what if we decide to integrate it with the MVVM Pattern to guarantee legibility, scalability and re-usage? Here is a little tutorial to follow along.

You should have gone through "Tutorial-CoreData" to have some preliminary knowledge about CoreData and be able to go through this activity.

By the end of the tutorial you should be acquainted to combining the MVVM Pattern and CoreData in SwiftUI.


Getting Started

Installation

  1. Clone the repo

    git clone https://github.com/developer-academy-unina/Tutorial-CoreData-with-MVVM
  2. Open the .xcodeproj file

How to

Using both MVVM Pattern and Persistence is crucial for setting a very powerful structure for your app. In this tutorial you will move your first steps to master these powerful concepts.

  • Here you will understand how to separate responsibilities, using a PersistenceManager to deal with the actual local storage and a ViewModel to exempt the View from directly manipulating data.
  • Saving the ManagedObjectContext in the ViewModel by using the @escaping closures to deal with the completion of a function.
  • How to CRUD Data: Create, read, update and delete CoreData’s entities.

Issues and Discussions

You've found a bug in the source code, a mistake in the documentation or maybe you'd like a new feature? Take a look at GitHub Discussions to see if it's already being discussed. You can help us by submitting an issue on GitHub. Before you create an issue, make sure to search the issue archive -- your issue may have already been addressed!

Please try to create bug reports that are:

  • Reproducible. Include steps to reproduce the problem.
  • Specific. Include as much detail as possible: which version, what environment, etc.
  • Unique. Do not duplicate existing opened issues.
  • Scoped to a Single Bug. One bug per report.

Support

Reach out to the maintainer at one of the following places:


Authors & contributors

The original setup of this repository is by Luca Palmese.

For a full list of all authors and contributors, see the contributors page.


License

This project is licensed under the MIT License.

See LICENSE for more information.