Skip to content

Commit

Permalink
Add scene sizes for Series 4 watches
Browse files Browse the repository at this point in the history
  • Loading branch information
elnjensen committed Oct 5, 2018
1 parent 3d72c21 commit 33337c1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 11 additions & 1 deletion WatchApp Extension/Scenes/GlucoseChartScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,19 @@ extension HKUnit {
extension WKInterfaceDevice {
enum WatchSize {
case watch38mm
case watch40mm
case watch42mm
case watch44mm
}

func watchSize() -> WatchSize {
switch screenBounds.width {
case 136:
return .watch38mm
case 162:
return .watch40mm
case 184:
return .watch44mm
default:
return .watch42mm
}
Expand Down Expand Up @@ -160,8 +166,12 @@ class GlucoseChartScene: SKScene {
switch WKInterfaceDevice.current().watchSize() {
case .watch38mm:
return CGSize(width: 134, height: 90)
case .watch40mm:
return CGSize(width: 158, height: 100)
case .watch42mm:
return CGSize(width: 154, height: 86)
return CGSize(width: 154, height: 100)
case .watch44mm:
return CGSize(width: 180, height: 130)
}
}())

Expand Down
12 changes: 7 additions & 5 deletions WatchApp/Base.lproj/Interface.storyboard
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="14113" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="rNf-Mh-tID">
<document type="com.apple.InterfaceBuilder.WatchKit.Storyboard" version="3.0" toolsVersion="14313.18" targetRuntime="watchKit" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="rNf-Mh-tID">
<device id="watch42" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="watchOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14033"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBWatchKitPlugin" version="14238.10"/>
</dependencies>
<scenes>
<!--AddCarbsInterfaceController-->
Expand Down Expand Up @@ -367,9 +367,11 @@
</group>
<group width="1" alignment="left" layout="vertical" id="GqJ-yv-NKQ">
<items>
<spriteKitScene width="2" height="2" alignment="center" verticalAlignment="center" id="9BI-AC-l6c">
<spriteKitScene width="4" height="4" alignment="center" verticalAlignment="center" id="9BI-AC-l6c">
<variation key="device=watch38mm" height="90" width="134"/>
<variation key="device=watch42mm" height="86" width="154"/>
<variation key="device=watch40mm" height="100" width="158"/>
<variation key="device=watch42mm" height="100" width="154"/>
<variation key="device=watch44mm" height="130" width="180"/>
</spriteKitScene>
</items>
</group>
Expand Down

0 comments on commit 33337c1

Please sign in to comment.