Skip to content

Instantly share code, notes, and snippets.

@kreeger
Last active January 8, 2019 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kreeger/a9f2e3c5ddebf0a30632b728ba5ae2aa to your computer and use it in GitHub Desktop.
Save kreeger/a9f2e3c5ddebf0a30632b728ba5ae2aa to your computer and use it in GitHub Desktop.
Stack preparation code for the blog post "Flapjack" on O'Reilly's engineering blog.
import Flapjack
// Create the DataAccess object, your main point-of-entry for persistence.
// You can also pass in `.sql(filename: "YourCoreDataStore.sql")`.
let dataAccess = CoreDataAccess(name: "YourCoreDataStore", type: .memory)
// Then tell the stack to configure itself.
dataAccess.prepareStack(asynchronously: true) { error in
if let error = error {
print(error.localizedDescription)
}
// Make sure you retain your `dataAccess` variable, and now you're all
// ready to go!
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment