Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. //
  2. // SplashViewController.swift
  3. // Transit
  4. //
  5. // Created by Jeremy Tregunna on 2016-07-25.
  6. // Copyright © 2016 Greenshire, Inc. All rights reserved.
  7. //
  8.  
  9. import UIKit
  10. import Standard
  11. import MQTT
  12.  
  13. class SplashViewController: UIViewController {
  14. override func viewWillAppear(animated: Bool) {
  15. super.viewWillAppear(animated)
  16.  
  17. store.subscribe(self)
  18.  
  19. Realtime.sharedInstance.connectIfNeeded()
  20. Realtime.sharedInstance.subscribe("/test", qos: .AtLeastOnce)
  21. }
  22.  
  23. override func viewWillDisappear(animated: Bool) {
  24. store.unsubscribe(self)
  25.  
  26. super.viewWillDisappear(animated)
  27. }
  28.  
  29. @IBAction func signInTapped(sender: UIButton) {
  30. let signInAction = SignInAction(navigationController: navigationController!)
  31. store.dispatch(signInAction)
  32. }
  33.  
  34. @IBAction func signUpTapped(sender: UIButton) {
  35. let signUpAction = SignInAction(viewController: self)
  36. store.dispatch(signUpAction)
  37. }
  38. }
  39.  
  40. extension SplashViewController: StoreSubscriber {
  41. func newState(state: AppState) {
  42. print(state)
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement