Browse Source

Sprint 1 y 2 iOS

Hector Carrion 4 years ago
parent
commit
c3aed47168

+ 8
- 0
Comedores Sociales.xcodeproj/project.pbxproj View File

@@ -15,6 +15,8 @@
15 15
 		3565338F25449C3800F2F0DE /* Comedores_Sociales.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 3565338D25449C3800F2F0DE /* Comedores_Sociales.xcdatamodeld */; };
16 16
 		3565339A25449C3800F2F0DE /* Comedores_SocialesTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3565339925449C3800F2F0DE /* Comedores_SocialesTests.swift */; };
17 17
 		356533A525449C3900F2F0DE /* Comedores_SocialesUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 356533A425449C3900F2F0DE /* Comedores_SocialesUITests.swift */; };
18
+		356533B92544A1AF00F2F0DE /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 356533B82544A1AF00F2F0DE /* LoginView.swift */; };
19
+		356533C42544B1FF00F2F0DE /* RegisterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 356533C32544B1FF00F2F0DE /* RegisterView.swift */; };
18 20
 /* End PBXBuildFile section */
19 21
 
20 22
 /* Begin PBXContainerItemProxy section */
@@ -49,6 +51,8 @@
49 51
 		356533A025449C3900F2F0DE /* Comedores SocialesUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Comedores SocialesUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
50 52
 		356533A425449C3900F2F0DE /* Comedores_SocialesUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Comedores_SocialesUITests.swift; sourceTree = "<group>"; };
51 53
 		356533A625449C3900F2F0DE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
54
+		356533B82544A1AF00F2F0DE /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
55
+		356533C32544B1FF00F2F0DE /* RegisterView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterView.swift; sourceTree = "<group>"; };
52 56
 /* End PBXFileReference section */
53 57
 
54 58
 /* Begin PBXFrameworksBuildPhase section */
@@ -101,6 +105,8 @@
101 105
 			children = (
102 106
 				3565338225449C3600F2F0DE /* Comedores_SocialesApp.swift */,
103 107
 				3565338425449C3600F2F0DE /* ContentView.swift */,
108
+				356533B82544A1AF00F2F0DE /* LoginView.swift */,
109
+				356533C32544B1FF00F2F0DE /* RegisterView.swift */,
104 110
 				3565338625449C3800F2F0DE /* Assets.xcassets */,
105 111
 				3565338B25449C3800F2F0DE /* Persistence.swift */,
106 112
 				3565339025449C3800F2F0DE /* Info.plist */,
@@ -265,8 +271,10 @@
265 271
 			isa = PBXSourcesBuildPhase;
266 272
 			buildActionMask = 2147483647;
267 273
 			files = (
274
+				356533B92544A1AF00F2F0DE /* LoginView.swift in Sources */,
268 275
 				3565338C25449C3800F2F0DE /* Persistence.swift in Sources */,
269 276
 				3565338525449C3600F2F0DE /* ContentView.swift in Sources */,
277
+				356533C42544B1FF00F2F0DE /* RegisterView.swift in Sources */,
270 278
 				3565338F25449C3800F2F0DE /* Comedores_Sociales.xcdatamodeld in Sources */,
271 279
 				3565338325449C3600F2F0DE /* Comedores_SocialesApp.swift in Sources */,
272 280
 			);

+ 21
- 0
Comedores Sociales/Assets.xcassets/logInImage.imageset/Contents.json View File

@@ -0,0 +1,21 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "filename" : "image1.jpg",
5
+      "idiom" : "universal",
6
+      "scale" : "1x"
7
+    },
8
+    {
9
+      "idiom" : "universal",
10
+      "scale" : "2x"
11
+    },
12
+    {
13
+      "idiom" : "universal",
14
+      "scale" : "3x"
15
+    }
16
+  ],
17
+  "info" : {
18
+    "author" : "xcode",
19
+    "version" : 1
20
+  }
21
+}

BIN
Comedores Sociales/Assets.xcassets/logInImage.imageset/image1.jpg View File


+ 1
- 1
Comedores Sociales/Comedores_SocialesApp.swift View File

