UserAttribute

public class UserAttribute : Equatable, Hashable

Represents a built-in or custom attribute name supported by LDUser.

This abstraction helps to distinguish attribute names from other String values.

For a more complete description of user attributes and how they can be referenced in feature flag rules, see the reference guides Setting user attributes and Targeting users.

  • Instances for built in attributes.

    See more

    Declaration

    Swift

    public struct BuiltIn
  • Returns a UserAttribute instance for the specified atttribute name.

    For built-in attributes, the same instances are always reused and isBuiltIn will be true. For custom attributes, a new instance is created and isBuiltIn will be false.

    Declaration

    Swift

    public static func forName(_ name: String) -> UserAttribute

    Parameters

    name

    the attribute name

    Return Value

    a UserAttribute

  • Whether the attribute is built-in rather than custom.

    Declaration

    Swift

    public var isBuiltIn: Bool { get }
  • Declaration

    Swift

    public static func == (lhs: UserAttribute, rhs: UserAttribute) -> Bool
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)