LDConfig

public struct LDConfig
extension LDConfig: Equatable

Use LDConfig to configure the LDClient. When initialized, a LDConfig contains the default values which can be changed as needed.

The client app can change the LDConfig by getting the config from LDClient, adjusting the values, and setting it back into the LDClient.

  • Constants relevant to setting up an LDConfig

    See more

    Declaration

    Swift

    public struct Constants
  • The minimum values allowed to be set into LDConfig.

    See more

    Declaration

    Swift

    public struct Minima
  • The Mobile key from your LaunchDarkly Account settings (on the left at the bottom). If you have multiple projects be sure to choose the correct Mobile key.

    Declaration

    Swift

    public var mobileKey: String
  • The url for making feature flag requests. Do not change unless instructed by LaunchDarkly.

    Declaration

    Swift

    public var baseUrl: URL
  • The url for making event reports. Do not change unless instructed by LaunchDarkly.

    Declaration

    Swift

    public var eventsUrl: URL
  • The url for connecting to the clientstream. Do not change unless instructed by LaunchDarkly.

    Declaration

    Swift

    public var streamUrl: URL
  • The maximum number of analytics events the LDClient can store. When the LDClient event store reaches the eventCapacity, the SDK discards events until it successfully reports them to LaunchDarkly. (Default: 100)

    Declaration

    Swift

    public var eventCapacity: Int
  • The timeout interval for flag requests and event reports. (Default: 10 seconds)

    Declaration

    Swift

    public var connectionTimeout: TimeInterval
  • The time interval between event reports (Default: 30 seconds)

    Declaration

    Swift

    public var eventFlushInterval: TimeInterval
  • The time interval between feature flag requests. Used only for polling mode. (Default: 5 minutes)

    Declaration

    Swift

    public var flagPollingInterval: TimeInterval
  • The time interval between feature flag requests while running in the background. Used only for polling mode. (Default: 60 minutes)

    Declaration

    Swift

    public var backgroundFlagPollingInterval: TimeInterval
  • Controls the method the SDK uses to keep feature flags updated. When set to .streaming, connects to clientstream which notifies the SDK of feature flag changes. When set to .polling, an efficient polling mechanism is used to periodically request feature flag values. Ignored for watchOS, which always uses .polling. See LDStreamingMode for more details. (Default: .streaming)

    Declaration

    Swift

    public var streamingMode: LDStreamingMode
  • Enables feature flag updates when your app is in the background. Allowed on macOS only. (Default: false)

    Declaration

    Swift

    public var enableBackgroundUpdates: Bool { get set }
  • Controls LDClient start behavior. When true, calling start causes LDClient to go online. When false, calling start causes LDClient to remain offline. If offline at start, set the client online to receive flag updates. (Default: true)

    Declaration

    Swift

    public var startOnline: Bool
  • Treat all user attributes as private for event reporting for all users.

    The SDK will not include private attribute values in analytics events, but private attribute names will be sent.

    When true, ignores values in either LDConfig.privateUserAttributes or LDUser.privateAttributes. (Default: false)

    See Also: privateUserAttributes and LDUser.privateAttributes

    Declaration

    Swift

    public var allUserAttributesPrivate: Bool
  • User attributes and top level custom dictionary keys to treat as private for event reporting for all users.

    The SDK will not include private attribute values in analytics events, but private attribute names will be sent.

    See LDUser.privatizableAttributes for the attribute names that can be declared private. To set private user attributes for a specific user, see LDUser.privateAttributes. (Default: nil)

    See Also: allUserAttributesPrivate, LDUser.privatizableAttributes, and LDUser.privateAttributes.

    Declaration

    Swift

    public var privateUserAttributes: [String]?
  • Directs the SDK to use REPORT for HTTP requests to connect to clientstream and make feature flag requests. When false the SDK uses GET for these requests. Do not use unless advised by LaunchDarkly. (Default: false)

    Declaration

    Swift

    public var useReport: Bool
  • Controls how the SDK reports the user in analytics event reports. When set to true, event reports will contain the user attributes, except attributes marked as private. When set to false, event reports will contain the user’s key only, reducing the size of event reports. (Default: false)

    Declaration

    Swift

    public var inlineUserInEvents: Bool
  • Enables logging for debugging. (Default: false)

    Declaration

    Swift

    public var isDebugMode: Bool
  • Enables requesting evaluation reasons for all flags. (Default: false)

    Declaration

    Swift

    public var evaluationReasons: Bool
  • An Integer that tells UserEnvironmentFlagCache the maximum number of users to locally cache. Can be set to -1 for unlimited cached users.

    Declaration

    Swift

    public var maxCachedUsers: Int
  • Set to true to opt out of sending diagnostic data. (Default: false)

    Unless the diagnosticOptOut field is set to true, the client will send some diagnostics data to the LaunchDarkly servers in order to assist in the development of future SDK improvements. These diagnostics consist of an initial payload containing some details of the SDK in use, the SDK’s configuration, and the platform the SDK is being run on; as well as payloads sent periodically with information on irregular occurrences such as dropped events.

    Declaration

    Swift

    public var diagnosticOptOut: Bool
  • The interval between sending periodic diagnostic data. (Default: 15 minutes)

    Declaration

    Swift

    public var diagnosticRecordingInterval: TimeInterval { get set }
  • For use by wrapper libraries to set an identifying name for the wrapper being used. This will be sent in the “X-LaunchDarkly-Wrapper” header on requests to the LaunchDarkly servers to allow recording metrics on the usage of wrapper libraries. (Default: nil)

    Declaration

    Swift

    public var wrapperName: String?
  • For use by wrapper libraries to report the version of the library in use. If the wrapperName has not been set this field will be ignored. Otherwise the version string will be included with the wrapperName in the “X-LaunchDarkly-Wrapper” header on requests to the LaunchDarkly servers. (Default: nil)

    Declaration

    Swift

    public var wrapperVersion: String?
  • Additional headers that should be added to all HTTP requests from SDK components to LaunchDarkly services

    Declaration

    Swift

    public var additionalHeaders: [String : String]
  • a closure to allow dynamic changes of headers on connect & reconnect

    Declaration

    Swift

    public var headerDelegate: RequestHeaderTransform?
  • LaunchDarkly defined minima for selected configurable items

    Declaration

    Swift

    public let minima: Minima
  • An NSObject wrapper for the Swift LDConfig struct. Intended for use in mixed apps when Swift code needs to pass a config into an Objective-C method.

    Declaration

    Swift

    public var objcLdConfig: ObjcLDConfig { get }
  • Sets a Dictionary of identifying names to unique mobile keys to access secondary environments in the LDConfig. Throws LDInvalidArgumentError if you try to add duplicate keys or put the primary key or name in secondaryMobileKeys.

    Declaration

    Swift

    public mutating func setSecondaryMobileKeys(_ newSecondaryMobileKeys: [String : String]) throws

    Parameters

    newSecondaryMobileKeys

    A Dictionary of String to String.

  • Returns a Dictionary of identifying names to unique mobile keys to access secondary environments.

    Declaration

    Swift

    public func getSecondaryMobileKeys() -> [String : String]

    Return Value

    A Dictionary of String to String.

  • LDConfig constructor. Configurable values are all set to their default values. The client app can modify these values as desired. Note that client app developers may prefer to get the LDConfig from LDClient.config in order to retain previously set values.

    Declaration

    Swift

    public init(mobileKey: String)
  • Compares the settable properties in 2 LDConfig structs

    Declaration

    Swift

    public static func == (lhs: LDConfig, rhs: LDConfig) -> Bool