diff --git a/docs/README.md b/docs/README.md index ffd3eb1518af..b8761317da0a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -24,6 +24,20 @@ local IP. npm run start -- --host 0.0.0.0 ``` +### Checking your changes with prettier + +After you make changes to the documentation, you can check the changes by running the following command: + +```console +npx prettier --check docs +``` + +If you want to apply any fixes discovered, you can run the following command: + +```console +npx prettier --write +``` + ## Build ```console diff --git a/docs/docs/clients/client-side/ios.md b/docs/docs/clients/client-side/ios.md index fb5efc016e0e..40728d06fd01 100644 --- a/docs/docs/clients/client-side/ios.md +++ b/docs/docs/clients/client-side/ios.md @@ -47,7 +47,7 @@ import FlagsmithClient ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { -Flagsmith.shared.apiKey = "" +Flagsmith.shared.apiKey = "" // The rest of your launch method code } ``` @@ -286,6 +286,32 @@ If more customisation is required, you can override the cache implemention with Flagsmith.shared.cacheConfig.cache = ``` +### Real Time Updates + +By default real-time updates are disabled. When enabled the SDK will listen for changes to flags and update the cache as +needed. If you want to enable real-time updates you can do so by setting the following flag: + +```swift +Flagsmith.shared.enableRealTimeUpdates = false +``` + +It's possible to listen to updates in real time from the SDK using the `flagStream` property. + +```swift +func subscribeToFlagUpdates() { + Task { + for await updatedFlags in flagsmith.flagStream { + DispatchQueue.main.async { + flags = updatedFlags + } + } + } +} +``` + +You can find an example of this functionality in the Flagsmith iOS Example app, which should work on your own data if +you replace your Environment Key in the `AppDelegate.swift` file. + ## Override default configuration By default, the client uses a default configuration. You can override the configuration as follows: @@ -295,8 +321,9 @@ Override just the default API URI with your own: ```swift func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { -Flagsmith.shared.apiKey = "" -Flagsmith.shared.baseURL = "https:///api/v1/" -// The rest of your launch method code + Flagsmith.shared.apiKey = "" + Flagsmith.shared.baseURL = "https:///api/v1/" + Flagsmith.eventSourceBaseURL = "https:///api/v1/" + // The rest of your launch method code } ```