I need to make text fit within a frame. I have a view which is essentially a rectangular box with an image and text. If the text is too long I get "..." and the text is not in the view. How can I avoid this?
Here is my code:
var body: some View {
VStack(alignment: .center, spacing: 0) {
WebImage(url: URL(string: productData.product_image))
.resizable()
.aspectRatio(contentMode: .fit)
.cornerRadius(15)
.clipped()
.padding(5)
Text(productData.product_name)
.font(.title2)
.fontWeight(.bold)
.foregroundColor(.black)
.padding()
Text(productData.product_type)
.font(.caption)
.foregroundColor(.gray)
.lineLimit(2)
.padding()
}
.frame(width: 150, height: 200)
}