Home

Awesome

Modern Core Data Playground: Core Data in Swift / Xcode... inside a Playground!

An introduction to Core Data you can test, use, change & code, all in just one Playground!

A screen capture showing one playground page

The model used in this example

Core Data wants to be the model of your App, Markus Zarra once dixit.

So in this Playground we have a simple model:

|-----------------|               |----------------|
|    Project      |               |     Task       |
|-----------------| 1           n |----------------|
| name: String    |---------------|title: String   |
| priority: Int   |               |desc: String    |
| startDate: Date |               |                |
|-----------------|               |----------------|

What you'll find here

Requirements

Installation

Clone the repo and open the playground directly in Xcode.

$ git clone https://github.com/ && cd CoreDataPlayground
$ open core-data-playground.playground

Helper Project

I've used a helper project, just a simple Core Data template App to create the Core Data Model file and to let Xcode generate the Swift source code files for each Entity in that Model.

Getting the mom file

Acknowledgements

I was wondering if I could run a complete Core Data example inside a Playground. Searching around to see if anyone has tried that before I found Andrew Shepard's repo on Core Data. This inspired me to create my own, but with a twist: I didn't wanted to create the Managed Object Model in code.

License

The MIT License (MIT)

Copyright (c) 2017 Diego Freniche

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.