Reputation: 13514
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 {
}
Upvotes: 3
Views: 444
Reputation: 2124
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
}
}
Upvotes: 3