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()
|
BrowseView()
|
||||||
}
|
}
|
||||||
.sheet(isPresented: .constant(true)) {
|
.sheet(isPresented: .constant(true)) {
|
||||||
ProfileView()
|
ProfileView {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user