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
List { | |
ForEach(viewModels) { viewModel in | |
BusinessCard(viewModel: viewModel) | |
} | |
} |
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
List(viewModels, id: \.imageName) { viewModel in | |
BusinessCard(viewModel: viewModel) | |
} |
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 BusinessCardList_Scroll: View { | |
let viewModels = [ | |
BusinessCardViewModel( | |
imageName: "man", | |
name: "Jack Doe", | |
occupation: "Plumber", | |
workplace: "Plumbers LLC" | |
), | |
BusinessCardViewModel( |
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 BusinessCardViewModel: Identifiable { | |
let id = UUID() | |
let imageName: String | |
let name: String | |
let occupation: String | |
let workplace: String | |
} |
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 BusinessCardList: View { | |
let viewModels = [ | |
BusinessCardViewModel( | |
imageName: "man", | |
name: "Jack Doe", | |
occupation: "Plumber", | |
workplace: "Plumbers LLC" | |
), | |
BusinessCardViewModel( |
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 BusinessCard: View { | |
// MARK: - Properties | |
private let viewModel: BusinessCardViewModel | |
// MARK: - Init | |
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 BusinessCardViewModel { | |
let imageName: String | |
let name: String | |
let occupation: String | |
let workplace: String | |
} |
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 BusinessCardList_Scroll: View { | |
var body: some View { | |
ScrollView { | |
VStack { | |
BusinessCard( | |
imageName: "man", | |
name: "Jack Doe", | |
occupation: "Plumber", |
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 BusinessCardList: View { | |
var body: some View { | |
List { | |
BusinessCard( | |
imageName: "man", | |
name: "Jack Doe", | |
occupation: "Plumber", | |
workplace: "Plumbers LLC" |
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 |
NewerOlder