Skip to content

Commit

Permalink
#18: Renamed the AppDelegate.persistentContainer to medi8Container to…
Browse files Browse the repository at this point in the history
… distinguish it from the new Discogs container that I'm about to create.
  • Loading branch information
jrtibbetts committed Apr 22, 2019
1 parent fa0c907 commit 6bf3805
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions SwiftDiscogsApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// MARK: - Core Data

var medi8Context: NSManagedObjectContext {
return persistentContainer.viewContext
return medi8Container.viewContext
}

lazy var persistentContainer: NSPersistentContainer = {
lazy var medi8Container: NSPersistentContainer = {
/*
The persistent container for the application. This implementation
creates and returns a container, having loaded the store for the
Expand All @@ -102,12 +102,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})

return container
}()

// MARK: - Core Data Saving support
func saveContext () {
let context = persistentContainer.viewContext
func saveMedi8Context () {
let context = medi8Container.viewContext
if context.hasChanges {
do {
try context.save()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class ThirdPartyServicesViewController: UITableViewController{
service.stopImportingData()
} else {
if let appDelegate = UIApplication.shared.delegate as? AppDelegate {
let context = appDelegate.persistentContainer.viewContext
let context = appDelegate.medi8Container.viewContext
service.importData(intoContext: context)
}
}
Expand Down

0 comments on commit 6bf3805

Please sign in to comment.