Last active
November 26, 2018 13:52
-
-
Save Sajjon/6e8446e7e3827cab54940efaf8ecc765 to your computer and use it in GitHub Desktop.
Medium article: SLC part 1 - View
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
| import UIKit | |
| import RxSwift | |
| import RxCocoa | |
| final class AuthenticateView: UIView { | |
| private lazy var signUpButton = UIButton(type: .custom) | |
| private lazy var signInButton = UIButton(type: .custom) | |
| private lazy var stackView = UIStackView(arrangedSubviews: [signUpButton, signInButton]) | |
| init() { | |
| super.init(frame: .zero) | |
| setup() | |
| } | |
| } | |
| private extension AuthenticateView { | |
| func setup() { | |
| addSubview(stackView) | |
| // style stackView and buttons and setup constraints.. | |
| } | |
| } | |
| extension AuthenticateView: ViewModelled { | |
| typealias ViewModel = AuthenticateViewModel | |
| var inputFromView: ViewModel.Input.FromView { | |
| return ViewModel.Input.FromView( | |
| signUpTrigger: signUpButton.rx.tap.asDriver(), | |
| signInTrigger: signInButton.rx.tap.asDriver() | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment