Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit ValueObservation cancellation #745

Merged
merged 4 commits into from
Mar 29, 2020

Conversation

groue
Copy link
Owner

@groue groue commented Mar 29, 2020

ValueObservation used to be stopped when the result of the start method would get deinitialized.

Now you can also call the cancel() method explicitly:

// BEFORE: GRDB 4
let observer: TransactionObserver?
observer = observation.start(...)
observer = nil       // Stop the observation

// NEW: GRDB 5
let cancellable: DatabaseCancellable
cancellable = observation.start(...)
cancellable.cancel() // Stop the observation

The returned DatabaseCancellable cancels itself when it gets deinitialized.

@groue groue added this to the GRDB 5 milestone Mar 29, 2020
@groue groue mentioned this pull request Mar 29, 2020
42 tasks
@groue groue merged commit 73aada9 into GRDB5 Mar 29, 2020
@groue groue deleted the dev/ValueObservation-cancellation branch March 29, 2020 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant