Revised settings views

Notes:
- A lot of representable shims over UIKit view controllers. These misbehave a little. They should be re-written in SwiftUI.
- Settings no longer uses VibrantTableViewCell
- Changes to AppDefaults trigger objectWillSend
This commit is contained in:
Stuart Breckenridge
2022-11-12 19:50:13 +08:00
parent 35440ba542
commit c8306c8660
12 changed files with 636 additions and 52 deletions

View File

@@ -8,8 +8,37 @@
import Account
import UIKit
import SwiftUI
import RSCore
struct AddAccountViewControllerRepresentable: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> AddAccountViewController {
let storyboard = UIStoryboard(name: "Settings", bundle: .main)
let controller = storyboard.instantiateViewController(withIdentifier: "AddAccountViewController") as! AddAccountViewController
context.coordinator.parentObserver = controller.observe(\.parent, changeHandler: { vc, _ in
vc.parent?.title = vc.title
vc.parent?.navigationItem.rightBarButtonItems = vc.navigationItem.rightBarButtonItems
})
return controller
}
func updateUIViewController(_ uiViewController: AddAccountViewController, context: Context) {
//
}
typealias UIViewControllerType = AddAccountViewController
class Coordinator {
var parentObserver: NSKeyValueObservation?
}
func makeCoordinator() -> Self.Coordinator { Coordinator() }
}
protocol AddAccountDismissDelegate: UIViewController {
func dismiss()
}