ObjcLDUser
@objc(LDUser)
public final class ObjcLDUser : NSObject
LDUser allows clients to collect information about users in order to refine the feature flag values sent to the SDK.
The usage of LDUser is no longer recommended and is retained only to ease the adoption of the LDContext
class. New
code using this SDK should make use of the LDContextBuilder
to construct an equivalent Kind.user
kind context.
-
LDUser name attribute used to make
name
privateDeclaration
Swift
@objc public class var attributeName: String { get }
-
LDUser firstName attribute used to make
firstName
privateDeclaration
Swift
@objc public class var attributeFirstName: String { get }
-
LDUser lastName attribute used to make
lastName
privateDeclaration
Swift
@objc public class var attributeLastName: String { get }
-
LDUser country attribute used to make
country
privateDeclaration
Swift
@objc public class var attributeCountry: String { get }
-
LDUser ipAddress attribute used to make
ipAddress
privateDeclaration
Swift
@objc public class var attributeIPAddress: String { get }
-
LDUser email attribute used to make
email
privateDeclaration
Swift
@objc public class var attributeEmail: String { get }
-
LDUser avatar attribute used to make
avatar
privateDeclaration
Swift
@objc public class var attributeAvatar: String { get }
-
Client app defined string that uniquely identifies the user. If the client app does not define a key, the SDK will assign an identifier associated with the anonymous user. The key cannot be made private.
Declaration
Swift
@objc public var key: String { get }
-
Client app defined name for the user. (Default: nil)
Declaration
Swift
@objc public var name: String? { get set }
-
Client app defined first name for the user. (Default: nil)
Declaration
Swift
@objc public var firstName: String? { get set }
-
Client app defined last name for the user. (Default: nil)
Declaration
Swift
@objc public var lastName: String? { get set }
-
Client app defined country for the user. (Default: nil)
Declaration
Swift
@objc public var country: String? { get set }
-
Client app defined ipAddress for the user. (Default: nil)
Declaration
Swift
@objc public var ipAddress: String? { get set }
-
Client app defined email address for the user. (Default: nil)
Declaration
Swift
@objc public var email: String? { get set }
-
Client app defined avatar for the user. (Default: nil)
Declaration
Swift
@objc public var avatar: String? { get set }
-
Client app defined dictionary for the user. The client app may declare top level dictionary items as private. See
privateAttributes
for details.Declaration
Swift
@objc public var custom: [String : ObjcLDValue] { get set }
-
Client app defined isAnonymous for the user. If the client app does not define isAnonymous, the SDK will use the
key
to set this attribute. isAnonymous cannot be made private. (Default: YES)Declaration
Swift
@objc public var isAnonymous: Bool { get set }
-
Client app defined privateAttributes for the user.
The SDK will not include private attribute values in analytics events, but private attribute names will be sent.
This attribute is ignored if
ObjcLDConfig.allUserAttributesPrivate
is YES. Combined withObjcLDConfig.privateUserAttributes
. The SDK considers attributes appearing in either list as private. Client apps may define most built-in attributes and all top levelcustom
dictionary keys here. (Default:[]
])See Also:
ObjcLDConfig.allUserAttributesPrivate
andObjcLDConfig.privateUserAttributes
.Declaration
Swift
@objc public var privateAttributes: [String] { get set }
-
Initializer to create a LDUser. Client configurable attributes are set to their default value. The SDK will automatically set
key
,device
,operatingSystem
, andisAnonymous
attributes. The SDK embedsdevice
andoperatingSystem
into thecustom
dictionary for transmission to LaunchDarkly.Declaration
Swift
override public init()
-
Initializer to create a LDUser with a specific key. Other client configurable attributes are set to their default value. The SDK will automatically set
key
,device
,operatingSystem
, andisAnonymous
attributes. The SDK embedsdevice
andoperatingSystem
into thecustom
dictionary for transmission to LaunchDarkly.Declaration
Swift
@objc public init(key: String)
Parameters
key
String that uniquely identifies the user. If the client app does not define a key, the SDK will assign an identifier associated with the anonymous user.
-
Compares users by comparing their user keys only, to allow the client app to collect user information over time
Declaration
Swift
@objc public func isEqual(object: Any) -> Bool
-
Convert a legacy LDUser to the newer LDContext
Declaration
Swift
@objc public func toContext() -> ContextBuilderResult