https://github.com/vikill33/applewatchscreensize
Simply get Apple Watch's screen size and rounded corner size.
https://github.com/vikill33/applewatchscreensize
Last synced: 12 months ago
JSON representation
Simply get Apple Watch's screen size and rounded corner size.
- Host: GitHub
- URL: https://github.com/vikill33/applewatchscreensize
- Owner: VIkill33
- Created: 2023-08-04T11:35:55.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-26T08:06:19.000Z (almost 2 years ago)
- Last Synced: 2025-04-06T10:47:15.951Z (about 1 year ago)
- Language: Swift
- Size: 15.6 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# AppleWatchScreenSize
An easy way to get screen size and rounded corner size of Apple Watch.
# Installation
Require watchOS 4 or higher.
In Xcode go to `File -> Swift Packages -> Add Package Dependency`
and paste in the repo's url:
`https://github.com/VIkill33/AppleWatchScreenSize.git`
Or you can download the code of this repo, then `Add Local...` in Xcode, and open the folder of the repo.
# Usage
- Import this package after you installed by `import AppleWatchScreenSize`
- This repo define a public struct called ScreenSize containing 3 vars called width, height and a computed var cornerSize. You can easily know what they mean from their name(Note all vars were measured as **px**). So the demo code would be like:
```swift
import SwiftUI
import AppleWatchScreenSize
struct ContentView: View {
let screenSize = ScreenSize()
var body: some View {
RoundedRectangle(cornerSize: CGSize(width: Double(screenSize.cornerSize ?? 0), height: Double(screenSize.cornerSize ?? 0)))
.stroke(lineWidth: 10.0)
.foregroundColor(.red)
.edgesIgnoringSafeArea(.all)
}
}
```
The preview will be like:

# How does it work
The data comes from https://screensizes.app/?compare=applewatch.
Since Apple Watch with same resolution share the same rounded corner size, it's not hard to infer the corner size from given screen size. Before series 3 Apple Watch just have a rectangle screen, so the corner size of them will return **nil** instead.
It can't be denied that Apple may someday release a new watch with same resolution but different corner size, but it works fine by now ;)