Skip to content

Instantly share code, notes, and snippets.

View nataliachodelski's full-sized avatar

Natalia Chodelski nataliachodelski

View GitHub Profile
@nataliachodelski
nataliachodelski / platformString.swift
Created April 25, 2017 19:50 — forked from waitonza/platformString.swift
iOS Platform Hardware String in Swift Language for Reuse
func platformString() -> String {
var size : UInt = 0
sysctlbyname("hw.machine", nil, &size, nil, 0)
var machine = [CChar](count: Int(size), repeatedValue: 0)
sysctlbyname("hw.machine", &machine, &size, nil, 0)
let platform : String = String.fromCString(machine)!
if platform == "iPhone1,1" { return "iPhone 1G" }
if platform == "iPhone1,2" { return "iPhone 3G" }
if platform == "iPhone2,1" { return "iPhone 3GS" }