This module encapsulates the local persistence layer, and provides an implementation of that persistence layer based on CoreData.
The Storage module exposes its functionality via the StorageManagerType protocol.
This protocol declares getters to StorageType and methods to save or perform an operation on a StorageType
The default implementation of the StorageManagerType and StorageType protocols is based on CoreData.
StorageManagerType is implemented by the CoreDataManager class. As the name implies, this class manages a CoreData stack, aggregating a NSPersistentContainer.
When clients of this class request a StorageType, CoreDataManager will return an NSManagedObjectContext.
When CoreDataManager is requested a viewContext, it will provide the persistent container’s viewContext . When it is requested a newDerivedStorage it will return a new child context with a private dispatch queue.
The Storage module also exposes a protocol, called FileStorage to abstract saving and reading data to and from local storage.
The default implementation of this protocol, PListFileStorage provides support for .plist files.
File storage is used mostly for local app settings.
This module also provides extensions to make the model objects declared in the Networking module coredata-compliant.
That is achieved by extending the model objects declared in Networking to make them extend NSManagedObject and provide @NSManaged properties and CoreData compliant accessors to some of those properties. Those extensions can be generated directly inside Xcode.
