ActivityRings icon indicating copy to clipboard operation
ActivityRings copied to clipboard

Trap or emit warning on unreasonably small `ActivityRingScene` sizes?

Open calda opened this issue 7 years ago • 1 comments

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:

screen shot 2018-10-17 at 2 26 17 pm

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.

calda avatar Oct 17 '18 18:10 calda

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

HarshilShah avatar Oct 18 '18 03:10 HarshilShah