Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.87 KB | None | 0 0
  1. import SwiftUI
  2.  
  3. struct DrinkItem : View {
  4.    
  5.     var drink:Drink
  6.    
  7.     var body: some View {
  8.         VStack(alignment: .leading, spacing: 16.0) {
  9.         Image(drink.imageName)
  10.         .resizable()
  11.             .renderingMode(.original)
  12.         .aspectRatio(contentMode: . fill)
  13.         .frame(width: 300, height: 170)
  14.         .cornerRadius(10)
  15.         .shadow(radius: 10)
  16.         VStack() {
  17.             Text (drink.name)
  18.                 .color(.primary)
  19.                 .font(.headline)
  20.             Text(drink.description)
  21.                 .font(subheadline)
  22.                 .color(.secondary)
  23.                 .multilineTextAlignment(.leading)
  24.                 .lineLimit(2)
  25.                 .frame(height: 40)
  26.             }
  27.         }
  28.     }
  29. }
  30.  
  31. #if DEBUG
  32. struct DrinkItem_Previews : PreviewProvider {
  33.     static var previews: some View {
  34.         DrinkItem(drink: drinkData[0])
  35.     }
  36. }
  37. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement