// Apple-only learning file: iOS 17+ target with a suitable Xcode SDK. // Not compiled or run in this Windows/Linux review. import SwiftUI import Observation @Observable @MainActor final class WorkshopModel { private let capacity = 6 private(set) var booked = 0 private(set) var notice = "No request yet" var free: Int { capacity - booked } func request(_ amount: Int) { guard amount > 0, amount <= free else { notice = "Request refused; state unchanged"; return } booked += amount notice = "Accepted by this local model only" } } struct DemoView: View { @State private var model = WorkshopModel() var body: some View { VStack(spacing: 20) { Text("Places remaining: \(model.free)").font(.title) Button("Request two places") { model.request(2) } Text(model.notice) Text("In-memory teaching model only.").font(.caption) }.padding() } } @main struct WorkshopDemoApp: App { var body: some Scene { WindowGroup { DemoView() } } }