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?