Created
July 2, 2015 23:57
-
-
Save mingsai/7963abb004d28858f7fa to your computer and use it in GitHub Desktop.
Extensions to the UIApplication along with a convenient place to store global constants when needed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MNGApplicationExtensions.swift | |
// | |
// | |
// Created by Tommie N. Carter, Jr., MBA on 6/22/15. | |
// Copyright © 2015 MING Technology. All rights reserved. | |
// | |
import UIKit | |
let defaultCenter = NSNotificationCenter.defaultCenter() | |
let recordsNavigator = MNGRecordNavigator.sharedInstance | |
let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate | |
var defaultUserID = String() | |
extension UIApplication { | |
struct Constants { | |
static let CFBundleShortVersionString = "CFBundleShortVersionString" | |
} | |
class func appVersion() -> String { | |
return NSBundle.mainBundle().objectForInfoDictionaryKey(Constants.CFBundleShortVersionString) as! String | |
} | |
class func appBuild() -> String { | |
return NSBundle.mainBundle().objectForInfoDictionaryKey(kCFBundleVersionKey as String) as! String | |
} | |
class func versionBuild() -> String { | |
let version = appVersion(), build = appBuild() | |
return version == build ? "v\(version)" : "v\(version)(\(build))" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment