mirror of
https://github.com/DefinedNet/mobile_nebula.git
synced 2025-01-18 19:27:05 +00:00
c7a53c3905
Co-authored-by: Nate Brown <nbrown.us@gmail.com>
26 lines
840 B
Swift
26 lines
840 B
Swift
import Foundation
|
|
|
|
class PackageInfo {
|
|
func getVersion() -> String {
|
|
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ??
|
|
"unknown"
|
|
let buildNumber = Bundle.main.infoDictionary?["CFBundleVersion"] as? String
|
|
|
|
if (buildNumber == nil) {
|
|
return version
|
|
}
|
|
|
|
return "\(version)-\(buildNumber!)"
|
|
}
|
|
|
|
func getName() -> String {
|
|
return Bundle.main.infoDictionary?["CFBundleDisplayName"] as? String ??
|
|
Bundle.main.infoDictionary?["CFBundleName"] as? String ??
|
|
"Nebula"
|
|
}
|
|
|
|
func getSystemVersion() -> String {
|
|
let osVersion = ProcessInfo.processInfo.operatingSystemVersion
|
|
return "\(osVersion.majorVersion).\(osVersion.minorVersion).\(osVersion.patchVersion)"
|
|
}
|
|
}
|