ClockKit

RSS for tag

Display app-specific data in the complications on the clock face using ClockKit.

ClockKit Documentation

Posts under ClockKit tag

11 Posts
Sort by:
Post not yet marked as solved
2 Replies
518 Views
⌚️Hello, I've noticed in watchOS 10 that when a complication is in the Smart Stack, the value of WCSession.isComplicationEnabled is false. I'm not sure if this is intentional or a bug. It seems trivial at first glance, but it actually affects the communication mechanism mentioned in Implementing Two-Way Communication Using Watch Connectivity. In the following two scenarios, if the user has only added the app's complication to the Smart Stack, then the watch app will not be able to communicate properly with the iOS app. Scenario 1 - WCSession.transferCurrentComplicationUserInfo() // update complications from the iOS app if WCSession.default.isComplicationEnabled { let userInfoTransfer = WCSession.default.transferCurrentComplicationUserInfo(userInfo) // ... } As described in Implementing Two-Way Communication Using Watch Connectivity, when the iOS app proactively updates the data of the watch app, since WCSession.isComplicationEnabled is false, WCSession will refuse to transfer any data. This causes the standalone complication in Smart Stack to not be updated. Scenario 2 - WKApplicationRefreshBackgroundTask When the watch app uses WKApplication.scheduleBackgroundRefresh() to periodically update data, as long as the user has added the app's complication to the watch face, the corresponding WKApplicationRefreshBackgroundTask can be executed periodically in the background to fetch data. However, if the user has only added complication to the Smart Stack, then the watch app will be completely purged, and the background task will not be executed at all. Although WCSession.isComplicationEnabled is not directly used in this scenario, its behavior appears to be the same, that is, the complication in the Smart Stack is not considered a complication by the system. Should I submit a bug report?
Posted
by Gong.
Last updated
.
Post not yet marked as solved
2 Replies
1.4k Views
I’ve created a single-target watchOS app in Xcode 14, but I can’t seem to get ClockKit complications working. I’ve added a CLKComplicationDataSource class to my watch target, and in the Info pane for my target I have set the CLKComplicationPrincipalClass key to MODULE-NAME.ComplicationController I haven’t yet added Complication placeholder images to my Assets.xcassets, but as far as I am aware, that shouldn’t be a problem while I am still testing. However, when I run it on a watchOS simulator, the complications never show up on the watch complications list when adding a complication. All of the tutorials I can find for ClockKit complications reference older two-target WatchKit apps. Do the newer single target apps no longer support ClockKit? If so, how can I make a two-target WatchKit app with Xcode 14? Unfortunately I cannot use WidgetKit for my complications because I need to support watchOS 7 at least, and WidgetKit only supports watchOS 9+ Thanks for your help
Posted
by AlwardK.
Last updated
.
Post not yet marked as solved
1 Replies
311 Views
Whenever I try to put my choice of time zones on the MacBook clock widget, it won't show on the main widget. It will show the stock clock options. Such as Cupertino, Tokyo, Sydney, and Paris, Even though I change them inside the app the widget won't display the changes.
Posted
by sakeeb07.
Last updated
.
Post not yet marked as solved
2 Replies
614 Views
I'm in the process of migrating one of my app's Apple Watch complications from ClockKit to WidgetKit. In my ClockKit complications, there are some cases where a show the relative time since the last event in the app (for example, "25MIN"). With ClockKit, this was quite straightforward using a CLKTextProvider designed for this exact purpose: CLKRelativeDateTextProvider(date: date, style: .offsetShort, units: [.hour, .minute]) This has always worked great, since it lets me specify that hours and minutes should be used, but not seconds, since they're not relevant here. How can I accomplish the same thing with WidgetKit and SwiftUI? The closest thing I've found is this: Text(date, style: .relative) It shows, for example: 14MIN 8SEC This is not what I want, since it shows seconds. It makes the complication look messy with all the extra information, and is distracting because it updates every second until an hour has passed. I suppose I could write my own logic to create a new timeline entry every minute to show the number of hours and minutes since the last update, but since CLKTextProvider works so nicely I wanted to check whether there is some way to accomplish the same thing without creating a new entry for every minute. There seem to be some more customizable options with date formatters, but I haven't found a way to combine this with the SwiftUI version that updates automatically on the Apple Watch face: https://developer.apple.com/documentation/foundation/date/relativeformatstyle/3766585-presentation
Posted Last updated
.
Post not yet marked as solved
3 Replies
1.1k Views
I'm able to successfully send userdefaults from the phone to the watch using applicationContext and save those userdefaults to the app group I created. For the watch, I see all the userdefaults come in successfully and I'm able to use them in the WatchOS app. Once I created the complications for the watch app, I am using the same app group ID and I added that app group in the capabilities of the watch extension but when I try to use the same userdefault that I'm using for the watch, everything is nil. I'm not understanding what I'm doing wrong. How do I share userdefaults between the watch and complication? This is how I'm bringing in the userdefaults from the phone to the watch let defaults = UserDefaults(suiteName: K.appGroupID) if let value1 = applicationContext["lat"] as? Double { defaults?.setValue(value1, forKey: "lat") } if let value2 = applicationContext["lng"] as? Double { defaults?.setValue(value2, forKey: "lng") } ... I am able to use this exact function in the watch app, but in the complication, the userdefault is nil. let formatter = DateFormatter() formatter.timeStyle = .short formatter.timeZone = .current let defaultLoad = UserDefaults.init(suiteName: K.appGroupID) if defaultLoad!.bool(forKey: "timeFormat") == true { ... I tried to remove and re-add the app group but that didn't work either. I also created a separate app group for the watch and extension to use alone but still same issue.
Posted Last updated
.
Post not yet marked as solved
1 Replies
1k Views
Hello everyone, sorry for my ignorance about it, with ANCS I managed to get all the notifications except the alarm that rings and the timer expired, where am I wrong? do they travel on other channels like gatt? if yes can someone help me understand how to receive these 2 information? the alarm goes off and the timer expired? Thanks in advance to everyone who will help me, Marco.
Posted Last updated
.
Post not yet marked as solved
3 Replies
2.4k Views
I've implemented delegate method suggested in the article https://developer.apple.com/documentation/widgetkit/converting-a-clockkit-app and double (even triple) checked kind and extensionBundleIdentifier of my StaticConfiguration But when I install the app version containing WidgetKit complications they don't replace old ones from ClockKit on the watch face. In the same time old complications are not displayed - I see empty slots. When I check setup in Watch app on the phone I see that old complications remain assigned. If I switch manually to WatchKit based they work fine. It would be helpful if Coffee Tracker code example (referenced in WWDC video and documentation) become updated with migration code.
Posted
by OlKir1143.
Last updated
.
Post marked as solved
1 Replies
577 Views
Hello Community! We have an Apple Watch app that intensively uses ClockKit complication API. As to the release of WatchOS 10, ClockKit has been deprecated. The question is what time do developers have to make complete transition to WidgetKit? How long WatchOS will support ClockKit complications?
Posted Last updated
.
Post not yet marked as solved
5 Replies
2.1k Views
Hello! Two of my watch apps (HiCoffee and HiWater) occasionally have issues with complications not displaying properly on watchOS 9. I did NOT use the new WidgetKit to implement the complications, all the related code still uses the same previous ClockKit + SwiftUI. I have observed several different types of wrong behaviors. One specific complication cannot be displayed (rendered?), while others do work (from the same app). This indicates that my watch app is working properly. All complications on the face cannot be displayed. But the app logs indicates it's running properly. In addition, when you long press the face to edit complications, yet it can be displayed normally. Log shows CLKComplicationServer.sharedInstance().activeComplications always returns 0 no matter how many complications are added to the face. Also, the ComplicationController is NOT called by system. I'm not using WatchKit. This part of the code in my app has been working properly for a long time and has not been changed. But after the release of watchOS 9, I received a lot of feedback from users with this problem. So I think the problem is in watchOS 9. I haven't found a way to reproduce the problem yet. Any suggestions please?
Posted
by Gong.
Last updated
.
Post not yet marked as solved
0 Replies
623 Views
Hi Team, I am using the ClockKit to populate my watch app compilations. I have not added the WidgetKit target yet. As Apple start showing warnings for the storyboard in the watch extension, I replaced the storyboard with SwiftUI classes So now my app UI is created from SwiftUI and Complications are from ClockKit But when the watch is upgraded to 9, there are a few issues coming up related to complications most of them are actually related to the timeline and complications are becoming unresponsive So whether Apple still support ClockKit ? or is it mandatory to move to WidgetKIt?
Posted Last updated
.