Finished the onboarding view

This commit is contained in:
Karol Zientek 2021-02-13 15:13:15 +01:00
parent 8761a4366f
commit f139250f6a
7 changed files with 46 additions and 13 deletions

View file

@ -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 = "<group>"; };
96A2D96425D6FEA6001CB109 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
96A2D96925D6FEBB001CB109 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
96A2D97A25D7003F001CB109 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
@ -77,6 +79,14 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
967B5B9625D813E2006ED944 /* Login */ = {
isa = PBXGroup;
children = (
967B5B9725D813F5006ED944 /* LoginView.swift */,
);
path = Login;
sourceTree = "<group>";
};
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;

View file

@ -11,7 +11,7 @@ import SwiftUI
struct wulkanowyApp: App {
var body: some Scene {
WindowGroup {
OnboardingView()
LoginView()
}
}
}

View file

@ -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";

View file

@ -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";

View file

@ -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()
}
}

View file

@ -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)

View file

@ -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
}
}
}
}