Watch Complications

RSS for tag

Display timely and relevant information about your app on the Apple Watch face using Complications.

Posts under Watch Complications tag

49 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Updating watchOS complication when data in iOS app changes.
Hello, I'm facing problems when attempting to update my watchOS complication when relevant data on the iPhone app changes. From what I gather reading the documentation I have to use the Watch Connectivity Framework to send said new data from the phone to the watch: use transferCurrentComplicationUserInfo() to send a dictionary of data from the phone to the watch implement the didReceiveUserInfo delegate method to handle incoming data on the watch in said handler, save the incoming data to UserDefaults using an App Group so the widget-extension can read that data after saving the data to UserDefaults, call WidgetCenter.shared.reloadAllTimelines() so watchOS can request fresh timelines for my complications change the getTimeline() method of my TimelineProvider so it uses the received data from UserDefaults OR async fetch fresh data if received data from phone is too old If I understand correctly, transferCurrentComplicationUserInfo() is limited to be used a maximum of 50 times a day. I'm running the apps in debug mode, so this should be no problem. Here is my current implementation: 1 : Setup of my WC class: final class Connectivity: NSObject { // singleton approach static let shared = Connectivity() // used to rate limit transmissions from phone → watch private var lastSentBalanceContext: Date? = nil private override init() { super.init() // no need to check availability on watchOS #if !os(watchOS) guard WCSession.isSupported() else { return } #endif WCSession.default.delegate = self WCSession.default.activate() } } 2 : The method enabling transmission from phone to watch: #if os(iOS) extension Connectivity: WCSessionDelegate { func sendBalanceContext(sample: HealthData) { guard WCSession.default.activationState == .activated else { return } guard WCSession.default.isWatchAppInstalled else { return } // rate limitat transmissions guard self.lastSentBalanceContext == nil || abs(Date.now.timeIntervalSince(self.lastSentBalanceContext!)) > 10 else { return } if WCSession.default.remainingComplicationUserInfoTransfers > 0 { WCSession.default.transferCurrentComplicationUserInfo([ "context": "balance", "date": sample.date, "burnedActive": sample.burnedActive, // more data... ]) self.lastSentBalanceContext = .now } } // boilerplate handlers here } #endif 3 : Delegete method that handles incoming data on the watch: #if os(watchOS) extension Connectivity: WCSessionDelegate { func session(_ session: WCSession, didReceiveUserInfo userInfo: [String : Any] = [:]) { guard let context = userInfo["context"] as? String, context == "balance" else { return } guard let date = userInfo["date"] as? Date, let burnedActive = userInfo["burnedActive"] as? Int /* more data... */ else { return } guard let SharedDefaults = UserDefaults(suiteName: "group.4DXABR577J.com.count.kcal.app") else { return } // TimelineProvider uses this to determine wether to use this data or fetch data on its own SharedDefaults.set(Date.now, forKey: "lastReceivedBalanceContext") SharedDefaults.set(date, forKey: "date") SharedDefaults.set(burnedActive, forKey: "burnedActive") // more data... WidgetCenter.shared.reloadAllTimelines() } // boilerplate handlers } #endif 4 : Finally, the TimelineProvider: struct HealthDataEntry: TimelineEntry { let date: Date let data: HealthData } struct HealthDataTimelineProvider: TimelineProvider { // other callbacks here func getTimeline(in context: Context, completion: @escaping (Timeline<HealthDataEntry>) -> Void) { let SharedDefaults: UserDefaults = UserDefaults(suiteName: "group.4DXABR577J.com.count.kcal.app")! let nextUpdateDate = Calendar.current.date(byAdding: .minute, value: 15, to: .now)! // use data from phone if it is less than 60 seconds old if let lastReceivedBalanceContext = SharedDefaults.object(forKey: "lastReceivedBalanceContext") as? Date { let interval = lastReceivedBalanceContext.timeIntervalSince(.now) if interval > -60 && interval <= 0 { let data = HealthData(date: SharedDefaults.object(forKey: "date") as? Date ?? Date(timeIntervalSinceReferenceDate: 0), burnedActive: SharedDefaults.integer(forKey: "burnedActive"), burnedActive7: SharedDefaults.integer(forKey: "burnedActive7") /* other data ... */) let timeline = Timeline( entries: [HealthDataEntry(date: .now, data: data)], policy: .after(nextUpdateDate) ) completion(timeline) return } } // default: fetch from HealthKit (if received data from phone is > 60s) Task { let timeline = Timeline( entries: [HealthDataEntry(date: .now, data: try! await asyncFetchData())], policy: .after(nextUpdateDate) ) completion(timeline) } } } The issue I am facing is that the watchOS complication only gets refreshed when I acitvely build and run the watchOS app in Xcode and then initiate a transmission of data to the watch. This works even if I do it back to back to back. As soon as I stop the watchOS app from within Xcode, my complications won't update anymore. I noticed this behavior when I used print() statements throughout my code to see whether it is beeing executed as expected. The iPhone sends data, the watch receives it but then the watch fails to update the complications ONLY when not running from Xcode. Can you spot any flaws in my implementation or in my understanding? Maybe transferCurrentComplicationUserInfo() just isn't as reliable as I think it should be? I interpreted it as being practically guaranteed to refresh the complications 50 times a day, pretty much instantly? Any help or guidance would be greatly appreciated!
1
0
169
4d
Non-tinted image in complications using WidgetKit
I have a watchOS app where a user can select a picture. I’d like the picture to be displayed in a complication. I’m using WidgetKit, and I found out that for some watch faces (rendering mode = accented), the image gets tinted. Instead of the picture, the user sees only a colored box. It appears that using the old framework, ClockKit, it was possible to display an image that gets slightly colored with the tint color on tinted watch faces. I believe this is to ensure backward compatibility of old complications. My question is: can I do the same using WidgetKit? I tried using the widgetAccentable() modifier, but it doesn’t work. Here's an example of what I mean. In the middle complication, instead of the pink square, I'd like to display the user picture.
5
1
207
4d
File transfer issue from iPhone to Watch after iOS 17.5 & WatchOS 10.5 update
After updating to iOS 17.5 & WatchOS 10.5, the didFinish response from WCSessionDelegate does not come when transferring files from iPhone to Watch. It worked normally until 17.4 & 10.4. There is no problem with checking file completion even if a didFinish response is not received, but I think Apple needs to check this issue and update. File transfer is done using the transferFile function of WCSession. The file being transferred is a single file and its size does not exceed 30MB. When you try to transfer Pi, the message below appears in the Xcode log section. -[WCFileStorage persistOutgoingFileTransfer:] error serializing file transfer <WCSessionFileTransfer: 0x300155d60, session file: <WCSessionFile: 0x3001575c0, identifier: 0C8857EC-7D74-4E78-BA28-6C5526DE8949, file: /private/var/mobile/Containers/Data/Application/DD797847-DED1-42C0-989F-34CD05825007/tmp/C042D096-F12B-4B50-8792-868475DBBF47.zip, hasMetadata: YES>, transferring: YES> due to Error Domain=NSCocoaErrorDomain Code=4866 "Caught exception during archival: This object may only be encoded by an NSXPCCoder. ( 0 CoreFoundation 0x000000019b064f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460 1 libobjc.A.dylib 0x0000000192ef6018 objc_exception_throw + 60 2 Foundation 0x0000000199fe7778 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 1419128 3 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 4 WatchConnectivity 0x000000021d055f60 1AB4DDD6-9238-3965-B744-819F2916C8CC + 126816 5 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 6 WatchConnectivity 0x000000021d0567f0 1AB4DDD6-9238-3965-B744-819F2916C8CC + 129008 7 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 8 Foundation 0x0000000199f30628 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 669224 9 WatchConnectivity 0x000000021d0583ac 1AB4DDD6-9238-3965-B744-819F2916C8CC + 136108 10 WatchConnectivity 0x000000021d04390c 1AB4DDD6-9238-3965-B744-819F2916C8CC + 51468 11 WatchConnectivity 0x000000021d046640 1AB4DDD6-9238-3965-B744-819F2916C8CC + 63040 12 Foundation 0x0000000199ea9be0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117728 13 Foundation 0x0000000199ea9aa0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117408 14 Foundation 0x0000000199ea98a0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 116896 15 Foundation 0x0000000199ea7b40 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 109376 16 Foundation 0x0000000199f2c558 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 652632 17 Foundation 0x0000000199f2c1a4 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 651684 18 libdispatch.dylib 0x0000000105ed7764 _dispatch_block_async_invoke2 + 148 19 libdispatch.dylib 0x0000000105ec67bc _dispatch_client_callout + 20 20 libdispatch.dylib 0x0000000105ec98e0 _dispatch_continuation_pop + 676 21 libdispatch.dylib 0x0000000105ec8bb8 _dispatch_async_redirect_invoke + 680 22 libdispatch.dylib 0x0000000105edaae4 _dispatch_root_queue_drain + 404 23 libdispatch.dylib 0x0000000105edb4d8 _dispatch_worker_thread2 + 188 24 libsystem_pthread.dylib 0x00000001f7ebb8f8 _pthread_wqthread + 228 25 libsystem_pthread.dylib 0x00000001f7eb80cc start_wqthread + 8 )" UserInfo={NSDebugDescription=Caught exception during archival: This object may only be encoded by an NSXPCCoder. ( 0 CoreFoundation 0x000000019b064f2c 00E76A98-210C-3CB5-930B-F236807FF24C + 540460 1 libobjc.A.dylib 0x0000000192ef6018 objc_exception_throw + 60 2 Foundation 0x0000000199fe7778 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 1419128 3 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 4 WatchConnectivity 0x000000021d055f60 1AB4DDD6-9238-3965-B744-819F2916C8CC + 126816 5 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 6 WatchConnectivity 0x000000021d0567f0 1AB4DDD6-9238-3965-B744-819F2916C8CC + 129008 7 Foundation 0x0000000199ea0e14 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 81428 8 Foundation 0x0000000199f30628 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 669224 9 WatchConnectivity 0x000000021d0583ac 1AB4DDD6-9238-3965-B744-819F2916C8CC + 136108 10 WatchConnectivity 0x000000021d04390c 1AB4DDD6-9238-3965-B744-819F2916C8CC + 51468 11 WatchConnectivity 0x000000021d046640 1AB4DDD6-9238-3965-B744-819F2916C8CC + 63040 12 Foundation 0x0000000199ea9be0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117728 13 Foundation 0x0000000199ea9aa0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 117408 14 Foundation 0x0000000199ea98a0 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 116896 15 Foundation 0x0000000199ea7b40 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 109376 16 Foundation 0x0000000199f2c558 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 652632 17 Foundation 0x0000000199f2c1a4 3D3A12E3-F5E9-361F-B00A-4A5E8861AA55 + 651684 18 libdispatch.dylib 0x0000000105ed7764 _dispatch_block_async_invoke2 + 148 19 libdispatch.dylib 0x0000000105ec67bc _dispatch_client_callout + 20 20 libdispatch.dylib 0x0000000105ec98e0 _dispatch_continuation_pop + 676 21 libdispatch.dylib 0x0000000105ec8bb8 _dispatch_async_redirect_invoke + 680 22 libdispatch.dylib 0x0000000105edaae4 _dispatch_root_queue_drain + 404 23 libdispatch.dylib 0x0000000105edb4d8 _dispatch_worker_thread2 + 188 24 libsystem_pthread.dylib 0x00000001f7ebb8f8 _pthread_wqthread + 228 25 libsystem_pthread.dylib 0x00000001f7eb80cc start_wqthread + 8 )}
20
12
1.6k
1w
WidgetKit - complication doesn't sync between watch and iPhone
I'm currently working with complication using widgetkit for watchOS. When I select complication from Watch app in iPhone, The complication does not show content. In complication gallery, untitled complication is selecting. But when I select complication from watch, it's OK. This bug occurs in both real device and simulator. But it happen in some pair. Example: watch ultra (os 10.4) pair with iPhone 14 pro (os 17.0): NG watch ultra (os 10.4) pair with iPhone 14 pro (os 16.1): NG watch ultra (os 10.0) pair with iPhone 14 pro (os 17.0): OK I tried create simple project to check this bug. But this bug still occurs This is sample project: Github
0
1
338
May ’24
Widgets without timeline on WatchOS
TLDR; Can I have a widget without a Timeline? My previous watch app had a complication. Simply so it can be added to the watch face for a quick launch of the app. However now seeing that method is deprecated in favour of widgets. Can I add a widget without the need for all the Timeline as all I want is a button on the watch face to launch into my app. No data is updated over time so no need for all the extra timeline code.
1
0
617
Apr ’24
Watch app not listing in complication list of watch app in iPhone
We have an IOS app and its watch extension. The watch extension having complications as well created with clockKit Also we are providing a watch face with our custom complications for the user. Everything working fine watch series 6 and above Now we have an issue reported by a customer in watch series 3 (the watch Os version in 8.8), in which the watch face is not able to add as it showing the error "Watch Face Unavailable" So when we tried to create a another watch face for watch series 3, the complication list on the watch extension as well as the watch app of iPhone are not listing our app name Because of this issue we can't create a custom watch face for the watch series 3 with our complications So why the watch app in iPhone is not listing our watch app name in the list of complications Please update if anyone having similar issues
2
0
573
Feb ’24
How to reduce complication extension executable size?
Hello! I'm working on the watchOS app that provides user with multiple fancy complication sets. There are about 50 widgets in our WidgetBundle now. With this amount we reached memory limit and the app crashes: Thread 1: EXC_RESOURCE (RESOURCE_TYPE_MEMORY: high watermark memory limit exceeded) (limit=15 MB) I inspected complicationExtension.appex content and find out that most volume is occupied by the executable: Localized strings (12 langs) altogether - 165 KB Assets.car - 1.1 MB Imported fonts TTF files altogether - 866 KB complicationsExtension executable file - 8.2 MB Why it takes so much space and how can it be made smaller?
8
0
1.3k
Feb ’24
AccessoryInline complication reports full color rendering mode, but displays in monochrome
I'm in process of reimplementing my app in SwiftUI and WidgetKit. So far so good, I really like that I can finally use SwiftUI views for widgets. However, I'm having issues with AccessoryInline widget on Utility watch face. My old UtilitarianLarge complication displays in full color, but AccessoryInline widget displays only in gray - it's not even widgetAccentable on Utility watch face. I receive widgetRenderingMode from the Environment, and it shows fullColor. However, no matter how I try to apply color to the image or text, both stay gray. This widget family is not documented well (as many of things in WatchOS), and Google/ChatGPT/Bing produced zero usable results. It looks like it's a bug in WIdgetKit. If it's supposed to be displayed in Accented mode only, it should report as such in widgetRenderingMode (and support WidgetAccentable). Otherwise it should display in full color, just like the old complication.
0
0
471
Jan ’24
transferCurrentComplicationUserInfo(_:) works like transferUserInfo(_:)
Hey there, I'm implementing Watch Complications in an existing project, and I'm having the problem that transferCurrentComplicationUserInfo(_:) works exactly as transferUserInfo(_:) is described in the documentation, but not as it should. That is, when the WatchApp is opened, func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]) receives the data sent by transferCurrentComplicationUserInfo(_:). If not, the data is queued until the Watch App is opened again. In other words, transferCurrentComplicationUserInfo(_:) never wakes up the ExtensionDelegate when the Watch App is not running. Has anyone experienced the same thing and know how to fix it? More details: Testing on iPhone 11 (iOS 17.1.2) and Apple Watch SE (WatchOS 10.2) I made sure that the quota of 50 is not exhausted when I test. The WatchApp is still dual-target (I want to avoid having to migrate to single-target and SwiftUI lifecycle) Watch App code: class ExtensionDelegate: NSObject, WKExtensionDelegate, WCSessionDelegate { let session = WCSession.default override init() { super.init() if WCSession.isSupported() { session.delegate = self session.activate() } } func session(_ session: WCSession, didReceiveUserInfo userInfo: [String: Any] = [:]) { WatchWidgetSessionHandler.shared.processComplicationUserInfo(userInfo) } } IOS App code: class WatchAppDataManager: NSObject, WCSessionDelegate { override init() { super.init() let session = WCSession.default session.delegate = self session.activate() } func sendDataToWidget(for kinds: [WatchWidgetKind]) async { guard WCSession.default.activationState == .activated, WCSession.default.isComplicationEnabled else { return } let widgetsData = dataProvider.getData(for: kinds) if !widgetsData.isEmpty { WCSession.default.transferCurrentComplicationUserInfo(widgetsData) } } }
2
0
712
Mar ’24
Apple watch series 9 (OS 10.3) not showing up in xcode 15.1 under devices list.
When connecting my iphone (14pro with iOS 17.2.1) with a paired apple watch (series 9 with OS 10.3), it is not showing up on the devices/simulators list in xcode 15.1. Beyond unpairing/repairing the watch, restarting either iphone or watch, connecting/disconnecting the iphone from the computer or deleting xcode and re-installing xcode, any other suggestions? Under the WatchApp field it shows "no eligible device connected", however, under the console the Apple Watch does appear. I have tried just about everything and can't get the watch to appear in Xcode. I am running all this on a MacBook Pro with Sonoma. Thanks for any assistance!
0
0
740
Dec ’23
WidgetKit works in Simulator but not on device
I can't get the simplest Widget to work. I simply want to present the app's icon. It does what it's supposed to do in the simulator but on the actual device it only says "Please adopt containerBackground API" at the place where the Widget would have shown otherwise. I found out that I am supposed to add .containerBackground(Color.clear, for: .widget) for no reason at all to make this work. However, when I do that, I just get a gray circle where the app icon was supposed to show. The png files should be fine because again on the simulator it works so I have no idea what I am doing wrong. If someone can tell me what I'm doing wrong or if someone can share their Widget class that would be awesome - I literally only want to show my app's icon on the Watch face but I already fail at that, no idea why they made WidgetKit impossible to work with. import SwiftUI import WidgetKit struct IconEntry: TimelineEntry { let date = Date() let icon: Image } struct IconProvider: TimelineProvider { func placeholder(in context: Context) -> IconEntry { return IconEntry(icon: getImageForContext(context, color: false)) } func getSnapshot(in context: Context, completion: @escaping (IconEntry) -> ()) { let entry = IconEntry(icon: getImageForContext(context, color: false)) completion(entry) } func getTimeline(in context: Context, completion: @escaping (Timeline<Entry>) -> ()) { let entry = IconEntry(icon: getImageForContext(context, color: false)) let timeline = Timeline(entries: [entry], policy: .never) completion(timeline) } } struct IconWidget: Widget { let kind: String = "IconWidget" var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: IconProvider()) { entry in IconView() .containerBackground(Color.clear, for: .widget) } .supportedFamilies([.accessoryCircular, .accessoryCorner, .accessoryRectangular]) .description(Text("Show the app's icon on a watch face.")) } } struct InlineWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration(kind: "Inline", provider: IconProvider()) { entry in Text("App Title") .containerBackground(Color.clear, for: .widget) } .configurationDisplayName("App Title") .description("Description") .supportedFamilies([.accessoryInline]) } } func getImageForContext(_ context: TimelineProviderContext, color: Bool) -> Image { var fileNameToUse = "iconColor.png" if(!color) { fileNameToUse = "iconAlpha.png" } let displaySize = context.displaySize if(displaySize.width == 0 || displaySize.height == 0) { return Image(uiImage: .init()) } let uiImage = UIImage(imageLiteralResourceName: fileNameToUse).resizeImage(width: displaySize.width, height: displaySize.height) let image = Image(uiImage: uiImage) return image } struct IconView: View { @Environment(\.widgetRenderingMode) var widgetRenderingMode var body: some View { imageFor(widgetRenderingMode) .resizable() .onAppear { print("ICON VIEW \(widgetRenderingMode == .fullColor ? "COLOR" : "ALPHA")") } .containerBackground(Color.clear, for: .widget) } } private func imageFor(_ widgetRenderingMode: WidgetRenderingMode) -> Image { switch widgetRenderingMode { case .fullColor: return Image(uiImage: UIImage(imageLiteralResourceName: "iconColor.png")) default: return Image(uiImage: UIImage(imageLiteralResourceName: "iconAlpha.png")) } } @main struct IconBundle: WidgetBundle { @WidgetBundleBuilder var body: some Widget { IconWidget() InlineWidget() } } extension UIImage { func resizeImage(width: CGFloat, height: CGFloat) -> UIImage { let edgeLength = min(width, height) let newSize = CGSize(width: edgeLength, height: edgeLength) UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0) self.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height)) if let resizedImage = UIGraphicsGetImageFromCurrentImageContext() { UIGraphicsEndImageContext() return resizedImage } else { return UIImage() } } }
2
0
850
Dec ’23
Apple Watch Modular Ultra face clips text and affects font positioning
I'm seeing problems with the new Apple Watch Modular Ultra Watch face... This is all using the latest WatchOS 10.1 and with WidgetKit complications. (Have also tested with the new WatchOS 10.2 beta in the simulator) The Graphic Circular (accessoryCircular) complications space the numbers differently sometimes causing maximum and minimum numbers to look like one long number (see small circular complications in screenshot) The exact same complication in the accessoryRectangular on the Modular Ultra face clips text when it doesn't on any other watch face I've filed feedback FB13344580 Hopefully the screenshots show the issue well.
1
0
668
Nov ’23
Implementing Apple Watch Widget Complications
I am trying to add Widget Complications to an existing Apple Watch app. I added the WatchOS widgets extension and followed instructions to create static, non-updating complications to merely launch the app from the watch home screen. Here is my code in the widget extension: import WidgetKit import SwiftUI struct Provider: TimelineProvider { func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> Void) { } func getTimeline(in context: Context, completion: @escaping (Timeline<SimpleEntry>) -> Void) { } func placeholder(in context: Context) -> SimpleEntry { SimpleEntry(date: Date()) } func snapshot(in context: Context) async -> SimpleEntry { SimpleEntry(date: Date()) } } struct SimpleEntry: TimelineEntry { let date: Date } struct TrapScores_WidgetsEntryView : View { @Environment(\.widgetFamily) var widgetFamily var entry: Provider.Entry var body: some View { switch widgetFamily { case .accessoryCorner: ComplicationCorner() case .accessoryCircular: ComplicationCircular() case .accessoryRectangular: Text("TrapScores") case .accessoryInline: Text("TrapScores") @unknown default: //mandatory as there are more widget families as in lockscreen widgets etc Text("AppIcon") } } } @main struct TrapScores_Widgets: Widget { let kind: String = "TrapScores_Complications" var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: Provider()) { entry in TrapScores_WidgetsEntryView(entry: entry) .containerBackground(.fill.secondary, for: .widget) } .configurationDisplayName("TrapScores") .description("This will launch TrapScores App") .supportedFamilies([.accessoryCorner, .accessoryCircular]) } } struct ComplicationCircular: View { var body: some View { Image("Graphic Circular") .widgetAccentable(true) .unredacted() } } struct ComplicationCorner: View { var body: some View { Image("Graphic Circular") .widgetAccentable(true) .unredacted() } } #Preview(as: .accessoryCircular) { TrapScores_Widgets() } timeline: { SimpleEntry(date: .now) } The complications appear fine in the preview: The complication can be added to the watch face, but no graphic comes with it and it is a blank circle: Any suggestions on what I'm doing wrong?
3
1
695
Nov ’23
Help with Xcode 15 Watch Complication
2 years ago using Xcode 13, I created a phone app with a companion Watch app and it worked fine. This past month using Xcode 15, I created a new phone and companion app and everything is working with the following exception. From Xcode, my new app installs on the phone and watch, but my Watch app doesn't show up in the list of apps you can use as a launch complication on one of your watch faces. The app does show up in the launch screen for apps installed on the watch, so I assume the watch icon is generated properly. I started out using a single 1024x1024 app icon so I thought maybe I needed to create all variations of the icon before I'd see them as a complication option. I created all variations and loaded them in the Appicon asset. Still no luck. the one major difference between my Xcode 13 and Xcode 15 projects is the 15 project includes one watch app, where the 13 project includes the watch app and a WatchKit extension. my understanding is Xcode 14 and 15 don't use WatchKit Extension. So... what do I need to do to be able to add my Xcode 15 watch app icon to a watch face so I can launch the app from there?
2
0
1k
Oct ’23
Problem with image on WatchOS 10 Complication (WidgetKit)
I'm developing my app for WatchOS 10 with Xcode 15.0.1. I'm trying to make a complication with WidgetKit (SwiftUI) to make it easier the user to launch the app. I'm using a simple and small image 50x50px to test it first. But when I try to add to the Watch Face, it show a gray circle like there is nothing there. But when i'm editing the Watch Face it show the image :/, like the image bellow: And another problem is when is Accent mode, it fills the image with a gray color, as the image above shows it. I tryed to add monochrome png image with the alpha-channel, but even that didn't worked too. And my code is simpler has that: var body: some View { Image("Cat") } Someone is facing this same problem? Has any possible solution.
2
0
771
Oct ’23