From c02e371adb29f94a47ffc477e420f7b3ab92f936 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Sun, 11 Dec 2022 22:50:21 +0100 Subject: [PATCH] Implemented the showing of the LoginView view in the ContentView view. --- BeReal/ContentView.swift | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/BeReal/ContentView.swift b/BeReal/ContentView.swift index 12650bb..2c544e1 100644 --- a/BeReal/ContentView.swift +++ b/BeReal/ContentView.swift @@ -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 { + .init { account == nil } set: { _ in } + } +} + +// MARK: - Previews + struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView()