Code: Select all
struct TestViewHStack: View {
let strings = ["Short", "some long text", "short"]
var body: some View {
HStack {
ForEach(strings, id: \.self) { title in
CardView(title: title)
.frame(maxWidth: .infinity)
}
}
}
}
struct CardView: View {
let title: String
var body: some View {
VStack(spacing: 8) {
Image(systemName: "star.fill")
.resizable()
.frame(width: 20, height: 20)
Text(title)
.font(.subheadline)
}
.padding(16)
.background(Color.white)
.clipShape(RoundedRectangle(cornerRadius: 16))
.shadow(color: .gray.opacity(0.2), radius: 8, x: 0, y: 2)
}
}
Ich dachte, die Einstellung. Auch versucht, mit Frames und FixedSize () Modifikatoren zu spielen, konnte aber nicht das gewünschte Ergebnis erzielen.
Danke!