Implemented the showing of the LoginView view in the ContentView view.

This commit is contained in:
Javier Cicchelli 2022-12-11 22:50:21 +01:00
parent a2f7a7f0f7
commit c02e371adb

View File

@ -6,22 +6,42 @@
// Copyright © 2022 Röck+Cöde. All rights reserved.
//
import SwiftUI
import Browse
import DataModels
import Login
import KeychainStorage
import Profile
import SwiftUI
struct ContentView: View {
// MARK: Storages
@KeychainStorage(key: .KeychainStorage.account) private var account: Account?
// MARK: Body
var body: some View {
NavigationView {
BrowseView()
}
.sheet(isPresented: .constant(true)) {
ProfileView {}
.sheet(isPresented: showLogin) {
LoginView()
}
}
}
// MARK: - Helpers
private extension ContentView {
var showLogin: Binding<Bool> {
.init { account == nil } set: { _ in }
}
}
// MARK: - Previews
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()