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

@@ -10,6 +10,36 @@ import Foundation
import UniformTypeIdentifiers
import RSCore
import UIKit
import SwiftUI
struct ArticleThemesViewControllerRepresentable: UIViewControllerRepresentable {
func makeUIViewController(context: Context) -> ArticleThemesTableViewController {
let storyboard = UIStoryboard(name: "Settings", bundle: .main)
let controller = storyboard.instantiateViewController(withIdentifier: "ArticleThemesTableViewController") as! ArticleThemesTableViewController
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: ArticleThemesTableViewController, context: Context) {
//
}
typealias UIViewControllerType = ArticleThemesTableViewController
class Coordinator {
var parentObserver: NSKeyValueObservation?
}
func makeCoordinator() -> Self.Coordinator { Coordinator() }
}
class ArticleThemesTableViewController: UITableViewController, Logging {