Skip to content

Commit 604ef63

Browse files
author
Bharat Mediratta
committed
Change the appearance of the chart to be platter style to better fit with Watch aesthetics
1 parent 17690d9 commit 604ef63

File tree

2 files changed

+13
-19
lines changed

2 files changed

+13
-19
lines changed

WatchApp Extension/Scenes/GlucoseChartScene.swift

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ import UIKit
1919
extension UIColor {
2020
static let glucoseTintColor = UIColor(red: 0 / 255, green: 176 / 255, blue: 255 / 255, alpha: 1)
2121
static let gridColor = UIColor(white: 193 / 255, alpha: 1)
22-
static let nowColor = UIColor(white: 193 / 255, alpha: 0.5)
22+
static let nowColor = UIColor(white: 0.2, alpha: 1)
2323
static let rangeColor = UIColor(red: 158/255, green: 215/255, blue: 245/255, alpha: 1)
24+
static let backgroundColor = UIColor(white: 0.1, alpha: 1)
2425
}
2526

2627
extension SKLabelNode {
@@ -90,16 +91,16 @@ extension HKUnit {
9091

9192
extension WKInterfaceDevice {
9293
enum WatchSize {
93-
case Watch38mm
94-
case Watch42mm
94+
case watch38mm
95+
case watch42mm
9596
}
9697

9798
func watchSize() -> WatchSize {
9899
switch screenBounds.width {
99100
case 136:
100-
return .Watch38mm
101+
return .watch38mm
101102
default:
102-
return .Watch42mm
103+
return .watch42mm
103104
}
104105
}
105106
}
@@ -158,23 +159,16 @@ class GlucoseChartScene: SKScene {
158159
// Use the fixed sizes specified in the storyboard, based on our guess of the model size
159160
super.init(size: {
160161
switch WKInterfaceDevice.current().watchSize() {
161-
case .Watch38mm:
162+
case .watch38mm:
162163
return CGSize(width: 134, height: 68)
163-
case .Watch42mm:
164+
case .watch42mm:
164165
return CGSize(width: 154, height: 86)
165166
}
166167
}())
167168

168169
anchorPoint = CGPoint(x: 0, y: 0)
169170
scaleMode = .aspectFit
170-
backgroundColor = .clear
171-
172-
let frame = SKShapeNode(rectOf: size, cornerRadius: 0)
173-
frame.position = CGPoint(x: size.width / 2, y: size.height / 2)
174-
frame.lineWidth = 2
175-
frame.fillColor = .clear
176-
frame.strokeColor = .gridColor
177-
addChild(frame)
171+
backgroundColor = .backgroundColor
178172

179173
let dashedPath = CGPath(rect: CGRect(origin: CGPoint(x: size.width / 2, y: 0), size: CGSize(width: 0, height: size.height)), transform: nil).copy(dashingWithPhase: 0, lengths: [4.0, 3.0])
180174
let now = SKShapeNode(path: dashedPath)

WatchApp/Base.lproj/Interface.storyboard

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,11 @@
368368
</group>
369369
</items>
370370
</group>
371-
<group alignment="left" layout="overlap" radius="0.0" id="GqJ-yv-NKQ">
371+
<group alignment="left" layout="overlap" id="GqJ-yv-NKQ">
372372
<items>
373-
<spriteKitScene width="2" height="2" alignment="center" verticalAlignment="center" id="9BI-AC-l6c">
374-
<variation key="device=watch38mm" height="68" width="134"/>
375-
<variation key="device=watch42mm" height="86" width="154"/>
373+
<spriteKitScene width="1" height="2" alignment="center" verticalAlignment="center" id="9BI-AC-l6c">
374+
<variation key="device=watch38mm" height="68"/>
375+
<variation key="device=watch42mm" height="86"/>
376376
</spriteKitScene>
377377
</items>
378378
</group>

0 commit comments

Comments
 (0)