Text with relative date - sizing bug when used in widget

When using a SwiftUI Text view with a relative date, with .minimumScaleFactor(), in a widget, the Text will always be shown at the minimum scale rather than the largest size possible. This started happening in iOS17, and is still the case in iOS18.

Therefore, if for example, you wanted to have a Text, showing a relative date in a countdown, with a "minimumScaleFactor" of 0.5, it will always show at 0.5 scale, no matter how much space there is available.

Text(.now, style: .relative)
                .font(.system(size: 80, weight: .bold, design: .rounded))
                .minimumScaleFactor(0.2)

^^ will always show at 0.2 scale (in a widget) even if there's space for much more.

This is only the case in widgets, not in the main app. Similarly, if you try to use "ViewThatFits" instead of "minimumScaleFactor", it will choose the smallest view, even if larger ones would fit.

Screenshot demonstrates the issue - all the countdown text views should be similarly large. This is not an issue with lack of vertical spacing causing the more flexible views to shrink - it behaves the same even if there's loads of vertical space too.

Maybe related, but trying to use ".fixedSize()" with a relative date Text view in a widget results in a completely blank widget.

Seems like a system bug rather than anything wrong in my code - I've logged it as Feedback (#15151577) with a demo project. Has anybody else come up against these issues - any solutions?

same problem arising in Text(Date,style : .timer) when using .minimumScaleFactor(0.1). Its just blank in widget This is definitely a bug . That too in iOS 18 RC. Any work around ??

Same with official iOS 18 release. See existing thread about known issue: https://forums.developer.apple.com/forums/thread/762658

What happens if you use the Timer with countsDown?

I'm seeing the same issue too. I've not found a workaround other than to remove minimumScaleFactor from all Text(style: .relative) and instead try to scale down other Text instead.

Apparently this is fixed in iOS 18.1 beta, but I'm getting too many bug reports to wait until that's released.

Text with relative date - sizing bug when used in widget
 
 
Q