Skip to content

Instantly share code, notes, and snippets.

@Wooder
Last active January 23, 2017 21:03
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 Wooder/925a024e18d1a0842efd09847e79741c to your computer and use it in GitHub Desktop.
Save Wooder/925a024e18d1a0842efd09847e79741c to your computer and use it in GitHub Desktop.
import UIKit
extension UIApplication {
static var applicationName: String {
let mainBundle = NSBundle.mainBundle()
let key = String(kCFBundleNameKey)
let value = mainBundle.objectForInfoDictionaryKey(key) as? String
return value ?? ""
}
static var bundleId: String {
return Bundle.main.bundleIdentifier
}
class func mainWindow() -> UIWindow?{
if let appDelegate = UIApplication.sharedApplication().delegate as? AppDelegate {
return appDelegate.window
}
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment