Last active
July 2, 2020 08:08
-
-
Save stevencurtis/f2fbbd015aa83511499d5bf9fa77d608 to your computer and use it in GitHub Desktop.
mviviewcontroller
This file contains 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 ViewController: UIViewController { | |
@IBOutlet weak var personLabel: UILabel! | |
@IBOutlet weak var displayPerson: UIButton! | |
private var intent:VCIntent? | |
private let disposeBag = DisposeBag() | |
public func update(with person: Event<State>) { | |
if let element = person.element { | |
personLabel.text = (element.person[element.currentIndex].name) | |
} | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
intent = VCIntent() | |
intent?.bind(to: self) | |
bindButton() | |
} | |
func bindButton() { | |
displayPerson.rx.tap.bind { | |
self.intent?.onNext() | |
}.disposed(by: disposeBag) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment