I understand that complications in WidgetKit and watchOS 9 are different to the old ClockKit way, and I'm trying to populate the getSnapshot, getPlaceholder and getTimeline functions appropriately for the new method.
I'm using dynamic intents, and I've got that working and providing a set of items I want the user to choose from, but at the various stages of selecting and adding a complication to the watch face, nothing I do seems to work properly on a device, and sometimes in the Simulator.
On the Simulator:
1: The previews all use the same data, but getSnapshot()
is supposed to return the data specific to that event from the configuration, i.e. if let theId = configuration.event?.identifier
. "Christmas" is correct, but "Gallery Opening" is using Christmas's data.
Are you only supposed to show ONE particular bit of data, like some dummy preview data or something? I can do that, but the complication picker then just looks really boring, with just the text below being different. I note that Apple's weather complications show different data. How did they do that?
2: You can see that once I pick an event it's displayed correctly in the Watch face edit screen:
The "72d" circular complication is the "New York" event, and the rectangular one is correctly using the data for the "London Party!".
3: Once I've selected the events I want to use in those complications the edit screen shows them as totally blank, not even a placeholder. Which method gives us that preview?
4: Once I confirm the edits and return to the Watch face, the complications appear correctly:
Note: This is all from the Simulator (apart from the image of Apple's Weather complications). This stuff barely works on a device. Half the time the complications are all placeholders, and half the time they're using the wrong data! If it works in the Simulator, it should work on the phone, or there is no point in giving us the Simulator if the results are different.
So basically:
- Q1. How do I use different data in the complications picker?
- Q2. How do you get the previews to show when you're in edit mode?
- Q3. Does anyone know how to get print() statements to work when I'm running the Complications scheme? I could answer all these questions myself if I could output some debug info to the console, but all I see is the output from the Watch App target...
A partial fix can be found here.