在iOS 14应用程序生命周期中,有什么方法可以调用SceneDelegate方法吗? [英] Is there any way to call SceneDelegate methods in iOS 14 app life cycle?
问题描述
我们知道Apple已大大简化了SwiftUI应用程序的生命周期(WWDC20).我看过Paul Hudson先生关于SwiftUI的新变化的视频,其中他解释了如何在"@main或:App"中访问AppDelegate方法.结构.
We know Apple has drastically simplified the SwiftUI app life cycle (WWDC20). I have seen the video of Mr.Paul Hudson about the new changes in SwiftUI in which he has explained how to access AppDelegate methods in "@main or :App" struct.
我想知道是否有任何方法可以访问SceneDelegate方法?
I want to know if there is any way to access the SceneDelegate methods?
先谢谢了. :)
推荐答案
在SwiftUI 2.0生命周期中,现在无法访问SceneDelegate
.可以与.onChange
一起用于 [.active,.inactive,.background] 状态的某些回调,如例如此处
There is no access for SceneDelegate
now in SwiftUI 2.0 life-cycle. Some of callbacks you can use with .onChange
for [.active, .inactive, .background] states as shown for example here
或者...继续使用UIKit生命周期没有错
or... there is nothing wrong in continue using UIKit life-cycle
这篇关于在iOS 14应用程序生命周期中,有什么方法可以调用SceneDelegate方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!