Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The swifter way of A/B testing implementation

gaopin
March 08, 2018

The swifter way of A/B testing implementation

Try! Swift after talks

gaopin

March 08, 2018
Tweet

More Decks by gaopin

Other Decks in Technology

Transcript

  1. ABTesterProtocol associatedtype ABTestPatternType: ABTestPatternProtocol associatedtype ABTestKey: ABTestKeyProtocol func getCurrentPatternKey() ->

    ABTestKey A/B test logic functions extension ABTesterProtocol { private func getTargetPattern() -> ABTestPatternType? { return getCurrentPatternKey().pattern as? Self.ABTestPatternType } }
  2. class CertainABTestPatternDefault: ABTestPatternProtocol { func getLabel() -> String { return

    "Live long and prosper." } } class CertainABTestPatternB: CertainABTestPatternDefault { override func getLabel() -> String { return "May the force be with us.” } }
  3. struct CertainABTester: ABTesterProtocol { func getCurrentPatternKey() -> SomeABTestKey { return

    .a } typealias ABTestPatternType = SomeABTestPatternDefault typealias ABTestKey = SomeABTestKey func getLable() -> String { return getCurrentPatternKey().pattern.getLabel() } }