minor fixes on Playgrounds and Demo app

This commit is contained in:
John Estropia
2019-01-09 11:59:06 +09:00
parent 237a1b648e
commit 8c30ec3a3d
3 changed files with 10 additions and 16 deletions

View File

@@ -16,11 +16,6 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
// MARK: NSObject
deinit {
CoreStore.logger = DefaultLogger()
}
let dataStack = DataStack()
// MARK: UIViewController
@@ -30,13 +25,14 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
super.viewDidLoad()
try! self.dataStack.addStorageAndWait(SQLiteStore(fileName: "emptyStore.sqlite"))
CoreStore.logger = self
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
CoreStore.logger = self
let alert = UIAlertController(
title: "Logger Demo",
message: "This demo shows how to plug-in any logging framework to CoreStore.\n\nThe view controller implements CoreStoreLogger and appends all logs to the text view.",
@@ -46,6 +42,13 @@ class CustomLoggerViewController: UIViewController, CoreStoreLogger {
self.present(alert, animated: true, completion: nil)
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
CoreStore.logger = DefaultLogger()
}
// MARK: CoreStoreLogger

View File

@@ -14,7 +14,6 @@ class Person: CoreStoreObject {
}
/// =======================
/// Stack setup ===========
let dataStack = DataStack(
CoreStoreSchema(
@@ -28,7 +27,6 @@ let dataStack = DataStack(
try dataStack.addStorageAndWait(SQLiteStore(fileName: "data.sqlite"))
/// =======================
/// Transactions ==========
dataStack.perform(synchronous: { transaction in
@@ -42,7 +40,6 @@ dataStack.perform(synchronous: { transaction in
})
/// =======================
/// Accessing Objects =====
let bird = dataStack.fetchOne(From<Animal>().where(\.species == "Sparrow"))!
bird.species.value

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Timeline
version = "3.0">
<TimelineItems>
</TimelineItems>
</Timeline>