-
Notifications
You must be signed in to change notification settings - Fork 96
/
Copy pathSettings.swift
58 lines (53 loc) · 1.46 KB
/
Settings.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
//
// Settings.swift
// DesignCode
//
// Created by Mithun x on 7/15/19.
// Copyright © 2019 Mithun. All rights reserved.
//
import SwiftUI
struct Settings: View {
@State var receive = false
@State var number = 1
@State var selection = 1
@State var date = Date()
@State var email = ""
@State var submit = false
var body: some View {
NavigationView {
Form {
Toggle(isOn: $receive) {
Text("Recieve Notifications")
}
Stepper(value: $number, in: 1...10) {
Text("\(number) Notification\(number > 1 ? "s" : "") per week")
}
Picker(selection: $selection, label: Text("Favourite course")) {
Text("SwiftUI").tag(1)
Text("React").tag(2)
}
DatePicker(selection: $date, label: {
Text("Date")
})
Section(header: Text("Email")) {
TextField("Your email: ", text: $email)
.textFieldStyle(.roundedBorder)
}
Button(action: { self.submit.toggle() }) {
Text("Submit")
}
.alert(isPresented: $submit, content: {
Alert(title: Text("Thanks"), message: Text("Email: \(email)"))
})
}
.navigationBarTitle("Settings")
}
}
}
#if DEBUG
struct Settings_Previews: PreviewProvider {
static var previews: some View {
Settings()
}
}
#endif