Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Demo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Hotwire.config.backButtonDisplayMode = .minimal
Hotwire.config.showDoneButtonOnModals = true
Hotwire.config.animateReplaceActions = true
Hotwire.config.lazyLoadTabs = true
#if DEBUG
Hotwire.config.debugLoggingEnabled = true
#endif
Expand Down
3 changes: 3 additions & 0 deletions Source/HotwireConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public struct HotwireConfig {
/// Set to `true` to fade content when performing a `replace` visit.
public var animateReplaceActions = false

/// Set to `true` to load each tab after it is selected (instead of on app launch).
public var lazyLoadTabs = false

/// Enable or disable debug logging for Turbo visits and bridge elements
/// connecting, disconnecting, receiving/sending messages, and more.
public var debugLoggingEnabled = false {
Expand Down
7 changes: 6 additions & 1 deletion Source/Turbo/ViewControllers/HotwireTabBarController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ open class HotwireTabBarController: UITabBarController, NavigationHandler {
public func load(_ tabs: [HotwireTab]) {
hotwireTabs = tabs
setupTabs()
activeNavigator.start()

if Hotwire.config.lazyLoadTabs {
activeNavigator.start()
} else {
navigatorsByIdentifier.values.forEach { $0.start() }
}
}

/// Returns the navigator associated with the given tab.
Expand Down