class func systemModelVersion() -> String {
var utdName: utsname = utsname()
uname(&utdName)
let machine = utdName.machine
let mirror: Mirror = Mirror(reflecting: machine)
var identifier: String = ""
for children in mirror.children {
if let value = children.value as? Int8 where value != 0 {
identifier.append(UnicodeScalar(UInt8(value)))
}
}
return identifier
}
完璧な私のメモ書きっす!
ちなみに、Xcode 7 Bata 3 だと。。。
class func systemModelVersion() -> String {
var utdName: utsname = utsname()
uname(&utdName)
let machine = utdName.machine
let mirror: MirrorType = reflect(machine)
var identifier: String = ""
for index in 0..<mirror.count {
if let value = mirror[index].1.value as? Int8 where value != 0 {
identifier.append(UnicodeScalar(UInt8(value)))
}
}
return identifier
}
と書いていました。