This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let color = SplitTestManager.getSplitValue(for: PurchaseButtonColorSplitTest.self) | |
| purchaseButton.backgroundColor = color |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PurchaseButtonColorSplitTest: SplitTestProtocol { | |
| typealias ValueType = UIColor | |
| static var identifier: String = "purchase_button_color" | |
| var value: ValueType | |
| required init(group: String) { | |
| if group == "a" { | |
| self.value = UIColor.red | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func viewDidAppear(_ animated: Bool) { | |
| super.viewDidAppear(true) | |
| discountStrategy.presentDiscountMessage() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func presentDiscoutViewController() { | |
| let strategy = SplitTestManager.getSplitValue(for: DiscountSplitTest.self) | |
| let viewController = DiscountViewController(discountStrategy: strategy) | |
| self.present(viewController, animated: true) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| init(discountStrategy: DisountStrategy) { | |
| self.discountStrategy = discountStrategy | |
| super.init(nibName: nil, bundle: nil) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DiscountSplitTest: SplitTestProtocol { | |
| typealias ValueType = DisountStrategy | |
| static var identifier: String = "iap_discount_type" | |
| var value: DisountStrategy | |
| required init(group: String) { | |
| if group == "offer" { | |
| value = DefaultDiscountStrategy() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func addContentView() { | |
| let nib = UINib(nibName: style.contentView, bundle: nil) | |
| let view = nib.instantiate(withOwner: nil, options: nil)[0] as! UIView | |
| contentView.addSubview(view) | |
| view.bindFrameToSuperviewBounds() | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @IBAction func presentNextVc(_ sender: UIButton) { | |
| let style = SplitTestManager.getSplitValue(for: EBookPromotionSplitTest.self) | |
| let vc = PromotionViewController(style: style) | |
| self.present(vc, animated: true) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @IBAction func presentNextVc(_ sender: UIButton) { | |
| let style = SplitTestManager.getSplitValue(for: EmailTwitterSplitTest.self) | |
| let vc = ViewController5(style: style) | |
| self.present(vc, animated: true) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| init(style: PromotionViewControllerStyle) { | |
| self.style = style | |
| super.init(nibName: nil, bundle: nil) | |
| } |