Swift如何检查系统版本

let os = NSProcessInfo().operatingSystemVersion

switch (os.majorVersion, os.minorVersion, os.patchVersion) {

case (8, _, _):

print("iOS >= 8.0.0")

case (7, 0, _):

print("iOS >= 7.0.0, = 7.1.0, < 8.0.0")

default:

print("iOS = 8.0")

}

NSProcessInfo().isOperatingSystemAtLeastVersion(NSOperatingSystemVersion(majorVersion: 0, minorVersion: 0, patchVersion: 0))

你可能感兴趣的:(Swift如何检查系统版本)