Created
January 6, 2020 16:08
-
-
Save keremk/7016761bd7c0b7fa5e9fb5de6162cedd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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