Wasted about 3 hours on this yesterday.
I add a Text item in a field of a Form. Well and good. It wraps if needed, alights to the left a fixed amount no matter how much or how little text there is. All expected.
I added an image.
It alll went to hell after that as the text just sort of drew where it wanted to. It looked like the parent tile was now wider then the display area.
No amount of playing with Spacer(), padding, Frames. HStack alignments, Position fields, and so on did any good. as all I am trying to do a simple tile with a text block and image. And SwiftUI fights me every step of the way.
It's for a simple restaurant menu item tile. Name of item, price and image. If I drop the image, then it formats in a predictable fashion.
HStack{
VStack{
if let maindish = item["name"]{
Text("\(maindish)").foregroundColor(.primary).modifier(favoriteStyle()).fontWeight(.regular).font(.custom("Avenir",size:fontSize))
}
if let formattedPrice = item["formatted_price"]{
Text("\(formattedPrice)").foregroundColor(.secondary).modifier(favoriteStyle()).fontWeight(.bold).font(.custom("Avenir",size:fontSize))
}
}
Spacer()
if let imageURL = item["thumbnail_image"]{
if let url = URL(string:imageURL) {
drawImage(url:url, size:85.0).padding(0.0).padding(.trailing,75.00)
}
}
}