Skip to content

Instantly share code, notes, and snippets.

@keremk
Created January 6, 2020 16:08
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 keremk/7016761bd7c0b7fa5e9fb5de6162cedd to your computer and use it in GitHub Desktop.
Save keremk/7016761bd7c0b7fa5e9fb5de6162cedd to your computer and use it in GitHub Desktop.
struct MovieRow: View {
var movie: Movie
var body: some View {
HStack {
MoviePoster(imageName: movie.posterName)
.frame(width: 97.5, height: 146.25, alignment: Alignment.center)
VStack(alignment: .leading) {
...
}
}
.frame(width: nil, height: 180, alignment: .center)
.background(Color(.systemBackground))
}
}
#if DEBUG
struct MovieRow_Previews: PreviewProvider {
static var previews: some View {
let movies = MovieCollection().fetchMovies()
return ForEach(ColorScheme.allCases, id: \.self) { colorScheme in
Group {
MovieRow(movie: movies[0])
MovieRow(movie: movies[2])
}
.environment(\.colorScheme, colorScheme)
.previewDisplayName("Color scheme: \(colorScheme)")
}
.previewLayout(.sizeThatFits)
.environmentObject(EnvironmentConfig(mode: .PreviewMode))
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment