MixpanelFlagVariant

public struct MixpanelFlagVariant : Decodable

Undocumented

  • key

    Undocumented

    Declaration

    Swift

    public let key: String
  • Undocumented

    Declaration

    Swift

    public let value: Any?
  • Undocumented

    Declaration

    Swift

    public let experimentID: String?
  • Undocumented

    Declaration

    Swift

    public let isExperimentActive: Bool?
  • Undocumented

    Declaration

    Swift

    public let isQATester: Bool?
  • Where this variant was sourced from. Always non-nil — every MixpanelFlagVariant carries a definite source. .fallback for developer-supplied fallback instances; .network or .persistence(persistedAt:) when the SDK serves a variant. For persisted variants, the timestamp lives on the .persistence case so invalid combinations like “network with a timestamp” are unrepresentable.

    Declaration

    Swift

    public let source: Source
  • Identifies where a served variant came from.

    See more

    Declaration

    Swift

    public enum Source
  • Why the SDK returned the developer fallback.

    Network/cache SDKs (like the iOS/macOS Mixpanel SDK) cannot distinguish “flag does not exist” from “user is not in any rollout” without server-side cooperation — both surface as .flagNotFound for now. Future server changes can add a more specific reason without breaking callers that already switch on this enum.

    See more

    Declaration

    Swift

    public enum FallbackReason : Equatable, Hashable, Sendable
  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Undocumented

    Declaration

    Swift

    public init(
        key: String = "", value: Any? = nil, isExperimentActive: Bool? = nil, isQATester: Bool? = nil,
        experimentID: String? = nil
    )
  • Initializer that stamps a served (or fallback) variant with its origin. Used both internally (by withSource when re-tagging a decoded variant) and by tests/callers constructing variants with explicit source metadata.

    Declaration

    Swift

    public init(
        key: String,
        value: Any?,
        experimentID: String? = nil,
        isExperimentActive: Bool? = nil,
        isQATester: Bool? = nil,
        source: Source
    )
  • Returns a copy of this variant stamped with the given source. Other fields are preserved.

    Public so callers (and tests) can re-tag variants with explicit source metadata — the SDK uses this internally to stamp the reason a developer-supplied fallback was returned.

    Declaration

    Swift

    public func withSource(_ source: Source) -> MixpanelFlagVariant