← Back to Documentation Home

STRUCT

Decision

public struct Decision: Equatable

Represents a decision made for a user regarding which experiment variation to show

Properties

experiment

public let experiment: Experiment

variation

public let variation: Variation

madeAt

public let madeAt: Date

experimentKey

public var experimentKey: String

The experiment key (slug)

variationKey

public var variationKey: String

The variation key (slug)

variationVariables

public var variationVariables: [Variable]

All variables for this variation

Methods

init(experiment:variation:)

public init(experiment: Experiment, variation: Variation)

getVariationVariable(_:)

public func getVariationVariable(_ slug: String) -> String?

Get a specific variation variable by its slug - Parameter slug: The slug of the variable to retrieve - Returns: The variable value as a string, or nil if not found

Parameters

Name Description
slug The slug of the variable to retrieve

getVariationVariable(_:defaultValue:)

public func getVariationVariable(_ slug: String, defaultValue: String) -> String

Get a specific variation variable by its slug with a default value - Parameters: - slug: The slug of the variable to retrieve - defaultValue: The default value to return if the variable is not found - Returns: The variable value or the default value

Parameters

Name Description
slug The slug of the variable to retrieve
defaultValue The default value to return if the variable is not found

getVariationVariableAsInt(_:)

public func getVariationVariableAsInt(_ slug: String) -> Int?

Get a variation variable as an integer - Parameter slug: The slug of the variable to retrieve - Returns: The variable value as an integer, or nil if not found or not convertible

Parameters

Name Description
slug The slug of the variable to retrieve

getVariationVariableAsDouble(_:)

public func getVariationVariableAsDouble(_ slug: String) -> Double?

Get a variation variable as a double - Parameter slug: The slug of the variable to retrieve - Returns: The variable value as a double, or nil if not found or not convertible

Parameters

Name Description
slug The slug of the variable to retrieve

getVariationVariableAsBool(_:)

public func getVariationVariableAsBool(_ slug: String) -> Bool?

Get a variation variable as a boolean - Parameter slug: The slug of the variable to retrieve - Returns: The variable value as a boolean, or nil if not found or not convertible

Parameters

Name Description
slug The slug of the variable to retrieve