Xcode12.3
Remove StoryBoard and launch it from Xib.
Select ViewController.Swift and Main.storyBoard> Right click> Delete> Move to Trash
(1) Main storyboard file base name> Delete
(2) Application Scene Manifest> Scene Configuration> Application Session Role> Item 0 (Default Configuration)> Storyboard Name> Delete
New File> Cocoa Touch Class> Subclass of: UIViewContoroller> Also create Check XIB file> Next> Create
I was able to create two files.
Set the screen displayed at startup with func scene (_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions)
to ViewContoroller that supports Xib files.
SceneDelegate.swift
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let _ = (scene as? UIWindowScene) else { return }
//Postscript from here
let window = UIWindow(windowScene: scene as! UIWindowScene)
self.window = window
window.makeKeyAndVisible()
let xibViewController = XibViewController()
window.rootViewController = xibViewController
}
Implement screen with xib instead of StoryBoard [Swift] Launch from Xib instead of StoryBoard on iOS 13
Recommended Posts