Last active
October 10, 2022 13:26
-
-
Save Rusti18/2e8893168b61f36d946566c0e97b2b5a to your computer and use it in GitHub Desktop.
SwiftUIPT-Ep2-G1
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
struct BusinessCard: View { | |
// MARK: - Properties | |
private let imageName: String | |
private let name: String | |
private let occupation: String | |
private let workplace: String | |
// MARK: - Init | |
init(imageName: String, name: String, occupation: String, workplace: String) { | |
self.imageName = imageName | |
self.name = name | |
self.occupation = occupation | |
self.workplace = workplace | |
} | |
... | |
var body: some View { | |
HStack(spacing: Constants.imageToLabelsSpacing) { | |
Image(imageName) | |
... | |
Text(name) | |
... | |
Text(occupation) | |
.font(.system(size: Constants.occupationFontHeight, weight: .regular)) | |
... | |
Text(workplace) | |
... | |
} | |
} | |
struct BusinessCard_Previews: PreviewProvider { | |
static var previews: some View { | |
BusinessCard( | |
imageName: "man", | |
name: "John Doe", | |
occupation: "Attorney at law", | |
workplace: "Berkeley Ltd." | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment