Post

Replies

Boosts

Views

Activity

Scrumdinger CardView .previewLayout does not work
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 ?
3
0
1.2k
Apr ’23
Scrumdinger CardView .previewLayout does not work
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 ?
Replies
3
Boosts
0
Views
1.2k
Activity
Apr ’23