Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trap or emit warning on unreasonably small ActivityRingScene sizes? #6

Open
calda opened this issue Oct 17, 2018 · 1 comment
Open

Comments

@calda
Copy link
Collaborator

calda commented Oct 17, 2018

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.

@HarshilShah
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants