Stores SaveState model objects with Core Data, and displays the available save states in SaveStatesViewController. Currently, tapping + button creates a new save state, while tapping a collection view cell loads the save state, regardless of whether Save State or Load State was selected from the pause menu.
27 lines
485 B
Swift
27 lines
485 B
Swift
//
|
|
// NSManagedObjectContext+Conveniences.swift
|
|
// Delta
|
|
//
|
|
// Created by Riley Testut on 2/8/16.
|
|
// Copyright © 2016 Riley Testut. All rights reserved.
|
|
//
|
|
|
|
import CoreData
|
|
|
|
extension NSManagedObjectContext
|
|
{
|
|
// MARK: - Saving -
|
|
|
|
func saveWithErrorLogging()
|
|
{
|
|
do
|
|
{
|
|
try self.save()
|
|
}
|
|
catch let error as NSError
|
|
{
|
|
print("Error saving NSManagedObjectContext: ", error, error.userInfo)
|
|
}
|
|
}
|
|
}
|