Created
March 30, 2021 15:30
-
-
Save CrystalKnightCodes/e92eb32f6e7f0b3e28c35e8ecd5d6d4b to your computer and use it in GitHub Desktop.
Tabview Tutorial Result Card View
This file contains 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
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