-
Notifications
You must be signed in to change notification settings - Fork 3
/
ContentView.swift
60 lines (51 loc) · 1.81 KB
/
ContentView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// ContentView.swift
// P10C CupcakeCorner
//
// Created by Julian Moorhouse on 12/03/2021.
//
import SwiftUI
struct ContentView: View {
@ObservedObject var cupCakes = CupCakes()
var body: some View {
NavigationView {
Form {
Section {
Picker("Select your cake type", selection: $cupCakes.order.type) {
ForEach(0 ..< Order.types.count, id: \.self) {
Text(Order.types[$0])
}
}
Stepper(value: $cupCakes.order.quantity, in: 3 ... 20) {
Text("Number of cakes: \(cupCakes.order.quantity)")
}
}
Section {
Toggle(isOn: $cupCakes.order.specialRequestEnabled.animation()) {
Text("Any special requests?")
}
if cupCakes.order.specialRequestEnabled {
Toggle(isOn: $cupCakes.order.extraFrosting) {
Text("Add extra frosting")
}
Toggle(isOn: $cupCakes.order.addSprinkles) {
Text("Add extra sprinkles")
}
}
}
Section {
NavigationLink(destination:
AddressView(cupCakes: cupCakes)) {
Text("Delivery details")
}
}
}
.navigationTitle("Cupcake Corner")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}