2020-04-25 15:44:54 +01:00
|
|
|
//
|
|
|
|
// Router.swift
|
2022-08-07 13:31:15 +01:00
|
|
|
// Mixonomer
|
2020-04-25 15:44:54 +01:00
|
|
|
//
|
|
|
|
// Created by Andy Pack on 25/04/2020.
|
|
|
|
// Copyright © 2020 Sarsoo. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
2020-04-26 00:11:07 +01:00
|
|
|
// Root level view loaded by delegate to show either main app or login screen
|
2020-04-25 15:44:54 +01:00
|
|
|
struct Router: View {
|
|
|
|
|
|
|
|
@EnvironmentObject var liveUser: LiveUser
|
|
|
|
|
|
|
|
@ViewBuilder
|
|
|
|
var body: some View {
|
|
|
|
if liveUser.loggedIn {
|
|
|
|
AppSkeleton()
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
LoginScreen()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Router_Previews: PreviewProvider {
|
|
|
|
static var previews: some View {
|
|
|
|
Router()
|
2022-08-10 23:18:22 +01:00
|
|
|
.environmentObject(LiveUser(playlists: [], tags: [], username: "user", loggedIn: false))
|
2020-04-25 15:44:54 +01:00
|
|
|
}
|
|
|
|
}
|