Added the "logOut" closure to the initialiser of the ProfileView view.

This commit is contained in:
Javier Cicchelli 2022-12-03 11:45:54 +01:00
parent 330d790394
commit 2e8b65d828
2 changed files with 12 additions and 4 deletions

View File

@ -17,7 +17,7 @@ struct ContentView: View {
BrowseView() BrowseView()
} }
.sheet(isPresented: .constant(true)) { .sheet(isPresented: .constant(true)) {
ProfileView() ProfileView {}
} }
} }
} }

View File

@ -10,9 +10,15 @@ import SwiftUI
public struct ProfileView: View { public struct ProfileView: View {
// MARK: Properties
private let logOut: () -> Void
// MARK: Initialisers // MARK: Initialisers
public init() {} public init(logOut: @escaping () -> Void) {
self.logOut = logOut
}
// MARK: Body // MARK: Body
@ -111,7 +117,7 @@ public struct ProfileView: View {
Section { Section {
Button { Button {
// TODO: Log out the existing user. logOut()
} label: { } label: {
Text( Text(
"profile.button.log_out.text", "profile.button.log_out.text",
@ -143,6 +149,8 @@ private extension Image {
struct ProfileView_Previews: PreviewProvider { struct ProfileView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
ProfileView() ProfileView {
// closure for log out action.
}
} }
} }