
И что я хочу иметь:

Я пробовал использовать GeometryReader, но не знаю, хорошее ли это решение, или я не знаю, как его использовать, но получаю следующее:

Код основного представления:
Код: Выделить всё
struct CardHomeContent: View {
var body: some View {
ZStack {
RoundedRectangle(cornerRadius: /*@START_MENU_TOKEN@*/25.0/*@END_MENU_TOKEN@*/)
HStack(spacing:0) { //Contenido
ImageContent(image:"Croissant")
TextCardContent()
}
}
.clipShape(RoundedRectangle(cornerRadius: 25))
.padding(.horizontal)
}
}
Код: Выделить всё
struct ImageContent: View {
let image : String
var body: some View {
ZStack {
Image(image)
.resizable()
.scaledToFill()
}
}
}
Код: Выделить всё
struct TextCardContent: View {
let uiFont: UIFont = .systemFont(ofSize: 13)
let description = "Unos croissants que harán chuparte los dedos llenos de mantequilla"
var justifiedTest: String {
description.justified(font: uiFont, maxWidth: 165)
}
var body: some View {
ZStack {
RoundedRectangleCustomShapeRight().foregroundStyle(Color.white)
HStack {
VStack {
Text("Croissants tradicionales").bold().lineLimit(2).minimumScaleFactor(0.4)
Text(description).font(.footnote).foregroundStyle(Color.gray).lineLimit(3).minimumScaleFactor(0.5)
.multilineTextAlignment(.leading)
}
.padding(.all)
Text(">")
.padding(.trailing)
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/781 ... in-a-stack
Мобильная версия