Created
September 21, 2016 08:13
-
-
Save tad-iizuka/ca8a4abdd948485c1ad4796eb48f602b to your computer and use it in GitHub Desktop.
Read Core Data with Swift3.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func loadCoreData() { | |
let fetchRequest: NSFetchRequest<Manager> = Manager.fetchRequest() | |
do { | |
self.item = try (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext.fetch(fetchRequest) | |
} catch { | |
print(String(format: "Error %@: %d",#file, #line)) | |
} | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.tableView.tableFooterView = UIView() | |
} | |
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
self.loadCoreData() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment