Archived
Put the next appointment on the Infograph bezel
The position asked for is the bezel slot: a circular complication plus a label that arcs across the top, where the tick marks otherwise are. ClockKit called that family graphicBezel; in WidgetKit it is an accessoryCircular widget with .widgetLabel attached. Nothing was attached, so that arc stayed empty while Apple's Calendar fills it — which is the difference that was visible on the watch and invisible in every check made here. All three circular kinds now carry it. Faces without a bezel slot ignore the label, so there is no cost to always providing it. cornerLabel becomes eventLabel: the same text serves the corner edge and the bezel arc, and the old name claimed otherwise. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
2c26be2ab5
commit
1a1230a796
@@ -26,7 +26,7 @@ struct CornerCountdownComplicationView: View {
|
||||
}
|
||||
}
|
||||
.widgetLabel {
|
||||
Text(WatchComplicationSupport.cornerLabel(next, at: entry.date, language: entry.language))
|
||||
Text(WatchComplicationSupport.eventLabel(next, at: entry.date, language: entry.language))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,18 @@ import SwiftUI
|
||||
import WidgetKit
|
||||
import CalendarrCore
|
||||
|
||||
/// Attaches the curved bezel label that a face with a bezel slot — Infograph —
|
||||
/// renders across the top, where the tick marks otherwise are. Faces without
|
||||
/// that slot ignore it, so it costs nothing to always provide.
|
||||
private extension View {
|
||||
func eventBezelLabel(_ entry: WatchComplicationEntry) -> some View {
|
||||
let next = WatchComplicationSupport.nextEvent(in: entry.snapshot, at: entry.date)
|
||||
return widgetLabel {
|
||||
Text(WatchComplicationSupport.eventLabel(next, at: entry.date, language: entry.language))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A draining ring plus the remaining time.
|
||||
struct CountdownComplicationView: View {
|
||||
let entry: WatchComplicationEntry
|
||||
@@ -32,6 +44,7 @@ struct CountdownComplicationView: View {
|
||||
}
|
||||
.gaugeStyle(.accessoryCircularCapacity)
|
||||
.widgetAccentable()
|
||||
.eventBezelLabel(entry)
|
||||
} else {
|
||||
ZStack {
|
||||
AccessoryWidgetBackground()
|
||||
@@ -82,6 +95,7 @@ struct DateComplicationView: View {
|
||||
}
|
||||
.gaugeStyle(.accessoryCircularCapacity)
|
||||
.widgetAccentable()
|
||||
.eventBezelLabel(entry)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,6 +126,7 @@ struct TodayCountComplicationView: View {
|
||||
}
|
||||
.gaugeStyle(.accessoryCircularCapacity)
|
||||
.widgetAccentable()
|
||||
.eventBezelLabel(entry)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,9 +89,15 @@ enum WatchComplicationSupport {
|
||||
return formatter.string(from: date).uppercased()
|
||||
}
|
||||
|
||||
/// The curved bezel label for a corner complication: time plus title, or a
|
||||
/// plain "no events".
|
||||
static func cornerLabel(_ event: SnapshotEvent?, at now: Date, language: String) -> String {
|
||||
/// The curved label that accompanies a circular or corner complication:
|
||||
/// time plus title, or a plain "no events".
|
||||
///
|
||||
/// On a corner this follows the screen edge. On a face with a bezel slot —
|
||||
/// Infograph — the same label arcs across the top, where the tick marks
|
||||
/// otherwise are. That is the position ClockKit called `graphicBezel`, and
|
||||
/// in WidgetKit it is reached by attaching `.widgetLabel` to an
|
||||
/// `accessoryCircular` widget.
|
||||
static func eventLabel(_ event: SnapshotEvent?, at now: Date, language: String) -> String {
|
||||
guard let event else { return WatchL10n.t("watch.no_events", language) }
|
||||
if event.isAllDay { return event.title }
|
||||
return "\(time(event.start, language: language)) \(event.title)"
|
||||
|
||||
Reference in New Issue
Block a user