如何让文本适合圆形 shape/image SwiftUI 的边界

How to have text fit within boundaries of circular shape/image SwiftUI

我似乎无法掌握如何确保我的文本覆盖并适合圆形图像的边界。这是我目前所拥有的。

Circle()
    .frame(width: 100, height: 100)
    .overlay(
        Text("Reaaaallllllyyyyyy Looooooongggggg")
            .foregroundColor(Color.red)
            .frame(minWidth: 0, maxWidth: .infinity)
        )

SwiftUI 中有没有办法让它工作?我将如何实现这一目标?

struct ClippedCircleView: View {
    @State var text: String = "Reaaaallllllyyyyyy Looooooongggggg"
    // Make this any number you are comfortable with
    @State var letterLimit: Int = 12
    var body: some View {
        
        Circle()
            .frame(width: 100, height: 100)
            .overlay(
                Text(text)
                    //Limit to 1 line until your letterLimit
                    .lineLimit(text.count <= letterLimit ? 1 : nil)
                    //Clips it to shape
                    .clipShape(ContainerRelativeShape()).padding()
                    .foregroundColor(Color.red)
                    //This makes super tiny letters so adjust to your use case
                    .minimumScaleFactor(0.1)
                
            )
    }
}