         RGAppVersion.defaults.synchronize()
     }
     
-    class func determineAppVersionState() {
-        if appVersionState != .NotDetermined {
+    public class func determineAppVersionState() {
+        if _appVersionState != .NotDetermined {
             return
         }
         

        if _lastInstalledAppVersion?.appVersion == nil {
            _currentAppVersion?.setAsCurrentVersion()
            
            appVersionState = .Installed
        }
        // App updated.
        else if _lastInstalledAppVersion?.combinedVersion != _currentAppVersion?.combinedVersion {
            _currentAppVersion?.setAsCurrentVersion()
            
            appVersionState = .Updated
        }
        // Nothing changed.
        else {
            appVersionState = .NothingChanged
        }
    }
    
    class func currentVersion() -> RGAppVersion {
        if appVersionState == .NotDetermined {
            RGAppVersion.determineAppVersionState()
        }
        return _currentAppVersion!
    }
    
    class func lastVersion() -> RGAppVersion? {
        if appVersionState == .NotDetermined {
            RGAppVersion.determineAppVersionState()
        }
        return (_lastInstalledAppVersion?.appVersion == nil) ? nil : _lastInstalledAppVersion
    }
    
    class func appIsFreshInstalled() -> Bool {
        if appVersionState == .NotDetermined {
            RGAppVersion.determineAppVersionState()
        }
        return appVersionState == .Installed
    }
    
    class func appWasUpdated() -> Bool {
        if appVersionState == .NotDetermined {
            RGAppVersion.determineAppVersionState()
        }
        return appVersionState == .Updated
    }
}


import Foundation

public class RGAppVersion {
    
    enum RGAppVersionState {
        case NotDetermined, Installed, Updated, NothingChanged
    }
    
    private static let lastInstalledAppVersionKey = "rg.appVersion.lastInstalledAppVersion"
    private static let lastInstalledBuildKey = "rg.appVersion.lastInstalledAppversion"
    
    private static var _lastInstalledAppVersion: RGAppVersion?
    private static var _currentAppVersion: RGAppVersion?
    private static var _appVersionState = RGAppVersionState.NotDetermined
    
    public var appVersion: String?
    public var buildNumber: String?
    
    public var combinedVersion: String {
        get {
            if let appVersion = appVersion, buildNumber = buildNumber {
                return "\(appVersion)(\(buildNumber))"
