wil*_*ang 10 launch-screen swiftui
我刚刚开始使用 Swift 和 SwiftUI,所以我完全是初学者。我的 SwiftUI 项目附带了一个 LaunchScreen.storyboard,我认为它会很好用,但我不知道如何使用。该应用程序加载初始 ContentView.swift,即使我用图像填充了 LaunchScreen.storyboard。有什么地方我需要指定应用程序应该先加载 LaunchScreen 然后在 2 秒后转到 ContentView 吗?
我怀疑它可能在 SceneDelegate.swift 中,但我不知道。
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
window.rootViewController = UIHostingController(rootView: contentView.environmentObject(model))
self.window = window
window.makeKeyAndVisible()
}
Run Code Online (Sandbox Code Playgroud)
使用 XCode 11.2
在此先感谢您的帮助!
编辑:这确实是一个缓存问题。我删除了 ~/Library/Developer/Xcode/DerivedData/ModuleCache 目录并从模拟器和测试设备中删除了应用程序。然后重建并工作!谢谢!
| 归档时间: |
|
| 查看次数: |
4245 次 |
| 最近记录: |