@@ -13,7 +13,7 @@ struct Comedores_SocialesApp: App {
13 13
 
14 14
     var body: some Scene {
15 15
         WindowGroup {
16
-            ContentView()
16
+            LoginView()
17 17
                 .environment(\.managedObjectContext, persistenceController.container.viewContext)
18 18
         }
19 19
     }

+ 2
- 0
Comedores Sociales/ContentView.swift View File

@@ -8,6 +8,8 @@
8 8
 import SwiftUI
9 9
 import CoreData
10 10
 
11
+let lightGreyColor = Color(red: 239.0/255.0, green: 243.0/255.0, blue: 244.0/255.0, opacity: 1.0)
12
+
11 13
 struct ContentView: View {
12 14
     @Environment(\.managedObjectContext) private var viewContext
13 15
 

+ 98
- 0
Comedores Sociales/LoginView.swift View File

@@ -0,0 +1,98 @@
1
+//
2
+//  LogIn.swift
3
+//  Comedores Sociales
4
+//
5
+//  Created by Hector Carrion on 10/24/20.
6
+//
7
+
8
+import SwiftUI
9
+
10
+struct LoginView: View {
11
+    @State var email: String = ""
12
+    @State var password: String = ""
13
+    @State var showingRegister: Bool = false
14
+    
15
+    var body: some View {
16
+        VStack {
17
+            WelcomeImage()
18
+            WelcomeText()
19
+            
20
+            TextField("Email", text: $email)
21
+                .autocapitalization(.none)
22
+                .padding()
23
+                .background(lightGreyColor)
24
+                .cornerRadius(5.0)
25
+                .padding(.bottom, 5)
26
+            SecureField("Password", text: $password)
27
+                .autocapitalization(.none)
28
+                .padding()
29
+                .background(lightGreyColor)
30
+                .cornerRadius(5.0)
31
+                .padding(.bottom, 20)
32
+            
33
+            Button(action: {print("login tapped")}) {
34
+                LoginText()
35
+            }
36
+            
37
+            Button(action: {self.showingRegister.toggle()}) {
38
+                RegisterText()
39
+            }.sheet(isPresented: $showingRegister, content: {
40
+                RegisterView()
41
+            })
42
+            
43
+        }
44
+        .padding()
45
+    }
46
+}
47
+
48
+struct LogInView_Previews: PreviewProvider {
49
+    static var previews: some View {
50
+        LoginView()
51
+    }
52
+}
53
+
54
+struct WelcomeText: View {
55
+    var body: some View {
56
+        Text("Comedores Sociales")
57
+            .font(.largeTitle)
58
+            .fontWeight(.semibold)
59
+            .padding(.bottom, 20)
60
+    }
61
+}
62
+
63
+struct WelcomeImage: View {
64
+    var body: some View {
65
+        Image("logInImage")
66
+            .resizable()
67
+            .aspectRatio(contentMode: .fill)
68
+            .frame(width: 150, height: 150)
69
+            .clipped()
70
+            //.cornerRadius(150)
71
+            //.padding(.bottom, 75)
72
+    }
73
+}
74
+
75
+struct LoginText: View {
76
+    var body: some View {
77
+        Text("Login")
78
+            .font(.headline)
79
+            .foregroundColor(.white)
80
+            .padding()
81
+            .frame(width: 220, height: 50)
82
+            .background(Color.blue)
83
+            .cornerRadius(5)
84
+            .padding(.bottom, 5)
85
+    }
86
+}
87
+
88
+struct RegisterText: View {
89
+    var body: some View {
90
+        Text("Don't have an account? Register")
91
+            .font(.headline)
92
+            .foregroundColor(.gray)
93
+            .padding()
94
+            .frame(width: 350, height: 50)
95
+            .background(Color.clear)
96
+            .cornerRadius(5)
97
+    }
98
+}

+ 74
- 0
Comedores Sociales/RegisterView.swift View File

@@ -0,0 +1,74 @@
1
+//
2
+//  RegisterView.swift
3
+//  Comedores Sociales
4
+//
5
+//  Created by Hector Carrion on 10/24/20.
6
+//
7
+
8
+import SwiftUI
9
+
10
+struct RegisterView: View {
11
+    @State var firstName: String = ""
12
+    @State var lastName: String = ""
13
+    @State var phoneNumber: String = ""
14
+    @State var email: String = ""
15
+    @State var password: String = ""
16
+    
17
+    var body: some View {
18
+        VStack {
19
+            Text("Details")
20
+                .font(.largeTitle)
21
+                .fontWeight(.semibold)
22
+                .frame(width: 350, height: 25, alignment: .topLeading)
23
+                .padding(.bottom, 20)
24
+            
25
+            TextField("First Name", text: $firstName)
26
+                .padding()
27
+                .background(lightGreyColor)
28
+                .cornerRadius(5.0)
29
+                .padding(.bottom, 5)
30
+            TextField("Last Name", text: $lastName)
31
+                .padding()
32
+                .background(lightGreyColor)
33
+                .cornerRadius(5.0)
34
+                .padding(.bottom, 5)
35
+            TextField("Phone Number", text: $phoneNumber)
36
+                .keyboardType(.numberPad)
37
+                .padding()
38
+                .background(lightGreyColor)
39
+                .cornerRadius(5.0)
40
+                .padding(.bottom, 5)
41
+            TextField("Email", text: $email)
42
+                .autocapitalization(.none)
43
+                .padding()
44
+                .background(lightGreyColor)
45
+                .cornerRadius(5.0)
46
+                .padding(.bottom, 5)
47
+            SecureField("Password", text: $password)
48
+                .autocapitalization(.none)
49
+                .padding()
50
+                .background(lightGreyColor)
51
+                .cornerRadius(5.0)
52
+                .padding(.bottom, 20)
53
+            
54
+            Button(action: {print("register tapped")}) {
55
+                Text("Register")
56
+                    .font(.headline)
57
+                    .foregroundColor(.white)
58
+                    .padding()
59
+                    .frame(width: 220, height: 50)
60
+                    .background(Color.blue)
61
+                    .cornerRadius(5)
62
+                    .padding(.bottom, 5)
63
+            }
64
+            
65
+            
66
+        }.padding()
67
+    }
68
+}
69
+
70
+struct RegisterView_Previews: PreviewProvider {
71
+    static var previews: some View {
72
+        RegisterView()
73
+    }
74
+}