From 36f50ca3e1ee438e4bb85149d93bbead482dbae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=A0vara?= Date: Tue, 7 Jul 2026 09:07:07 +0200 Subject: [PATCH] Set `lazyLoadTabs` to `false` by default. --- Demo/SceneController.swift | 5 ++++- .../ViewControllers/HotwireTabBarController.swift | 13 ++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Demo/SceneController.swift b/Demo/SceneController.swift index cf257009..c4ef4981 100644 --- a/Demo/SceneController.swift +++ b/Demo/SceneController.swift @@ -7,7 +7,10 @@ final class SceneController: UIResponder { var window: UIWindow? private let rootURL = Demo.current - private lazy var tabBarController = HotwireTabBarController(navigatorDelegate: self) + private lazy var tabBarController = HotwireTabBarController( + navigatorDelegate: self, + lazyLoadTabs: true + ) // MARK: - Authentication diff --git a/Source/Turbo/ViewControllers/HotwireTabBarController.swift b/Source/Turbo/ViewControllers/HotwireTabBarController.swift index 1723964e..39422903 100644 --- a/Source/Turbo/ViewControllers/HotwireTabBarController.swift +++ b/Source/Turbo/ViewControllers/HotwireTabBarController.swift @@ -5,24 +5,23 @@ import UIKit /// This controller loads tabs defined by `HotwireTab` and configures each one with its own `Navigator`. /// The currently selected tab's navigator is exposed via the `activeNavigator` property. /// -/// By default, tabs are loaded lazily: only the initially selected tab performs its initial -/// visit when `load(_:)` is called, and each remaining tab performs its initial visit the -/// first time the user selects it. Pass `lazyLoadTabs: false` in the initializer to load -/// every tab immediately instead. +/// By default, every tab performs its initial visit when `load(_:)` is called. Pass +/// `lazyLoadTabs: true` in the initializer to defer each tab's initial visit until the +/// first time the user selects it; the initially selected tab still loads right away. open class HotwireTabBarController: UITabBarController, NavigationHandler { /// Creates a tab bar controller. /// /// - Parameters: /// - navigatorDelegate: An optional delegate for each tab's `Navigator`. /// - lazyLoadTabs: Controls when tab navigators perform their initial visit. - /// When `true` (the default), only the initially selected tab starts when tabs + /// When `false` (the default), every tab starts immediately when `load(_:)` + /// is called. When `true`, only the initially selected tab starts when tabs /// are loaded; each remaining tab starts the first time the user selects it. - /// When `false`, every tab starts immediately when `load(_:)` is called. /// This affects when each tab's content is loaded, not whether the tab's /// navigator is created. public init( navigatorDelegate: NavigatorDelegate? = nil, - lazyLoadTabs: Bool = true + lazyLoadTabs: Bool = false ) { self.navigatorDelegate = navigatorDelegate self.lazyLoadTabs = lazyLoadTabs