Swift Project 2 without StoryBoards

2

I would like to create a project in Swift 2 that does not work with storyBoards since in Objective-C I am used to working with XIBs .

Some time ago I was testing with Swift 1.x and I remember that to assign the VC to rootViewController in the appDelegate it had to first (like Objective-C)

  • create an instance of the VC:

    let vc = ViewController(nibName:"ViewController", bundle:nil)

  • then assign it to rootViewController

My problem is that when I declare the constant vc the next warning skips me:

Immutable value 'vc' was never used; consider replacing with '_' or removing it

Could someone give me some indication?

    
asked by jescabias 30.12.2015 в 15:12
source

1 answer

4

Here the steps:

self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window!.backgroundColor = UIColor.whiteColor()
self.window!.makeKeyAndVisible()

let vc = ViewController(nibName: "ViewController", bundle: nil)
self.window?.rootViewController = vc

By the way, very good choice not to use Storyboards;)

    
answered by 30.12.2015 / 16:56
source