IOS TOPICS

IOS Introduction
Swift UI Label
Swift UI Button
Swift UI Text Field
Swift UI Slider
Swift UI Switch
Swift UI Stepper
Swift UI Date Picker
Swift UI Segmented Control
Views
Table View
Collection Views
SCROLL VIEW
iOS Content View
iOS View Controllers
iOS Bar interface
iOS Navigation interface
iOS Architect Pattern
iOS Libraries
iOS Web request and parsing
iOS user defaults
iOS Coredata and database

Core Data


What is core data ?

Core data is a framework used in macOS to manage the model layer objects in your application. Core data provides a generalized and automated structure with object life cycle and object graph management. Core data reduces upto 50 to 70 percent of code you write to support the model layer. Core data stores the data in different formats,

  1. Binary format 
  2. In memory store
  3. SQLLite format

Core data stack

A core data stack is a collection of framework objects. A core data stack is a mediator between an object and an external data store. Stacks consist of 3 primary objects.

  1. Manage object model : Managed object model is an instance of NSManageObjectModel class that loads the data and exposes it to core data.
  2. Manage object context : This is the instance of NSManageObjectModel class that your application interacts most.
  3. Persistent store coordinator : Persistent store coordinator is the heart of the core data stack. It is used to release the instance of an entity.

Advantages of Core data

  1. Core data is faster than SQLite as it is heavily optimized regarding cache, memory management, and many more things.
  2. One of the most significant benefits of core data is the lazy loading of data and faulting to save memory.
  3. Core data maintains forward and backward links whenever objects are added or removed from a relationship.  

Limitations of core data

  1. If you want to delete thousands of data, you have to load every data one by one, which might cause performance issues.
  2. Core data has no limitations; it sometimes gets imposed with disk space or situational memory.