Skip to content

Instantly share code, notes, and snippets.

@mingsai
Created July 2, 2015 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mingsai/7963abb004d28858f7fa to your computer and use it in GitHub Desktop.
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
//
// 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