Skip to content

Commit ec46dc5

Browse files
committed
Adjust Mac example to 1.3.0
1 parent f4f5522 commit ec46dc5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Example/NotesExample-macOS/AppDelegate.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3737
logger.append("\(try noteBox.all().readableDescription)\n")
3838

3939
logger.append("Reading notes containing 'writing':")
40-
let allWritingNotes = try noteBox.query { Note.text.contains("writing") }.build().all()
40+
let allWritingNotes = try noteBox.query {
41+
Note.text.contains("writing")
42+
}.build().find()
4143
logger.append("\(allWritingNotes.readableDescription)\n")
4244

4345
logger.append("Reading notes containing 'writing' by Peter Brett:")
44-
let peterBrettsWritingNotes = try noteBox.query { Note.text.contains("writing") && Note.author.isEqual(to: peterBrett.id) }.build().all()
46+
let peterBrettsWritingNotes = try noteBox.query {
47+
Note.text.contains("writing") && Note.author.isEqual(to: peterBrett.id)
48+
}.build().find()
4549
logger.append("\(peterBrettsWritingNotes.readableDescription)\n")
4650

4751
logger.append("Looking into Peter Brett's current object state again ...")
@@ -53,7 +57,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5357
}
5458

5559
let viewController = NSApp.mainWindow?.contentViewController
56-
logger.display(viewController: viewController!)
60+
if viewController != nil {
61+
logger.display(viewController: viewController!)
62+
} else {
63+
logger.append("No ViewController!?") // fix this
64+
}
5765
print(logger.string)
5866
}
5967

0 commit comments

Comments
 (0)