CoreDataSafe is a Swift Implementation of the Marcus Zarra design principles for using CoreData. This covers the a basic starting point for using CoreData, which is not much, but 1) is way better than the Apple provided template, and 2) probably will work as is for most iOS App needs.
This posting is a teaser for a github project which I posted months back. That project contains a few different things, but the key class is CoreDataSafe.
This is a simple CoreData stack (<200 lines of code) that enables effective and (almost) foolproof code to implement CoreData with both foreground and background operations. The rest of the project is just a demonstration of using it. The example demo consists of 2 parts:
Unit Testing Code
The project also contains some extensive Unit Tests that also hammer the CoreDataSafe implementation from a test environment. As a bonus, it shows some examples of async testing.
There are also 2 hidden bonus features:
- See the layout changes under rotation of iPhones. Views are repositioned to make best use of space.
- See info dialog as Popovers on iPhone same as iPad.