@objc(LDContext) public final class ObjcLDContext : NSObject
LDContext is a collection of attributes that can be referenced in flag evaluations and analytics events.
To create an LDContext of a single kind, such as a user, you may use
To create an LDContext with multiple kinds, use
FullyQualifiedKey returns a string that describes the entire Context based on Kind and Key values.
This value is used whenever LaunchDarkly needs a string identifier based on all of the Kind and Key values in the context; the SDK may use this for caching previously seen contexts, for instance.
@objc public func fullyQualifiedKey() -> String
@objc public func isMulti() -> Bool
true if the
LDContextis a multi-context; false otherwise.
/ - Returns: A hash mapping a context’s kind to its key.
@objc public func contextKeys() -> [String : String]
Looks up the value of any attribute of the
LDContext, or a value contained within an attribute, based on a
Reference. This includes only attributes that are addressable in evaluations.
This implements the same behavior that the SDK uses to resolve attribute references during a flag evaluation. In a context, the
Referencecan represent a simple attribute name– either a built-in one like “name” or “key”, or a custom attribute that was set by
LDContextBuilder.trySetValue(...)– or, it can be a slash-delimited path using a JSON-Pointer-like syntax. See
Referencefor more details.
For a multi-context, the only supported attribute name is “kind”.
If the value is found, the return value is the attribute value, using the type
LDValueto represent a value of any JSON type.
If there is no such attribute, or if the
Referenceis invalid, the return value is nil.
@objc public func getValue(reference: ObjcLDReference) -> ObjcLDValue?