15

I'm just starting out with Swift and SwiftUI, so I'm a total beginner. My SwiftUI project came with a LaunchScreen.storyboard which I thought would be nice to use, but I have no idea how. The app loads the initial ContentView.swift, even though I filled the LaunchScreen.storyboard with an image. Is there any place I need to specify the app should load the LaunchScreen first and then go to the ContentView after like, 2 seconds or something?

I suspect it's probably in SceneDelegate.swift, but I don't know.

// 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()
}

Using XCode 11.2

Thanks in advance for any help!


Edit: It really is a cache issue. I deleted the ~/Library/Developer/Xcode/DerivedData/ModuleCache directory and removed the app from the simulator and test device. Then rebuilt and working! Thanks!

wildfang
  • 315
  • 4
  • 9

0 Answers0