Onboarding 페이지 추가
This commit is contained in:
@@ -14,6 +14,8 @@ struct ContentView: View {
|
||||
ZStack {
|
||||
Color.black.ignoresSafeArea()
|
||||
|
||||
MainView()
|
||||
|
||||
switch appState.appStep {
|
||||
case .splash:
|
||||
SplashView()
|
||||
|
@@ -17,7 +17,6 @@ enum UserDefaultsKey: String, CaseIterable {
|
||||
case nickname
|
||||
case pushToken
|
||||
case profileImage
|
||||
case voipPushToken
|
||||
case devicePushToken
|
||||
case isContentPlayLoop
|
||||
case isFollowedCreatorLive
|
||||
|
14
SodaLive/Sources/Font/Font.swift
Normal file
14
SodaLive/Sources/Font/Font.swift
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Font.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
enum Font: String {
|
||||
case bold = "GmarketSansBold"
|
||||
|
||||
case medium = "GmarketSansMedium"
|
||||
|
||||
case light = "GmarketSansLight"
|
||||
}
|
20
SodaLive/Sources/Main/HomeView.swift
Normal file
20
SodaLive/Sources/Main/HomeView.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// HomeView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct HomeView: View {
|
||||
var body: some View {
|
||||
Text("Home View")
|
||||
}
|
||||
}
|
||||
|
||||
struct HomeView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
HomeView()
|
||||
}
|
||||
}
|
32
SodaLive/Sources/Main/MainView.swift
Normal file
32
SodaLive/Sources/Main/MainView.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// MainView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct MainView: View {
|
||||
|
||||
@AppStorage("token") private var token: String = UserDefaults.string(forKey: UserDefaultsKey.token)
|
||||
@AppStorage("isViewedOnboardingView") private var isViewedOnboardingView: Bool = UserDefaults.bool(forKey: .isViewedOnboardingView)
|
||||
|
||||
var body: some View {
|
||||
if isViewedOnboardingView {
|
||||
if token.count > 0 {
|
||||
HomeView()
|
||||
} else {
|
||||
LoginView()
|
||||
}
|
||||
} else {
|
||||
OnboardingView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct MainView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MainView()
|
||||
}
|
||||
}
|
85
SodaLive/Sources/Onboarding/OnboardingView.swift
Normal file
85
SodaLive/Sources/Onboarding/OnboardingView.swift
Normal file
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// OnboardingView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingView: View {
|
||||
|
||||
@State private var selection = 0
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { proxy in
|
||||
ZStack {
|
||||
VStack(spacing: 0) {
|
||||
TabView(selection: $selection) {
|
||||
Image("img_guide_0")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.tag(0)
|
||||
|
||||
Image("img_guide_1")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.tag(1)
|
||||
|
||||
Image("img_guide_2")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.tag(2)
|
||||
|
||||
Image("img_guide_3")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.tag(3)
|
||||
|
||||
Image("img_guide_4")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.tag(4)
|
||||
|
||||
Image("img_guide_5")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.tag(5)
|
||||
|
||||
Image("img_guide_6")
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.tag(6)
|
||||
}
|
||||
.tabViewStyle(PageTabViewStyle())
|
||||
.onAppear {
|
||||
UIPageControl.appearance().pageIndicatorTintColor = UIColor(hex: "555555", alpha: 0.24)
|
||||
UIPageControl.appearance().currentPageIndicatorTintColor = UIColor(hex: "1313BC")
|
||||
}
|
||||
|
||||
Text("시작하기")
|
||||
.font(.custom(Font.bold.rawValue, size: 18.3))
|
||||
.foregroundColor(Color(hex: "1313BC"))
|
||||
.frame(width: screenSize().width, height: 60)
|
||||
.background(Color(hex: "80D8FF"))
|
||||
.onTapGesture {
|
||||
UserDefaults.set(true, forKey: .isViewedOnboardingView)
|
||||
}
|
||||
|
||||
if proxy.safeAreaInsets.bottom > 0 {
|
||||
Rectangle()
|
||||
.foregroundColor(Color(hex: "80D8FF"))
|
||||
.frame(width: proxy.size.width, height: 15.3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.ignoresSafeArea()
|
||||
}
|
||||
}
|
||||
|
||||
struct OnboardingView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
OnboardingView()
|
||||
}
|
||||
}
|
20
SodaLive/Sources/User/LoginView.swift
Normal file
20
SodaLive/Sources/User/LoginView.swift
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// LoginView.swift
|
||||
// SodaLive
|
||||
//
|
||||
// Created by klaus on 2023/08/09.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct LoginView: View {
|
||||
var body: some View {
|
||||
Text("Login View")
|
||||
}
|
||||
}
|
||||
|
||||
struct LoginView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
LoginView()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user