From f139250f6a78d09020808f5f38102221359609c7 Mon Sep 17 00:00:00 2001 From: Karol Zientek Date: Sat, 13 Feb 2021 15:13:15 +0100 Subject: [PATCH] Finished the onboarding view --- wulkanowy.xcodeproj/project.pbxproj | 12 +++++++++ wulkanowy/App/wulkanowyApp.swift | 2 +- .../Resources/en.lproj/Localizable.strings | 2 +- .../Resources/pl.lproj/Localizable.strings | 2 +- wulkanowy/Views/Login/LoginView.swift | 26 +++++++++++++++++++ .../Onboarding/OnboardingButtonView.swift | 7 +++-- .../Views/Onboarding/OnboardingView.swift | 8 ------ 7 files changed, 46 insertions(+), 13 deletions(-) create mode 100644 wulkanowy/Views/Login/LoginView.swift diff --git a/wulkanowy.xcodeproj/project.pbxproj b/wulkanowy.xcodeproj/project.pbxproj index 2d21481..9c470c8 100644 --- a/wulkanowy.xcodeproj/project.pbxproj +++ b/wulkanowy.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 967B5B9825D813F5006ED944 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 967B5B9725D813F5006ED944 /* LoginView.swift */; }; 96A2D96325D6FEA6001CB109 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 96A2D96525D6FEA6001CB109 /* Localizable.strings */; }; 96A2D97B25D7003F001CB109 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A2D97A25D7003F001CB109 /* OnboardingView.swift */; }; 96A2D98825D73DCF001CB109 /* OnboardingButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96A2D98725D73DCF001CB109 /* OnboardingButtonView.swift */; }; @@ -35,6 +36,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 967B5B9725D813F5006ED944 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; 96A2D96425D6FEA6001CB109 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 96A2D96925D6FEBB001CB109 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = ""; }; 96A2D97A25D7003F001CB109 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = ""; }; @@ -77,6 +79,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 967B5B9625D813E2006ED944 /* Login */ = { + isa = PBXGroup; + children = ( + 967B5B9725D813F5006ED944 /* LoginView.swift */, + ); + path = Login; + sourceTree = ""; + }; 96A2D95625D6FE4D001CB109 /* App */ = { isa = PBXGroup; children = ( @@ -96,6 +106,7 @@ 96A2D96D25D6FF29001CB109 /* Views */ = { isa = PBXGroup; children = ( + 967B5B9625D813E2006ED944 /* Login */, 96A2D97925D7002D001CB109 /* Onboarding */, ); path = Views; @@ -302,6 +313,7 @@ files = ( F4C6D9082544E17400F8903A /* wulkanowyApp.swift in Sources */, 96A2D97B25D7003F001CB109 /* OnboardingView.swift in Sources */, + 967B5B9825D813F5006ED944 /* LoginView.swift in Sources */, 96A2D98825D73DCF001CB109 /* OnboardingButtonView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/wulkanowy/App/wulkanowyApp.swift b/wulkanowy/App/wulkanowyApp.swift index 3cd86d5..3b455e6 100644 --- a/wulkanowy/App/wulkanowyApp.swift +++ b/wulkanowy/App/wulkanowyApp.swift @@ -11,7 +11,7 @@ import SwiftUI struct wulkanowyApp: App { var body: some Scene { WindowGroup { - OnboardingView() + LoginView() } } } diff --git a/wulkanowy/Resources/en.lproj/Localizable.strings b/wulkanowy/Resources/en.lproj/Localizable.strings index a8934a6..e167679 100644 --- a/wulkanowy/Resources/en.lproj/Localizable.strings +++ b/wulkanowy/Resources/en.lproj/Localizable.strings @@ -10,4 +10,4 @@ "onboarding.description.title" = "Keep track of your educational progress with Wulkanowy app!"; "onboarding.description.content" = "Wulkanowy allows you to view your grades, attendance, messages from teachers and many more!"; -"onboarding.start" = "Start!"; +"onboarding.continue" = "Continue"; diff --git a/wulkanowy/Resources/pl.lproj/Localizable.strings b/wulkanowy/Resources/pl.lproj/Localizable.strings index 09af0cb..6b8b3b3 100644 --- a/wulkanowy/Resources/pl.lproj/Localizable.strings +++ b/wulkanowy/Resources/pl.lproj/Localizable.strings @@ -10,4 +10,4 @@ "onboarding.description.title" = "Śledź swoje postępy w nauce za pomocą Wulkanowego!"; "onboarding.description.content" = "Wulkanowy pozwala Tobie na sprawdzenie swoich ocen, frewkwencji, wiadomości od nauczycieli i wiele więcej!"; -"onboarding.start" = "Start!"; +"onboarding.continue" = "Kontynuuj"; diff --git a/wulkanowy/Views/Login/LoginView.swift b/wulkanowy/Views/Login/LoginView.swift new file mode 100644 index 0000000..926f09c --- /dev/null +++ b/wulkanowy/Views/Login/LoginView.swift @@ -0,0 +1,26 @@ +// +// LoginView.swift +// wulkanowy +// +// Created by Karol Zientek on 13/02/2021. +// + +import SwiftUI + +struct LoginView: View { + + @AppStorage("needsAppOnboarding") private var needsAppOnboarding: Bool = true + + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + .sheet(isPresented: $needsAppOnboarding) { + OnboardingView() + } + } +} + +struct LoginView_Previews: PreviewProvider { + static var previews: some View { + LoginView() + } +} diff --git a/wulkanowy/Views/Onboarding/OnboardingButtonView.swift b/wulkanowy/Views/Onboarding/OnboardingButtonView.swift index a53e9f0..dde6c5e 100644 --- a/wulkanowy/Views/Onboarding/OnboardingButtonView.swift +++ b/wulkanowy/Views/Onboarding/OnboardingButtonView.swift @@ -8,11 +8,14 @@ import SwiftUI struct OnboardingButtonView: View { + + @AppStorage("needsAppOnboarding") var needsAppOnboarding: Bool = true + var body: some View { Button(action: { - print("Exit the onboarding") + needsAppOnboarding = false }, label: { - Text("onboarding.start") + Text("onboarding.continue") }) .padding(10) .frame(minWidth: 0, maxWidth: .infinity) diff --git a/wulkanowy/Views/Onboarding/OnboardingView.swift b/wulkanowy/Views/Onboarding/OnboardingView.swift index 146f95b..7736b27 100644 --- a/wulkanowy/Views/Onboarding/OnboardingView.swift +++ b/wulkanowy/Views/Onboarding/OnboardingView.swift @@ -9,8 +9,6 @@ import SwiftUI struct OnboardingView: View { - @State private var isAnimating: Bool = false - var body: some View { VStack(spacing: 20) { Spacer() @@ -18,7 +16,6 @@ struct OnboardingView: View { .resizable() .frame(width: 200, height: 200, alignment: .top) .foregroundColor(Color("OnboardingColor")) - .scaleEffect(isAnimating ? 1.0 : 0.6) VStack(spacing: 20) { Text("onboarding.description.title") .font(.headline) @@ -32,11 +29,6 @@ struct OnboardingView: View { OnboardingButtonView() .padding() } - .onAppear { - withAnimation(.easeOut(duration: 0.5)) { - isAnimating = true - } - } } }