Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexbaramilis/5eafcee24b1fac3ab967de2404b520b9 to your computer and use it in GitHub Desktop.
Save alexbaramilis/5eafcee24b1fac3ab967de2404b520b9 to your computer and use it in GitHub Desktop.
Playground with tappable button bound with RxCocoa
import UIKit
import PlaygroundSupport
import RxSwift
import RxCocoa
let signUpButton = UIButton()
signUpButton.setTitle("Tap me!", for: .normal)
signUpButton.sizeToFit()
let didTapSignUp = PublishSubject<Void>()
signUpButton.rx.tap.subscribe(didTapSignUp)
didTapSignUp.subscribe { _ in
print("I got tapped!")
}
PlaygroundPage.current.liveView = signUpButton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment