Fix Preferences Done button not working

This commit is contained in:
Shadowfacts 2020-12-21 17:46:18 -05:00
parent 5e2af7d678
commit 7506ff3225
4 changed files with 8 additions and 8 deletions

View File

@ -309,7 +309,7 @@ class BrowserNavigationController: UIViewController {
}
private func showPreferences() {
let host = UIHostingController(rootView: PreferencesView())
let host = UIHostingController(rootView: PreferencesView(dismiss: { self.dismiss(animated: true) }))
present(host, animated: true)
}

View File

@ -8,9 +8,9 @@
import SwiftUI
struct PreferencesView: View {
@ObservedObject var preferences: Preferences = .shared
let dismiss: () -> Void
@Environment(\.presentationMode) @Binding var presentationMode: PresentationMode
@ObservedObject var preferences: Preferences = .shared
var body: some View {
NavigationView {
@ -31,7 +31,7 @@ struct PreferencesView: View {
private var doneButton: some View {
Button(action: {
presentationMode.dismiss()
dismiss()
}, label: {
Text("Done")
})
@ -73,6 +73,6 @@ struct PreferencesView_Previews: PreviewProvider {
@State static var presented = true
static var previews: some View {
PreferencesView()
PreferencesView(dismiss: {})
}
}

View File

@ -42,7 +42,7 @@ struct TableOfContentsView: View {
}
.listStyle(PlainListStyle())
.navigationBarTitle("Table of Contents", displayMode: .inline)
.navigationBarItems(trailing: Button("Done", action: {
.navigationBarItems(leading: Button("Cancel", action: {
close(nil)
}))
}

View File

@ -7,7 +7,7 @@
<key>BrowserCore.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>5</integer>
<integer>3</integer>
</dict>
<key>Gemini-iOS.xcscheme_^#shared#^_</key>
<dict>
@ -32,7 +32,7 @@
<key>GeminiRenderer.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
<integer>5</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>