Remove redundant main actor dispatch

This commit is contained in:
Marcus Kida 2024-01-04 16:28:22 +01:00
parent 97bfdabe0c
commit f50d48dc4e
No known key found for this signature in database
GPG Key ID: 19FF64E08013CA40
1 changed files with 137 additions and 139 deletions

View File

@ -88,7 +88,7 @@ class MainTabBarController: UITabBarController {
} }
@MainActor @MainActor
func viewController(context: AppContext, authContext: AuthContext?, coordinator: SceneCoordinator) async -> UIViewController { func viewController(context: AppContext, authContext: AuthContext?, coordinator: SceneCoordinator) -> UIViewController {
guard let authContext = authContext else { guard let authContext = authContext else {
return UITableViewController() return UITableViewController()
} }
@ -171,12 +171,11 @@ extension MainTabBarController {
view.backgroundColor = .systemBackground view.backgroundColor = .systemBackground
// seealso: `ThemeService.apply(theme:)` // seealso: `ThemeService.apply(theme:)`
Task { @MainActor in
let tabs = Tab.allCases let tabs = Tab.allCases
var viewControllers = [UIViewController]() var viewControllers = [UIViewController]()
for tab in tabs { for tab in tabs {
let viewController = await tab.viewController(context: context, authContext: authContext, coordinator: coordinator) let viewController = tab.viewController(context: context, authContext: authContext, coordinator: coordinator)
viewController.tabBarItem.tag = tab.tag viewController.tabBarItem.tag = tab.tag
viewController.tabBarItem.title = tab.title // needs for acessiblity large content label viewController.tabBarItem.title = tab.title // needs for acessiblity large content label
viewController.tabBarItem.image = tab.image.imageWithoutBaseline() viewController.tabBarItem.image = tab.image.imageWithoutBaseline()
@ -316,7 +315,6 @@ extension MainTabBarController {
updateTabBarDisplay() updateTabBarDisplay()
} }
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
super.traitCollectionDidChange(previousTraitCollection) super.traitCollectionDidChange(previousTraitCollection)