ActivityRings
ActivityRings copied to clipboard
Trap or emit warning on unreasonably small `ActivityRingScene` sizes?
When I was experimenting this morning, I typed up this sample class:
class InterfaceController: WKInterfaceController {
@IBOutlet weak var activityRingInterfaceScene: WKInterfaceSKScene!
var activityRingScene = ActivityRingScene()
override func willActivate() {
activityRingScene.ringWidth = 15
activityRingInterfaceScene.presentScene(activityRingScene)
}
override func didAppear() {
activityRingScene.progress = 0.75
}
}
Which looks like this:
Took me a while to figure out what the issue was, but it turns out the ActivityRingScene was defaulting to CGSize(width: 1, height: 1). The key to fixing that issue is something like ActivityRingScene(size: contentFrame.size).
I'm wondering if it would be worth trapping or emitting some warning when the ActivityRingScene size is unreasonably small (like 1x1 in that example).
I can't think of a good way to make it automatically have the correct behavior, since we don't have an opportunity to subclass WKInterfaceSKScene.
That’s a good catch! I haven’t done much WatchKit dev so I’m gonna have to look into the life cycle events a bit. Hopefully there’s something in there or some other prior art about dealing with this.
If not, a warning seems like the right way to go about this.
Sent with GitHawk