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


import Foundation

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

    
    class var defaults: NSUserDefaults {get {return NSUserDefaults.standardUserDefaults()}}
    
    public init(appVersion: String?, buildNumber: String?) {
        self.appVersion = appVersion
        self.buildNumber = buildNumber
    }
