Skip to content

Instantly share code, notes, and snippets.

View Arrlindii's full-sized avatar

Arlind Aliu Arrlindii

View GitHub Profile
let color = SplitTestManager.getSplitValue(for: PurchaseButtonColorSplitTest.self)
purchaseButton.backgroundColor = color
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 {
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
discountStrategy.presentDiscountMessage()
}
func presentDiscoutViewController() {
let strategy = SplitTestManager.getSplitValue(for: DiscountSplitTest.self)
let viewController = DiscountViewController(discountStrategy: strategy)
self.present(viewController, animated: true)
}
init(discountStrategy: DisountStrategy) {
self.discountStrategy = discountStrategy
super.init(nibName: nil, bundle: nil)
}
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()
}
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()
}
@IBAction func presentNextVc(_ sender: UIButton) {
let style = SplitTestManager.getSplitValue(for: EBookPromotionSplitTest.self)
let vc = PromotionViewController(style: style)
self.present(vc, animated: true)
}
@IBAction func presentNextVc(_ sender: UIButton) {
let style = SplitTestManager.getSplitValue(for: EmailTwitterSplitTest.self)
let vc = ViewController5(style: style)
self.present(vc, animated: true)
}
init(style: PromotionViewControllerStyle) {
self.style = style
super.init(nibName: nil, bundle: nil)
}