Add analytics view to the demo

This commit is contained in:
kean
2023-11-12 22:29:13 -05:00
parent 8525da79e8
commit ffb94bc3bf
+12 -4
View File
@@ -8,7 +8,7 @@ import Pulse
import SwiftUI
final class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
private let tableView = UITableView(frame: .zero, style: .grouped)
private let tableView = UITableView(frame: .zero, style: .insetGrouped)
private var sections: [MenuSection] = []
override func viewDidLoad() {
@@ -30,15 +30,23 @@ final class ViewController: UIViewController, UITableViewDataSource, UITableView
]),
MenuSection(title: "Components", footer: "Demonstrates how you can push individual PulseUI screens into an existing navigation (UINavigationController or NavigationView)", items: [
MenuItem(title: "ConsoleView", action: { [unowned self] in
let vc = UIHostingController(rootView: ConsoleView(store: .mock))
let vc = UIHostingController(rootView: ConsoleView(store: .mock).closeButtonHidden())
self.navigationController?.pushViewController(vc, animated: true)
}),
MenuItem(title: "ConsoleView (Logs)", action: { [unowned self] in
let vc = UIHostingController(rootView: ConsoleView(store: .mock, mode: .logs))
let vc = UIHostingController(rootView: ConsoleView(store: .mock, mode: .logs).closeButtonHidden())
self.navigationController?.pushViewController(vc, animated: true)
}),
MenuItem(title: "ConsoleView (Network)", action: { [unowned self] in
let vc = UIHostingController(rootView: ConsoleView(store: .mock, mode: .network))
let vc = UIHostingController(rootView: ConsoleView(store: .mock, mode: .network).closeButtonHidden())
self.navigationController?.pushViewController(vc, animated: true)
})
]),
MenuSection(title: "Custom Views", footer: "Custom views into the underlying logger data", items: [
MenuItem(title: "User Analytics", action: { [unowned self] in
let view = DebugAnalyticsView()
.environment(\.managedObjectContext, LoggerStore.mock.viewContext)
let vc = UIHostingController(rootView: view)
self.navigationController?.pushViewController(vc, animated: true)
})
]),