Added the "logOut" closure to the initialiser of the ProfileView view.
This commit is contained in:
parent
330d790394
commit
2e8b65d828
@ -17,7 +17,7 @@ struct ContentView: View {
|
||||
BrowseView()
|
||||
}
|
||||
.sheet(isPresented: .constant(true)) {
|
||||
ProfileView()
|
||||
ProfileView {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,15 @@ import SwiftUI
|
||||
|
||||
public struct ProfileView: View {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
private let logOut: () -> Void
|
||||
|
||||
// MARK: Initialisers
|
||||
|
||||
public init() {}
|
||||
public init(logOut: @escaping () -> Void) {
|
||||
self.logOut = logOut
|
||||
}
|
||||
|
||||
// MARK: Body
|
||||
|
||||
@ -111,7 +117,7 @@ public struct ProfileView: View {
|
||||
|
||||
Section {
|
||||
Button {
|
||||
// TODO: Log out the existing user.
|
||||
logOut()
|
||||
} label: {
|
||||
Text(
|
||||
"profile.button.log_out.text",
|
||||
@ -143,6 +149,8 @@ private extension Image {
|
||||
|
||||
struct ProfileView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
ProfileView()
|
||||
ProfileView {
|
||||
// closure for log out action.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user