mirror of
https://github.com/home-assistant/iOS.git
synced 2026-06-17 08:28:04 -05:00
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.
36 lines
967 B
Swift
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
|
|
}
|
|
}
|
|
}
|