Other Protocols
The following protocols are available globally.
-
Protocol indicting a type can be converted into an LDValue.
Types used with the
LDClient.variation(forKey: defaultValue:)
orLDClient.variationDetail(forKey: detailValue:)
methods are required to implement this protocol. This protocol has already been implemented for Bool, Int, Double, String, and LDValue types.This allows custom types as evaluation result types while retaining the LDValue type throughout the event processing system.
See moreDeclaration
Swift
public protocol LDValueConvertible
-
Protocol for extending SDK functionality via hooks.
See moreDeclaration
Swift
public protocol Hook
-
Protocol for extending SDK functionality via plugins.
Plugins provide a way to extend the functionality of the LaunchDarkly SDK. A plugin can register hooks that are called during flag evaluation, and can perform initialization when registered with a client instance.
Plugin implementations should be thread-safe as they may be called concurrently from multiple threads.
Usage Example
See moreclass MyPlugin: Plugin { func getMetadata() -> PluginMetadata { return PluginMetadata(name: "MyPlugin") } func register(client: LDClient, metadata: EnvironmentMetadata) { // Perform plugin initialization } func getHooks(metadata: EnvironmentMetadata) -> [Hook] { return [MyHook()] } } let config = LDConfig.Builder(mobileKey: "your-mobile-key") .plugins([MyPlugin()]) .build()
Declaration
Swift
public protocol Plugin