Skip to content

Instantly share code, notes, and snippets.

@beelsebob
Forked from jhoughjr/migrate.swift
Last active May 13, 2016 05:43
Show Gist options
  • Save beelsebob/39c93233d059242421c258ad51eea8c9 to your computer and use it in GitHub Desktop.
Save beelsebob/39c93233d059242421c258ad51eea8c9 to your computer and use it in GitHub Desktop.
func migrate(noteManager : NoteManager) {
if let coreDataNotes = GNNote.MR_findAll() {
for case let note as GNNote in coreDataNotes {
if let bundleID = note.appBundleID, docPath = note.documentPath, content = note.content where !content.string.isEmpty {
noteManager.createNote(bundleID, docID: docPath, content: content)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment