mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Use presentationMode environment property to dismiss sheet
This commit is contained in:
parent
a31e0e2d4b
commit
428fb6cd6f
@ -1,7 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsHeaderView: View {
|
||||
@Binding var isPresented: Bool
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
@ -10,7 +10,7 @@ struct SettingsHeaderView: View {
|
||||
.fontWeight(.bold)
|
||||
Spacer()
|
||||
Button(action: {
|
||||
isPresented = false
|
||||
presentationMode.wrappedValue.dismiss()
|
||||
}, label: {
|
||||
Image(systemName: "xmark.circle")
|
||||
})
|
||||
@ -21,6 +21,6 @@ struct SettingsHeaderView: View {
|
||||
|
||||
struct SettingsHeaderView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsHeaderView(isPresented: .constant(true))
|
||||
SettingsHeaderView()
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,9 @@ import SwiftUI
|
||||
struct SettingsView: View {
|
||||
@EnvironmentObject var model: WriteFreelyModel
|
||||
|
||||
@Binding var isPresented: Bool
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
SettingsHeaderView(isPresented: $isPresented)
|
||||
SettingsHeaderView()
|
||||
Form {
|
||||
Section(header: Text("Login Details")) {
|
||||
AccountView()
|
||||
@ -23,7 +21,7 @@ struct SettingsView: View {
|
||||
|
||||
struct SettingsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsView(isPresented: .constant(true))
|
||||
SettingsView()
|
||||
.environmentObject(WriteFreelyModel())
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user