Skip to main content

Swift System Version Checking

NSProcessInfo

  • isOperatingSystemAtLeastVersion
  • operatingSystemVersion


Ironically, the new NSProcessInfo APIs aren't especially useful at the time of writing, since they're unavailable for iOS 7.

As an alternative, one can use the systemVersion property UIDevice

switch UIDevice.currentDevice().systemVersion.compare("8.0.0", options: NSStringCompareOptions.NumericSearch) {
case .OrderedSame, .OrderedDescending:
    println("iOS >= 8.0")
case .OrderedAscending:
    println("iOS < 8.0")
}

NSHipster

Comments