mrlegowatch / GarageStorageSwift

A Swift implementation of GarageStorage. Provides a convenient way to store any kind of data in a repository backed by Core Data.
MIT License
8 stars 1 forks source link

Support polymorphic type reinstantiation (allow base return types) #40

Open mrlegowatch opened 2 months ago

mrlegowatch commented 2 months ago

Currently, Garage Storage saves the Swift object type similar to how the Objective-C implementation did for the class name. It does not, however, use that type for reinstantiation, instead relying on the caller's return value template type. This limits reinstantiation to explicit or derived types, rather than allowing base types for return values.

There is an inherent limitation in the retrieveAll by type function, in that that the type requested must match the stored derived type. This limitation is not necessary, however, when using retrieve by id, or when retrieving an object that contains an array of embedded objects.