diff --git a/README.md b/README.md index cc2a58b2..4b6c479a 100644 --- a/README.md +++ b/README.md @@ -71,15 +71,25 @@ To avoid waiting on backend calls when the Application starts, the suggested app `confidence.activate()` and then trigger a background refresh via `confidence.asyncFetch()` for future sessions. ### Setting the context -The context is a key-value map used for sampling and for targeting, when flag are evaluated by the Confidence backend. +The context is a key-value map used for sampling and for targeting, when flags are evaluated by the Confidence backend. It is also appended to the tracked events, making it a great way to create dimensions for metrics in Confidence. ```swift confidence.putContext(context: ["key": ConfidenceValue(string: "value")]) ``` -Note that a `ConfidenceValue` is accepted a map values, which has a constructor for all the value types -supported by Confidence. +Another way to configure the context involves using the `track` API: +```swift +confidence.track(producer: contextProducerImplementation) +``` + +The "producer" conforms to `ConfidenceContextProducer`, which allows to dynamically push context changes +to the Confidence object. + +In both cases above, any context change triggers a new asynchronous `fetchAndActivate` and the flags in the +local cache are re-evaluated remotely according to the new context: until this background operation is complete, +flag values are returned to the application according to the old context's evaluation, and with `resolveReason = .stale`. + ### Resolving feature flags Once the Confidence instance is **activated**, you can access the flag values using the