ShuntingYardResolver

public class ShuntingYardResolver

A strongly typed and performant class capable of resolving complex string logic and returning a comparison as a single Bool value.

  • Parses a string in the format “(a == b || c == d) && (x == y) || (foo == bar && day >= night)” where || represents OR conditions and && represents an AND condition.

    Complexity

    O(n) where n is the the number of conditions in the group

    Declaration

    Swift

    public func evaluate(expression: String?) -> Bool

    Parameters

    expression

    The entire string that represents ALL the conditions to be resolved.

    Return Value

    A boolean value representing whether ALL conditions have been met or not.

  • Value calculated by generating a UUID and hasing it followed by a mutation into a percentage value. This value is stored in UserDefaults and will persist between sessions.

    Declaration

    Swift

    public func cohortPercentage(override key: String = "abTestingPercentageValue") -> Float
  • Declaration

    Swift

    public func valueFor(condition: Condition) -> String?