Can't find any documentation of this issue.
One of my apps has a text view with a .minimumScaleFactor(0.5). This works perfectly in iOS 14.0.* - when the text would be wider than the view its scales nicely to fit - IE filling the full width of the screen.
Unfortunatly, in iOS 15 the .minimumScaleFactor seems to be being applied regardless of the size of the content. Strings that would require no scaling to fit are being scaled down.
Is this an undocumented change? Is there a new way to handle this that I am unaware of?
Code is below:
var body: some View {
VStack() {
HStack() {
Text(supplier.name ?? "Unknown Supplier")
.font(.title)
.lineLimit(1)
.allowsTightening(true)
.minimumScaleFactor(0.5)
Button(action: {}) {
Image(systemName: "star.fill")
.imageScale(.large)
}
}
}
}
Any help would be greatly appretiated.
EDIT - this seems to only be an issue on certain iphones - initial test on iPhone SE (2nd generation) iOS 15.
Setting the view as fixed using .fixedSize
worked for me.
In your case:
Text(supplier.name ?? "Unknown Supplier")
.font(.title)
.fixedSize(horizontal: false, vertical: true)
.lineLimit(1)
.allowsTightening(true)
.minimumScaleFactor(0.5)
Docs: https://developer.apple.com/documentation/swiftui/menu/fixedsize(horizontal:vertical:)