1

I'm trying to instantiate a UINavigationController with a rootViewController in my AppDelegate. I've looked on this website, but all the examples were from Objective-C or used storyboards (which I'm trying to get away from). 'HomeScreenController` is the root view of the application.

Edit: this shows up in the console

2015-07-18 14:42:25.376 FastFactsSwift[4749:343495] Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' 
- perhaps the designated entry point is not set?

How do I fix this?


The following code results in just a black screen:

AppDelegate.swift:

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    self.window?.rootViewController = UINavigationController(rootViewController: HomeScreenController())

    return true
}
...

HomeScreenController.swift:

import UIKit

class HomeScreenController: UIViewController, UISearchBarDelegate, UITableViewDelegate{
    override func viewDidLoad(){

        super.viewDidLoad()

        var width = self.view.viewWidth
        var height = self.view.viewHeight

        //Add stuff to the view
}
...

Why is HomeScreenController showing up as a black screen?

goodcow
  • 4,495
  • 6
  • 33
  • 52

1 Answers1

0

The problem was not configuring AppDelegate to not use a storyboard.

How do I create a new Swift project without using Storyboards?

Community
  • 1
  • 1
goodcow
  • 4,495
  • 6
  • 33
  • 52