From bfa5fbe8ce41ef16f03537b5e044b2df8aa29762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 20 Mar 2019 16:50:03 +0100 Subject: [PATCH] Documentation tweaks --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5867f9bd2..9c55e5fc8 100644 --- a/README.md +++ b/README.md @@ -6070,7 +6070,7 @@ class PlayerViewController: UIViewController { observer = try! observation.start( in: dbQueue, onChange: { [unowned self] (player: Player?) in - // Player has changed: update view + // Player has been refreshed: update view self.nameLabel.text = player?.name }) } @@ -6086,13 +6086,13 @@ class PlayerViewController: UIViewController { By default, all values are notified on the main queue. Views can be updated right from the `onChange` callback. -An initial fetch is performed as soon as the observation starts: the view is set up and ready when the `viewWillAppear` method returns. +By default, an initial fetch is performed as soon as the observation starts: the view is set up and ready when the `viewWillAppear` method returns. The observer returned by the `start` method is stored in a property of the view controller. This allows the view controller to control the duration of the observation. When the observer is deallocated, the observation stops. Meanwhile, all transactions that modify the observed player are notified, and the `nameLabel` is kept up-to-date. > :bulb: **Tip**: see the [Demo Application](DemoApps/GRDBDemoiOS/README.md) for a sample app that uses ValueObservation. > -> :bulb: **Tip**: When fetching initial values is slow, and should not block the main queue, opt in for async notifications: +> :bulb: **Tip**: When fetching values is slow, and should never ever block the main queue, opt in for async notifications: > > ```swift > override func viewWillAppear(_ animated: Bool) { @@ -6109,7 +6109,7 @@ The observer returned by the `start` method is stored in a property of the view > observer = try! observation.start( > in: dbQueue, > onChange: { [unowned self] (player: Player?) in -> // Player has changed: update view +> // Player has been refreshed: update view > self.activityIndicator.stopAnimating() > self.nameLabel.text = player?.name > })