1

I want to create an app and set initial view controller. I did delete storyboard and don't want to use it. However, app throw me an error:

Could not find a storyboard named 'Main' in bundle NSBundle

But I did delete it for purpose. I want to create UI by code. Here is my AppDelegate:

class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        self.window = UIWindow(frame: UIScreen.main.bounds)

        let initialViewController = SearchViewController()

        self.window?.rootViewController = initialViewController
        self.window?.makeKeyAndVisible()

        return true
    }
}
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Evgeniy Kleban
  • 6,794
  • 13
  • 54
  • 107
  • 3
    I believe you need to click on the blue project icon in the file tree to the left, then in the *Generals setting > Deployment Info*, delete the "Main" text in the "Main interface" storyboard field. You've deleted the physical file but you probably haven't deleted the reference that was made by default (when you created a new project) in the General settings of your project. – Zhang Feb 17 '17 at 15:05
  • For future googlers: see this example for creating a Swift app without a storyboard for iOS 13: https://stackoverflow.com/a/56862325/6942666 – Eric Wiener Jul 17 '19 at 23:18

1 Answers1

4

You have two options

1) Open Info.Plist and remove "Main storyboard file base name" row.

2) Go to Target -> General Tab -> Deployment Info -> Main Interface -> Remove "Main" and set it to blank string

Sahana Kini
  • 562
  • 2
  • 8