mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-24 04:07:47 +00:00
Documentation
This commit is contained in:
1 parent
49838c67ee
commit
b283c80776
1 file changed
+4
-4
@@ -4253,9 +4253,9 @@ See also [TableChangeObserver.swift](https://gist.github.com/groue/2e21172719e63
|
||||
|
||||
#### Filtering Database Events
|
||||
|
||||
**Transaction observers can avoid being notified of some database changes they are not interested in.**
|
||||
**Transaction observers can avoid being notified of database changes they are not interested in.**
|
||||
|
||||
The filtering happens in the `observes(eventsOfKind:)` method, which tells whether the observer is interested in specific kinds of changes, or not. For example, here is how an observer can focus on the changes that happen on the "persons" database table:
|
||||
The filtering happens in the `observes(eventsOfKind:)` method, which tells whether the observer wants notification of specific kinds of changes, or not. For example, here is how an observer can focus on the changes that happen on the "persons" database table:
|
||||
|
||||
```swift
|
||||
class PersonObserver: TransactionObserver {
|
||||
@@ -4265,8 +4265,8 @@ class PersonObserver: TransactionObserver {
|
||||
}
|
||||
|
||||
func databaseDidChange(with event: DatabaseEvent) {
|
||||
// When this method is called, the observer is guaranteed
|
||||
// that the "persons" table has been modified.
|
||||
// This method is only called for changes that happen to
|
||||
// the "persons" table.
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user