Home > AI > IOS > SwiftUI >

minimumScaleFactor(_:)

It explains the relationship between font size and text frame. If the text with initial font size exceeds the frame, then if this property is set, it will shrink the font size to fit the frame.

Example:

Text("good")
    .font(home.fontBody)
    .lineLimit(1)
    .minimumScaleFactor(0.01)
    .padding()
    .frame(width: home.defaultPadding*3, height: home.defaultPadding*3)
    .background(Color.red)

Leave a Reply