Flag Change Observers

  • An object can own an observer for as long as the object exists. Swift structs and enums cannot be observer owners.

    Declaration

    Swift

    public typealias LDObserverOwner
  • Collects the elements of a feature flag that changed as a result of a clientstream update or feature flag request. The SDK will pass a LDChangedFlag or a collection of LDChangedFlags into feature flag observer closures. The client app will have to convert the old/newValue into the expected type. See LDClient.observe(key:owner:handler:), LDClient.observe(keys:owner:handler:), and LDClient.observeAll(owner:handler:) for more details.

    See more

    Declaration

    Swift

    public struct LDChangedFlag
  • A closure used to notify an observer owner of a change to a single feature flag’s value.

    Declaration

    Swift

    public typealias LDFlagChangeHandler = (LDChangedFlag) -> Void
  • A closure used to notify an observer owner of a change to the feature flags in a collection of LDChangedFlag.

    Declaration

    Swift

    public typealias LDFlagCollectionChangeHandler = ([LDFlagKey : LDChangedFlag]) -> Void
  • A closure used to notify an observer owner that a feature flag request resulted in no changes to any feature flag.

    Declaration

    Swift

    public typealias LDFlagsUnchangedHandler = () -> Void