Skip to content

Instantly share code, notes, and snippets.

@Rusti18
Rusti18 / ListWithForEach.swift
Created October 11, 2022 08:55
SwiftUIPT-Ep2-G10
List {
ForEach(viewModels) { viewModel in
BusinessCard(viewModel: viewModel)
}
}
@Rusti18
Rusti18 / NotIdentifiable.swift
Created October 11, 2022 08:09
SwiftUIPT-Ep2-G9
List(viewModels, id: \.imageName) { viewModel in
BusinessCard(viewModel: viewModel)
}
@Rusti18
Rusti18 / ScrollList.swift
Created October 11, 2022 07:26
SwiftUIPT-Ep2-G8
struct BusinessCardList_Scroll: View {
let viewModels = [
BusinessCardViewModel(
imageName: "man",
name: "Jack Doe",
occupation: "Plumber",
workplace: "Plumbers LLC"
),
BusinessCardViewModel(
@Rusti18
Rusti18 / BusinessCardViewModel.swift
Created October 11, 2022 07:20
SwiftUIPT-Ep2-G7
struct BusinessCardViewModel: Identifiable {
let id = UUID()
let imageName: String
let name: String
let occupation: String
let workplace: String
}
@Rusti18
Rusti18 / ListPreliminary.swift
Created October 11, 2022 06:53
SwiftUIPT-Ep2-G6
struct BusinessCardList: View {
let viewModels = [
BusinessCardViewModel(
imageName: "man",
name: "Jack Doe",
occupation: "Plumber",
workplace: "Plumbers LLC"
),
BusinessCardViewModel(
@Rusti18
Rusti18 / BusinessCard.swift
Created October 11, 2022 05:52
SwiftUIPT-Ep2-G5
import SwiftUI
struct BusinessCard: View {
// MARK: - Properties
private let viewModel: BusinessCardViewModel
// MARK: - Init
@Rusti18
Rusti18 / BusinessCardViewModel.swift
Created October 11, 2022 05:48
SwiftUI-PT-Ep2-G4
struct BusinessCardViewModel {
let imageName: String
let name: String
let occupation: String
let workplace: String
}
import SwiftUI
struct BusinessCardList_Scroll: View {
var body: some View {
ScrollView {
VStack {
BusinessCard(
imageName: "man",
name: "Jack Doe",
occupation: "Plumber",
@Rusti18
Rusti18 / BusinessCardList.swift
Created October 11, 2022 04:41
SwiftUIPT-Ep2-G2
import SwiftUI
struct BusinessCardList: View {
var body: some View {
List {
BusinessCard(
imageName: "man",
name: "Jack Doe",
occupation: "Plumber",
workplace: "Plumbers LLC"
@Rusti18
Rusti18 / card.swift
Last active October 10, 2022 13:26
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