changeset 307:8a43331473e1

Implementing HomeView
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Wed, 24 Mar 2021 23:09:58 +0100
parents 4f9bbc48a6d3
children a47f538ae4e4
files LazyBear/Assets.xcassets/Memojis/Contents.json LazyBear/Assets.xcassets/Memojis/testMemoji.imageset/Contents.json LazyBear/Assets.xcassets/Memojis/testMemoji.imageset/testMemoji.png LazyBear/Assets.xcassets/Themes/default.colorset/Contents.json LazyBear/ContentView.swift LazyBear/Views/Home/Helpers/UserHelper.swift LazyBear/Views/Home/Helpers/WatchlistPreviewHelper.swift LazyBear/Views/Home/HomeView.swift LazyBear/Views/Onboarding/WelcomeView.swift LazyBear/Views/Onboarding/WhatsNewView.swift
diffstat 10 files changed, 196 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Assets.xcassets/Memojis/Contents.json	Wed Mar 24 23:09:58 2021 +0100
@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Assets.xcassets/Memojis/testMemoji.imageset/Contents.json	Wed Mar 24 23:09:58 2021 +0100
@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "filename" : "testMemoji.png",
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
Binary file LazyBear/Assets.xcassets/Memojis/testMemoji.imageset/testMemoji.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Assets.xcassets/Themes/default.colorset/Contents.json	Wed Mar 24 23:09:58 2021 +0100
@@ -0,0 +1,38 @@
+{
+  "colors" : [
+    {
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.620",
+          "green" : "0.267",
+          "red" : "0.098"
+        }
+      },
+      "idiom" : "universal"
+    },
+    {
+      "appearances" : [
+        {
+          "appearance" : "luminosity",
+          "value" : "dark"
+        }
+      ],
+      "color" : {
+        "color-space" : "srgb",
+        "components" : {
+          "alpha" : "1.000",
+          "blue" : "0.996",
+          "green" : "0.729",
+          "red" : "0.290"
+        }
+      },
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}
--- a/LazyBear/ContentView.swift	Wed Mar 24 15:13:18 2021 +0100
+++ b/LazyBear/ContentView.swift	Wed Mar 24 23:09:58 2021 +0100
@@ -9,7 +9,23 @@
 
 struct ContentView: View {
     var body: some View {
-        Text("Hello world")
+        TabView {
+            HomeView()
+                .tabItem {
+                    Image(systemName: "house")
+                    Text("Home")
+                }
+            Text("Another Tab")
+                .tabItem {
+                    Image(systemName: "2.square.fill")
+                    Text("Second")
+                }
+            Text("The Last Tab")
+                .tabItem {
+                    Image(systemName: "3.square.fill")
+                    Text("Third")
+                }
+        }
     }
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Views/Home/Helpers/UserHelper.swift	Wed Mar 24 23:09:58 2021 +0100
@@ -0,0 +1,51 @@
+//
+//  UserHelper.swift
+//  LazyBear
+//
+//  Created by Dennis Concepción Martín on 24/3/21.
+//
+
+import SwiftUI
+
+struct UserHelper: View {
+    var body: some View {
+        GeometryReader { geo in
+            HStack {
+                UserImage()
+                    .frame(height: geo.size.height * 0.1)
+                    .padding(.horizontal)
+                
+                VStack(alignment: .leading) {
+                    Text("Hello, Dennis!")
+                        .font(.title)
+                        .fontWeight(.semibold)
+                    
+                    Text("How is the market doing today?")
+                        .opacity(0.5)
+                }
+            }
+        }
+    }
+}
+
+struct UserImage: View {
+    var body: some View {
+        RoundedRectangle(cornerRadius: 20)
+            .aspectRatio(1.0, contentMode: .fit)
+            .foregroundColor(Color("default"))
+            .opacity(0.3)
+            .overlay(
+                Image("testMemoji")
+                    .resizable()
+                    .aspectRatio(1.0, contentMode: .fit)
+                    .cornerRadius(20)
+                    .padding(5)
+            )
+    }
+}
+
+struct UserHelper_Previews: PreviewProvider {
+    static var previews: some View {
+        UserHelper()
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Views/Home/Helpers/WatchlistPreviewHelper.swift	Wed Mar 24 23:09:58 2021 +0100
@@ -0,0 +1,20 @@
+//
+//  WatchlistPreviewHelper.swift
+//  LazyBear
+//
+//  Created by Dennis Concepción Martín on 24/3/21.
+//
+
+import SwiftUI
+
+struct WatchlistPreviewHelper: View {
+    var body: some View {
+        RoundedRectangle(cornerRadius: 20)
+    }
+}
+
+struct WatchlistPreviewHelper_Previews: PreviewProvider {
+    static var previews: some View {
+        WatchlistPreviewHelper()
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LazyBear/Views/Home/HomeView.swift	Wed Mar 24 23:09:58 2021 +0100
@@ -0,0 +1,29 @@
+//
+//  HomeView.swift
+//  LazyBear
+//
+//  Created by Dennis Concepción Martín on 24/3/21.
+//
+
+import SwiftUI
+
+struct HomeView: View {
+    @State private var searchText = ""
+    
+    var body: some View {
+    NavigationView {
+        GeometryReader { geo in
+            VStack {
+                UserHelper()
+                    .padding(.top)
+                }
+            }
+        }
+    }
+}
+
+struct HomeView_Previews: PreviewProvider {
+    static var previews: some View {
+        HomeView()
+    }
+}
--- a/LazyBear/Views/Onboarding/WelcomeView.swift	Wed Mar 24 15:13:18 2021 +0100
+++ b/LazyBear/Views/Onboarding/WelcomeView.swift	Wed Mar 24 23:09:58 2021 +0100
@@ -13,7 +13,7 @@
     
     var body: some View {
         if showingNextView {
-            SignUp()
+            WhatsNewView()
         } else {
             GeometryReader { geo in
                 VStack(alignment: .leading) {
@@ -27,7 +27,7 @@
                     Group {
                         Text("Welcome to")
                         Text("Lazybear")
-                            .foregroundColor(.blue)
+                            .foregroundColor(Color("default"))
                             .offset(y: -15)
                             .padding(.bottom, -15)
                     }
--- a/LazyBear/Views/Onboarding/WhatsNewView.swift	Wed Mar 24 15:13:18 2021 +0100
+++ b/LazyBear/Views/Onboarding/WhatsNewView.swift	Wed Mar 24 23:09:58 2021 +0100
@@ -62,6 +62,7 @@
             }
         } else {
             ContentView()
+                .transition(.asymmetric(insertion: .scale, removal: .opacity))
         }
     }
 }
@@ -106,7 +107,13 @@
     var body: some View {
         HStack {
             Spacer()
-            Button(action: { self.showContentView = true }) {
+            Button(action: {
+//                writeUserDefaults()
+                withAnimation {
+                    self.showContentView = true
+                    
+                }
+            }) {
                 RoundedRectangle(cornerRadius: 10)
                     .foregroundColor(.blue)
                     .frame(height: 50)
@@ -120,8 +127,8 @@
         }
     }
     
-//    func writeUserDefaults() {
-//        let defaults = UserDefaults.standard
-//        defaults.setValue(true, forKey: "IsAppAlreadyLaunchedOnce")
-//    }
+    func writeUserDefaults() {
+        let defaults = UserDefaults.standard
+        defaults.setValue(true, forKey: "IsAppAlreadyLaunchedOnce")
+    }
 }