我正试图将NSPersistentContainer
的{{1}}传递给SceneDelegate
,但我不断收到此错误:
“致命错误:FocusTabBarController需要一个容器”
不确定我在做什么错。请帮忙吗?
UITabBarController
:
SceneDelegate
let containerObject = (UIApplication.shared.delegate as! AppDelegate).persistentContainer
let tabBarController = FocusTabBarController()
tabBarController.container = containerObject
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = tabBarController
self.window = window
window.makeKeyAndVisible()
}
:
FocusTabBarController