Skip to content

Instantly share code, notes, and snippets.

@jeremytregunna
Created July 27, 2016 14:22
Show Gist options
  • Select an option

  • Save jeremytregunna/eefd6937c772ee4ce2c6f12b93966e54 to your computer and use it in GitHub Desktop.

Select an option

Save jeremytregunna/eefd6937c772ee4ce2c6f12b93966e54 to your computer and use it in GitHub Desktop.
//
// SplashViewController.swift
// Transit
//
// Created by Jeremy Tregunna on 2016-07-25.
// Copyright © 2016 Greenshire, Inc. All rights reserved.
//
import UIKit
import Standard
import MQTT
class SplashViewController: UIViewController {
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
store.subscribe(self)
Realtime.sharedInstance.connectIfNeeded()
Realtime.sharedInstance.subscribe("/test", qos: .AtLeastOnce)
}
override func viewWillDisappear(animated: Bool) {
store.unsubscribe(self)
super.viewWillDisappear(animated)
}
@IBAction func signInTapped(sender: UIButton) {
let signInAction = SignInAction(navigationController: navigationController!)
store.dispatch(signInAction)
}
@IBAction func signUpTapped(sender: UIButton) {
let signUpAction = SignInAction(viewController: self)
store.dispatch(signUpAction)
}
}
extension SplashViewController: StoreSubscriber {
func newState(state: AppState) {
print(state)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment