This commit is contained in:
Gwendal Roué committed 2016-12-02 06:38:13 +01:00
1 parent cf25ced2e6
commit 1c9416fbed
2 files changed
+6 -6

No files matched your search

+5 -5
View File
@@ -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)
}
}
+1 -1
View File
@@ -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: