Experiment

final public class Experiment<T> where T : Equatable

Experiment class manages blocks for experimental logics, and performs publishing of your experiment results.

  • Undocumented

    Declaration

    Swift

    public typealias ExperimentBlock = () -> T
  • Undocumented

    Declaration

    Swift

    public typealias ComparatorBlock = (_ control: T, _ candidate: T) -> Bool
  • Type of block which define the conditions to ignore comparing observations.

    Declaration

    Swift

    public typealias IgnoreObservationsBlock = (_ control: Observation<T>, _ candidate: Observation<T>) -> Bool
  • Undocumented

    Declaration

    Swift

    public var enabled: () -> Bool
  • Undocumented

    Declaration

    Swift

    public var context: [String : Any]
  • Undocumented

    Declaration

    Swift

    public var publish: ((Result<T>) -> Void)?
  • Undocumented

    Declaration

    Swift

    public private(set) var name: String { get }
  • Undocumented

    Declaration

    Swift

    public func use(control: @escaping ExperimentBlock)
  • Undocumented

    Declaration

    Swift

    public func tryNew(name: String? = nil, candidate: @escaping ExperimentBlock)
  • Undocumented

    Declaration

    Swift

    public func ignores(_ condition: @escaping IgnoreObservationsBlock)
  • Undocumented

    Declaration

    Swift

    public func compare(_ compare: @escaping ComparatorBlock)
  • Undocumented

    Declaration

    Swift

    public func run(name: String? = nil) throws -> T