๐Ÿ”ธdata model

terms โŸฉ data model

import SwiftUI

// โญ๏ธ 1. define an observable object
class CreatureZoo : ObservableObject {
    // โญ๏ธ 2. publish its properties
    @Published var creatures = [
        Creature(name: "Gorilla", emoji: "๐Ÿฆ"),
        Creature(name: "Peacock", emoji: "๐Ÿฆš"),
    ]
}

struct Creature : Identifiable { ... }

Last updated

Was this helpful?