     }
 }
 
-// MARK: Rx
-
 extension UIApplication {
     
     private var firstLaunchKey:String { return "RxAppState_didLaunchBefore" }

        return rx_delegate.observe(#selector(UIApplicationDelegate.applicationDidBecomeActive(_:)))
            .map { _ in
                return .Active
        }
    }
    
    public var rx_applicationDidEnterBackground: Observable<AppState> {
        return rx_delegate.observe(#selector(UIApplicationDelegate.applicationDidEnterBackground(_:)))
            .map { _ in
                return .Background
        }
    }
    
    public var rx_applicationWillResignActive: Observable<AppState> {
        return rx_delegate.observe(#selector(UIApplicationDelegate.applicationWillResignActive(_:)))
            .map { _ in
                return .Inactive
        }
    }
    
    public var rx_applicationWillTerminate: Observable<AppState> {
        return rx_delegate.observe(#selector(UIApplicationDelegate.applicationWillTerminate(_:)))
            .map { _ in
                return .Terminated
        }
    }
    
    public var rx_appState: Observable<AppState> {


import RxSwift
import RxCocoa

public enum AppState: Equatable {
    case Active
