Skip to content

Instantly share code, notes, and snippets.

@CrystalKnightCodes
Created March 30, 2021 15:30
Show Gist options
  • Save CrystalKnightCodes/e92eb32f6e7f0b3e28c35e8ecd5d6d4b to your computer and use it in GitHub Desktop.
Save CrystalKnightCodes/e92eb32f6e7f0b3e28c35e8ecd5d6d4b to your computer and use it in GitHub Desktop.
Tabview Tutorial Result Card View
import SwiftUI
struct ResultCardView: View {
// MARK: - Properties
var vacation: Vacation
// MARK: - View
var body: some View {
HStack(alignment: .top) {
Image(systemName: vacation.imageName)
.resizable()
.renderingMode(.original) // So pics will have color
.aspectRatio(contentMode: .fit)
.frame(width: 150)
.frame(maxHeight: 200)
.padding()
.background(Color.gray.opacity(0.15) // For contrast
)
VStack(alignment: .leading) {
Text(vacation.name)
.bold()
ForEach(vacation.places, id: \.self) { place in
Text(place.name)
}
Spacer()
} //: VStack
.padding()
} //: HStack
.padding(.leading)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment