Skip to content

Commit c8bb748

Browse files
bgoncalclaude
andcommitted
Fix empty user watch complications: keep icon bitmaps under WidgetKit limit
The ExtensionDelegate writer rasterized complication icons at 96pt (=192px @2x) and shipped the placeholder's RoundLogo at 1024px into the app-group payload. WidgetKit caps complication images at ~122px (measured in pixels), so archiving failed and every user complication — including gauge/ring ones — rendered empty. - Render user-complication icons at 56pt (=112px @2x), under the limit - Drop the placeholder/Assist raster icons from the payload (iconData = nil); the widget extension already renders its bundled, correctly-sized Logo and Assist symbol Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c005aeb commit c8bb748

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

Sources/WatchApp/ExtensionDelegate.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,9 @@ private enum WatchWidgetComplicationSnapshotStore {
360360
}
361361

362362
private struct WatchWidgetComplicationSnapshot: Codable {
363-
static let iconRenderSize = CGSize(width: 96, height: 96)
363+
// Watch screens are @2x, so this rasterizes to 112px — safely under WidgetKit's ~122px
364+
// complication-image archiving limit. Anything larger makes the complication render empty.
365+
static let iconRenderSize = CGSize(width: 56, height: 56)
364366

365367
let id: String
366368
let family: String
@@ -428,7 +430,8 @@ private struct WatchWidgetComplicationSnapshot: Codable {
428430
inlineText: "Home Assistant",
429431
fraction: nil,
430432
tint: nil,
431-
iconData: UIImage(named: "RoundLogo")?.pngData()
433+
// No icon payload: the widget extension renders its bundled (correctly sized) Logo asset.
434+
iconData: nil
432435
)
433436
}
434437

@@ -441,9 +444,8 @@ private struct WatchWidgetComplicationSnapshot: Codable {
441444
inlineText: AssistDefaultComplication.title,
442445
fraction: nil,
443446
tint: nil,
444-
iconData: MaterialDesignIcons.messageProcessingOutlineIcon
445-
.image(ofSize: iconRenderSize, color: AppConstants.tintColor)
446-
.pngData()
447+
// No icon payload: the widget extension renders its bundled Assist symbol via the fallback path.
448+
iconData: nil
447449
)
448450
}
449451

0 commit comments

Comments
 (0)