79337336

Date: 2025-01-07 21:09:08
Score: 1
Natty:
Report link
  1. Create SplashVC

Create a new Swift File: In your Xcode project, right-click on the project's folder in the Project Navigator and select "New File from Template" -> "Cocoa Touch Class". Name it "SplashVC.swift".

  1. Update your AppDelegate.swift like

    @main class AppDelegate: UIResponder, UIApplicationDelegate {

     var window: UIWindow?
     private let navigationController = UINavigationController()
    
     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         window = UIWindow(frame: UIScreen.main.bounds)
         window?.rootViewController = navigationController
         window?.makeKeyAndVisible()
    
         goToSplashScreen()
         return true
     }
    
     private func goToSplashScreen() {
         let splashViewController = SplashVC(nibName: "SplashVC", bundle: nil)
         navigationController.setViewControllers([splashViewController], animated: false)
     }
    

    }

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @main
  • Low reputation (1):
Posted by: Ameer Hamza