Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created July 23, 2023 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/2b9d51601b5e8f2839bb6b29004dcb9c to your computer and use it in GitHub Desktop.
Save laevandus/2b9d51601b5e8f2839bb6b29004dcb9c to your computer and use it in GitHub Desktop.
// Before
struct RatingsView_Previews: PreviewProvider {
static var previews: some View {
VStack {
ForEach(0...5, id: \.self) { value in
RatingsView(value: .constant(value))
}
}
.previewLayout(.sizeThatFits)
}
}
// After
#Preview(traits: .sizeThatFitsLayout) {
VStack {
ForEach(0...5, id: \.self) { value in
RatingsView(value: .constant(value))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment