Skip to content

Instantly share code, notes, and snippets.

@Stickerbox
Created March 23, 2018 12:01
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 Stickerbox/9fbadd1e2e89187cdfb7c9ccdc0b6d24 to your computer and use it in GitHub Desktop.
Save Stickerbox/9fbadd1e2e89187cdfb7c9ccdc0b6d24 to your computer and use it in GitHub Desktop.
extension UIWindow {
open override func motionEnded(_ motion: UIEventSubtype, with event: UIEvent?) {
super.motionEnded(motion, with: event)
guard motion == .motionShake else { return }
let version = Bundle.main.versionNumber ?? ""
let build = Bundle.main.buildNumber ?? ""
Logger.present(onto: rootViewController, version: version, build: build)
}
}
extension Bundle {
var versionNumber: String? {
return infoDictionary?["CFBundleShortVersionString"] as? String
}
var buildNumber: String? {
return infoDictionary?["CFBundleVersion"] as? String
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment