ios - Get current device, also in simulator -


i´m able current device right checking this:

static func iphonemodelsize() -> int{     switch uidevice.currentdevice().modelname {     case "iphone 4", "iphone 4s" :         return 8     case "iphone 5", "iphone 5c", "iphone 5s" :         return ...     case "iphone 6, iphone 6s" :         return ...     case "iphone 6 plus, iphone 6s plus" :         return ...     default:         return ...     } } 

but when i´m using simulator have change default value since it´s simulator, there other way current device , current simulator device?

you check device height, in case include simulator.

static func currentdevice() -> string{     switch uiscreen.mainscreen().bounds.height {     case 480 :         return "iphone 4/s"     case 568 :         return "iphone 5/s"     case 667 :         return "iphone 6/s"     case 736 :         return "iphone 6 plus/s"     default:         return ""     } } 

Comments