Skip to content

Instantly share code, notes, and snippets.

@Sajjon
Last active November 26, 2018 13:52
Show Gist options
  • Save Sajjon/6e8446e7e3827cab54940efaf8ecc765 to your computer and use it in GitHub Desktop.
Save Sajjon/6e8446e7e3827cab54940efaf8ecc765 to your computer and use it in GitHub Desktop.
Medium article: SLC part 1 - View
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