Files
iOS/Sources/Extensions/Watch/Utilities/WKInterfaceDevice+Size.swift
Zac West 640cca884b Add SwiftFormat to project (#1463)
Adds new fastlane lanes:
- `fastlane lint` which checks the linters
- `fastlane autocorrect` which applies the linters which can autocorrect (Rubocop, SwiftFormat)

Adds a build step to the Codegen abstract target which runs SwiftFormat in lint mode, pointing out what it's going to change when run.

Applies SwiftFormat to nearly all code -- exempts a few externally-sourced files and generated code.
2021-02-05 22:06:25 -08:00

36 lines
967 B
Swift

import Foundation
import UIKit
import WatchKit
enum WatchResolution: Int {
case Watch38mm = 38
case Watch40mm = 40
case Watch42mm = 42
case Watch44mm = 44
case Unknown = 0
}
extension WKInterfaceDevice {
class func currentResolution() -> WatchResolution {
let watch38mmRect = CGRect(x: 0, y: 0, width: 136, height: 170)
let watch40mmRect = CGRect(x: 0, y: 0, width: 162, height: 197)
let watch42mmRect = CGRect(x: 0, y: 0, width: 156, height: 195)
let watch44mmRect = CGRect(x: 0, y: 0, width: 184, height: 224)
let currentBounds = WKInterfaceDevice.current().screenBounds
switch currentBounds {
case watch38mmRect:
return .Watch38mm
case watch40mmRect:
return .Watch40mm
case watch42mmRect:
return .Watch42mm
case watch44mmRect:
return .Watch44mm
default:
return .Unknown
}
}
}