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