To preload a UIViewController
's view, simply access its view
property:
let _ = myViewController.view
To preload all view controllers on a UITabBarController
, you can do:
if let viewControllers = tabBarController.viewControllers {
for viewController in viewControllers {
let _ = viewController.view
}
}
Or a bit more compactly:
tabBarController.viewControllers?.forEach { let _ = $0.view }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…