Hi all,
my code looks like:
import SwiftUI
struct CardView: View {
let scrum: DailyScrum
var body: some View {
Text(scrum.title)
.font(.headline)
}
}
struct CardView_Previews: PreviewProvider {
static var scrum = DailyScrum.sampleData[0]
static var previews: some View {
CardView(scrum: scrum)
.background(scrum.theme.mainColor)
.previewLayout(.fixed(width: 400, height: 60))
}
}
In web tutorial .previewLayout(.fixed(width: 400, height: 60)) is changing size of the preview. But not for me, I still have full size preview and with adding Spacer() like this:
struct CardView: View {
let scrum: DailyScrum
var body: some View {
VStack(alignment: .leading) {
Text(scrum.title)
.font(.headline)
Spacer()
HStack {
Label("\(scrum.attendees.count)", systemImage: "person.3")
}
}
}
}
the body will grow across whole phone preview. Where am I wrong please ?