Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import SwiftUI
- struct RecipeGridItem: View {
- var recipe: Recipe
- var body: some View {
- VStack {
- if let uiImage = UIImage(named: recipe.filename) {
- Image(uiImage: uiImage)
- .resizable()
- .aspectRatio(contentMode: .fill)
- .frame(width: 150, height: 150)
- .clipped()
- }
- Text(recipe.name)
- .font(.headline)
- .padding(.top, 5)
- }
- }
- }
- struct RecipeGridItem_Previews: PreviewProvider {
- static var previews: some View {
- let sampleRecipe = Recipe(id: 1, name: "Sample Recipe", filename: "sample.jpg", description: "This is a sample recipe description", estimatedTime: "30 mins")
- return RecipeGridItem(recipe: sampleRecipe)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement