mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Cleanup
This commit is contained in:
1 parent
cf25ced2e6
commit
1c9416fbed
2 files changed
+6
-6
No files matched your search
@@ -272,7 +272,7 @@ public final class FetchedRecordsController<Record: RowConvertible> {
|
||||
|
||||
let initialItems = fetchedItems
|
||||
databaseWriter.write { db in
|
||||
let fetchAndNotifyChanges = makeFetchAndNotifyChangesFunction(controller: self, fetchAlongside: fetchAlongside, itemsAreIdentical: itemsAreIdentical!, recordsWillChange: recordsWillChange, tableViewEvent: tableViewEvent, recordsDidChange: recordsDidChange)
|
||||
let fetchAndNotifyChanges = makeFetchAndNotifyChangesFunction(controller: self, fetchAlongside: fetchAlongside, itemsAreIdentical: itemsAreIdentical, recordsWillChange: recordsWillChange, tableViewEvent: tableViewEvent, recordsDidChange: recordsDidChange)
|
||||
let observer = FetchedRecordsObserver(selectionInfo: request.selectionInfo, fetchAndNotifyChanges: fetchAndNotifyChanges)
|
||||
self.observer = observer
|
||||
if let initialItems = initialItems {
|
||||
@@ -349,7 +349,7 @@ public final class FetchedRecordsController<Record: RowConvertible> {
|
||||
|
||||
#if os(iOS)
|
||||
// The record comparator
|
||||
fileprivate var itemsAreIdentical: ItemComparator<Record>?
|
||||
fileprivate var itemsAreIdentical: ItemComparator<Record>
|
||||
#endif
|
||||
|
||||
// The request
|
||||
@@ -921,9 +921,9 @@ fileprivate func identicalItemArrays<Record>(_ lhs: [Item<Record>], _ rhs: [Item
|
||||
/// if record could not be found.
|
||||
public func indexPath(for record: Record) -> IndexPath? {
|
||||
let item = Item<Record>(row: Row(record.persistentDictionary))
|
||||
guard let fetchedItems = fetchedItems,
|
||||
let itemsAreIdentical = itemsAreIdentical,
|
||||
let index = fetchedItems.index(where: { itemsAreIdentical($0, item) }) else { return nil }
|
||||
guard let fetchedItems = fetchedItems, let index = fetchedItems.index(where: { itemsAreIdentical($0, item) }) else {
|
||||
return nil
|
||||
}
|
||||
return IndexPath(row: index, section: 0)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4233,7 +4233,7 @@ The [notification callbacks](#the-changes-notifications) are notified of eventua
|
||||
**Change callbacks are invoked asynchronously.** This means that modifying the request from the main thread does *not* immediately triggers callbacks. When you need to take immediate action, force the controller to refresh immediately with its `performFetch` method. In this case, changes callbacks are *not* called:
|
||||
|
||||
```swift
|
||||
// Change database on the main thread:
|
||||
// Change request on the main thread:
|
||||
controller.setRequest(Person.order(Column("name")))
|
||||
// Here callbacks have not been called yet.
|
||||
// You can cancel them, and refresh records immediately:
|
||||
|
||||
Reference in new issue
Block a user