Implemented the showing of the LoginView view in the ContentView view.
This commit is contained in:
parent
a2f7a7f0f7
commit
c02e371adb
@ -6,22 +6,42 @@
|
|||||||
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
// Copyright © 2022 Röck+Cöde. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import SwiftUI
|
|
||||||
import Browse
|
import Browse
|
||||||
|
import DataModels
|
||||||
import Login
|
import Login
|
||||||
|
import KeychainStorage
|
||||||
import Profile
|
import Profile
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
struct ContentView: View {
|
struct ContentView: View {
|
||||||
|
|
||||||
|
// MARK: Storages
|
||||||
|
|
||||||
|
@KeychainStorage(key: .KeychainStorage.account) private var account: Account?
|
||||||
|
|
||||||
|
// MARK: Body
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
BrowseView()
|
BrowseView()
|
||||||
}
|
}
|
||||||
.sheet(isPresented: .constant(true)) {
|
.sheet(isPresented: showLogin) {
|
||||||
ProfileView {}
|
LoginView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Helpers
|
||||||
|
|
||||||
|
private extension ContentView {
|
||||||
|
var showLogin: Binding<Bool> {
|
||||||
|
.init { account == nil } set: { _ in }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Previews
|
||||||
|
|
||||||
struct ContentView_Previews: PreviewProvider {
|
struct ContentView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
ContentView()
|
ContentView()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user