Settings View: SwiftUI wrapper
This commit is contained in:
49
App/Settings/SettingsView.swift
Normal file
49
App/Settings/SettingsView.swift
Normal file
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// SettingsView.swift
|
||||
// App
|
||||
//
|
||||
// Created by James Magahern on 3/3/21.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct SettingsCategoryCell: View {
|
||||
@State var title: String = ""
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
Text(title)
|
||||
.bold()
|
||||
.frame(height: 34.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct SettingsView: View {
|
||||
@Environment(\.presentationMode)
|
||||
@Binding private var presentationMode
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
List {
|
||||
Section(header: Text("Redirect Rules"), content: {
|
||||
Text("To Do")
|
||||
})
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.navigationBarTitle("Settings", displayMode: .inline)
|
||||
.toolbar(content: {
|
||||
#if !targetEnvironment(macCatalyst)
|
||||
Button("Done", action: { presentationMode.dismiss() })
|
||||
#endif
|
||||
})
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
}
|
||||
|
||||
struct SettingsView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
SettingsView()
|
||||
}
|
||||
}
|
||||
22
App/Settings/SettingsViewController.swift
Normal file
22
App/Settings/SettingsViewController.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// SettingsViewController.swift
|
||||
// App
|
||||
//
|
||||
// Created by James Magahern on 3/3/21.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
|
||||
class SettingsViewController: UIHostingController<SettingsView>
|
||||
{
|
||||
var settingsView = SettingsView()
|
||||
|
||||
init() {
|
||||
super.init(rootView: settingsView)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user