Normal behavior in apps and widgets : [.date, .time]
Use "multilineTextAlignment" on widgets : [.relative, .offset, .timer]
As of iOS 16.0 (20A5358a), ".timer" does not work in widgets and does not alignment.
There was a problem that the Timer was not aligned in the widget for a long time.
I thought this bug would be fixed someday, but one more bug was added.
This is a really disappointing result.
struct WZEntryView : View {
var entry: Provider.Entry
var body: some View {
VStack(alignment: .trailing) {
Text(entry.date, style: .date)
Text(entry.date, style: .time)
Text(entry.date, style: .relative)
Text(entry.date, style: .offset)
Text(entry.date, style: .timer) //<- not work on iOS 16.0 (20A5358a) widget
}
.multilineTextAlignment(.trailing) // Bypass bugs in widgets
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
.background(Color.gray)
}
}
[Test environment]
macOS : 13.0 (22A5331f)
XCode : 14.0 beta 6 (14A5294g)
iOS : 16.0 (20A5358a)