Add CYLTabBarController with a global scan entry, promote MainTabBarController to the window root after login, replace RouterPath-based navigation with AppNavigator, and fix Profile diffable cell reconfiguration crashes. Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
1.1 KiB
Swift
36 lines
1.1 KiB
Swift
//
|
||
// TabNavigationController.swift
|
||
// suixinkan
|
||
//
|
||
|
||
import UIKit
|
||
|
||
@MainActor
|
||
/// 单个 Tab 的 UIKit 导航栈,负责承载该 Tab 内部页面层级。
|
||
final class TabNavigationController: UINavigationController {
|
||
|
||
let appTab: AppTab
|
||
private let services: AppServices
|
||
|
||
/// 初始化实例。
|
||
init(tab: AppTab, services: AppServices) {
|
||
self.appTab = tab
|
||
self.services = services
|
||
super.init(nibName: nil, bundle: nil)
|
||
navigationBar.prefersLargeTitles = false
|
||
setViewControllers([tab.makeRootViewController(services: services)], animated: false)
|
||
}
|
||
|
||
@available(*, unavailable)
|
||
required init?(coder: NSCoder) {
|
||
fatalError("init(coder:) has not been implemented")
|
||
}
|
||
|
||
/// Push 指定应用路由,并统一设置底部 TabBar 隐藏策略。
|
||
func push(route: AppRoute, animated: Bool = true) {
|
||
let viewController = AppRouteViewControllerFactory.makeViewController(for: route, services: services)
|
||
viewController.hidesBottomBarWhenPushed = route.hidesTabBarWhenPushed
|
||
pushViewController(viewController, animated: animated)
|
||
}
|
||
}
|