Skip to content

Instantly share code, notes, and snippets.

@Rusti18
Last active October 10, 2022 13:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rusti18/2e8893168b61f36d946566c0e97b2b5a to your computer and use it in GitHub Desktop.
Save Rusti18/2e8893168b61f36d946566c0e97b2b5a to your computer and use it in GitHub Desktop.
SwiftUIPT-Ep2-G1
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