Skip to content

Commit c83f8cb

Browse files
author
Mithun
committedJul 15, 2019
Form and Controls
1 parent 6e99e16 commit c83f8cb

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed
 

‎DesignCode.xcodeproj/project.pbxproj

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
ABB215E022DB7F4700424B38 /* UpdateDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB215DF22DB7F4700424B38 /* UpdateDetail.swift */; };
1515
ABB215E222DC472900424B38 /* UpdateStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB215E122DC472900424B38 /* UpdateStore.swift */; };
1616
ABB215E422DC7D0000424B38 /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB215E322DC7D0000424B38 /* TabBar.swift */; };
17+
ABB215E622DC808A00424B38 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABB215E522DC808A00424B38 /* Settings.swift */; };
1718
ABE07CBF22D74F5700D209BE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE07CBE22D74F5700D209BE /* AppDelegate.swift */; };
1819
ABE07CC122D74F5700D209BE /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE07CC022D74F5700D209BE /* SceneDelegate.swift */; };
1920
ABE07CC322D74F5700D209BE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABE07CC222D74F5700D209BE /* ContentView.swift */; };
@@ -30,6 +31,7 @@
3031
ABB215DF22DB7F4700424B38 /* UpdateDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateDetail.swift; sourceTree = "<group>"; };
3132
ABB215E122DC472900424B38 /* UpdateStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UpdateStore.swift; sourceTree = "<group>"; };
3233
ABB215E322DC7D0000424B38 /* TabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = "<group>"; };
34+
ABB215E522DC808A00424B38 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
3335
ABE07CBB22D74F5700D209BE /* DesignCode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DesignCode.app; sourceTree = BUILT_PRODUCTS_DIR; };
3436
ABE07CBE22D74F5700D209BE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
3537
ABE07CC022D74F5700D209BE /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
@@ -75,6 +77,7 @@
7577
ABB215E322DC7D0000424B38 /* TabBar.swift */,
7678
ABE07CC222D74F5700D209BE /* ContentView.swift */,
7779
AB62172622D870540039BC73 /* Home.swift */,
80+
ABB215E522DC808A00424B38 /* Settings.swift */,
7881
ABB215DD22DB713300424B38 /* UpdateList.swift */,
7982
ABB215DF22DB7F4700424B38 /* UpdateDetail.swift */,
8083
ABB215E122DC472900424B38 /* UpdateStore.swift */,
@@ -176,6 +179,7 @@
176179
AB62172722D870540039BC73 /* Home.swift in Sources */,
177180
ABE07CC322D74F5700D209BE /* ContentView.swift in Sources */,
178181
ABB215DC22DB353800424B38 /* BlurView.swift in Sources */,
182+
ABB215E622DC808A00424B38 /* Settings.swift in Sources */,
179183
ABB215E422DC7D0000424B38 /* TabBar.swift in Sources */,
180184
);
181185
runOnlyForDeploymentPostprocessing = 0;

‎DesignCode/Settings.swift

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
//
2+
// Settings.swift
3+
// DesignCode
4+
//
5+
// Created by Mithun x on 7/15/19.
6+
// Copyright © 2019 Mithun. All rights reserved.
7+
//
8+
9+
import SwiftUI
10+
11+
struct Settings: View {
12+
13+
@State var receive = false
14+
@State var number = 1
15+
@State var selection = 1
16+
@State var date = Date()
17+
@State var email = ""
18+
@State var submit = false
19+
20+
var body: some View {
21+
NavigationView {
22+
Form {
23+
Toggle(isOn: $receive) {
24+
Text("Recieve Notifications")
25+
}
26+
Stepper(value: $number, in: /*@START_MENU_TOKEN@*/1...10/*@END_MENU_TOKEN@*/) {
27+
Text("\(number) Notification\(number > 1 ? "s" : "") per week")
28+
}
29+
Picker(selection: $selection, label: Text("Favourite course")) {
30+
Text("SwiftUI").tag(1)
31+
Text("React").tag(2)
32+
}
33+
DatePicker($date) {
34+
Text("Date")
35+
}
36+
Section(header: Text("Email")) {
37+
TextField("Your email: ", text: $email)
38+
.textFieldStyle(.roundedBorder)
39+
}
40+
Button(action: { self.submit.toggle() }) {
41+
Text("Submit")
42+
}
43+
.presentation($submit, alert: {
44+
Alert(title: Text("Thanks"), message: Text("Email: \(email)"))
45+
})
46+
}
47+
.navigationBarTitle("Settings")
48+
}
49+
}
50+
}
51+
52+
#if DEBUG
53+
struct Settings_Previews: PreviewProvider {
54+
static var previews: some View {
55+
Settings()
56+
}
57+
}
58+
#endif

‎DesignCode/TabBar.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ struct TabBar: View {
2121
Text("Certificates")
2222
}
2323
.tag(2)
24-
UpdateList().tabItem {
24+
Settings().tabItem {
2525
Image("IconSettings")
26-
Text("Updates")
26+
Text("Settings")
2727
}
2828
.tag(3)
2929
}

0 commit comments

Comments
 (0)
Please sign in to comment.