WidgetKit Text Relative Dates don't update in .widgetLabel area

Relative Date labels on WatchOS complications do not update when in the .WidgetLabel section modifier. Am I missing anything?

For example if I want a .accessoryCircular complication in the top centre middle of the Infograph Watch Face, I can have maybe an Icon for the app in the circular slot and then use the .WidgetLabel modifier to display text. However, the Text(Date(), style: .relative) will not update in the WidgetLabel area, but it will update in main area. This is a bug I suspect. This same problem also exists with the .accessory corner complications and the WidgetLabel.

The best example of where this works fine currently in the WatchOS system is the Heart Rate complication. Here the WidgetLabel text shows the relative date. It also has formatting options for the date (like only showing minutes), none of this is available to third party developers.

Have tested this on the latest public releases of iOS, WatchOS & Xcode as well as the new iOS 17, WatchOS 10 and Xcode 15 Beta releases.

Example Code:

import SwiftUI 
import WidgetKit 
struct WatchWidget: Widget { 
    let kind: String = "WatchWidget" 
    var body: some WidgetConfiguration { 
        StaticConfiguration(kind: kind, provider: TimelineProvider()) { entry in 
            Text(Date(), style: .relative) 
                .widgetLabel { Text(Date(), style: .relative) }
     }
    .configurationDisplayName("WatchWidget")
    .description("WatchWidget")   
    .supportedFamilies([.accessoryCircular, .accessoryCorner]) 
    }
}
  • Have created a feedback FB12407543 on the basis that this is a bug...

Add a Comment