Onboarding 페이지 추가
This commit is contained in:
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()
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user