Search code examples
swiftwatchkitapple-watchwatchos-3

How to find which apple watch 38 or 42mm?


What is the correct way to find out which apple watch is it programmatically whether it's 38mm or 42mm? How can I make a struct object for the same to access it like below:

if watch.size == 38 { 
} else { 
}

Solution

  • You can check Apple Watch size in below following way:-

    public struct watch {
    
         public static var screenWidth: CGFloat {
              return WKInterfaceDevice.current().screenBounds.width
         }
    
         public static var is38: Bool {
              return screenWidth == 136
         }
    
         public static var is42: Bool {
              return screenWidth == 156
         }
    }