Just wondering if there is a way to apply a custom format for the DateStyle comp within SwiftUI's Text UI. For Example just the minutes or seconds like you would when using a DateFormatter. I want to display the dynamic dates for a Widget but it only offers a limited number of options. Why is this and has anyone found a way around this?
Apple talk more about Displaying Dynamic Dates here: https://developer.apple.com/documentation/widgetkit/keeping-a-widget-up-to-date
You won't like this answer, but as of iOS 14, the answer is there's no way to customize the relative style for
Text
. Therelative
style is new in iOS 14, and as always, Apple provide the bare minimum feature.For now, you have only these choices:
DateFormatter
(and other formatters) with the tradeoff that widget can only refresh couple of times in a dayHopefully this won't be the answer with iOS 15 or later.