Created
April 16, 2015 09:05
-
-
Save vjosullivan/3fc888184cc3bb14748a to your computer and use it in GitHub Desktop.
Some device details (requires iOS 8.0.0 or later).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Is the device's iOS version equal or later to the targeted version? | |
let targetOSVersion = NSOperatingSystemVersion(majorVersion:8, minorVersion:0, patchVersion:0) | |
if NSProcessInfo().isOperatingSystemAtLeastVersion(targetOSVersion) { | |
println("Running iOS version 8.0.0 or later.") | |
} else { | |
println("Running iOS version 7 or earlier.") | |
} | |
// What version of iOS is this device running? | |
let osVersion = NSProcessInfo().operatingSystemVersion | |
println("Current iOS version: \(osVersion.majorVersion).\(osVersion.minorVersion).\(osVersion.patchVersion).") | |
// ...or... | |
println(NSProcessInfo().operatingSystemVersionString) | |
// How much RAM memory is available? | |
println("Total RAM memory: \(NSProcessInfo().physicalMemory / 1048576) MB.") | |
// What is the name of this device? | |
println("Computer ID: \(NSProcessInfo().hostName).") | |
// How much file space is available on this device? | |
let system = NSFileManager.defaultManager().attributesOfFileSystemForPath(NSHomeDirectory() as String, error: nil) | |
let totalFileSpace = system?[NSFileSystemSize] as! Int | |
let freeFileSpace = system?[NSFileSystemFreeSize] as! Int | |
println("Total file space: \(totalFileSpace / 1048576) MB.") | |
println("Free file space: \(freeFileSpace / 1048576) MB.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment