0

I have create a second view controller with a storyboard. I have specified a StoryBoard ID. I have created a class for this controller and specified this class in the story board as well:

import UIKit
import Foundation

class SecondViewController: UIViewController {
    // It is really empty
}

Then I am trying to activate this controller doing quite a standard operation:

let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)

let secondViewController = storyBoard.instantiateViewController(withIdentifier: "SecondViewController") as! SecondViewController

self.present(secondViewController, animated:true, completion:nil)

However, when execution reaches and invokes storyBoard.instantiateViewController - I get Thread 1: signal SIGABRT without any description (clicking on it gives nothing):

enter image description here

I have already looked at this QA: Swift error : signal SIGABRT how to solve it - clean & build doesn't solve the problem.

I guess I am missing something in the configuration of my second view controller. But I can not find what exactly. Any advices?

Andremoniy
  • 34,031
  • 20
  • 135
  • 241

1 Answers1

1

Verify your storyboard filename and use it in the line:

let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
Igor
  • 880
  • 1
  • 7
  • 11
  • Thanks bro! You've saved my day. That was an issue. I used improper name of the StoryBoard. It should be the same as a name of my storyboard file to which I am going to switch – Andremoniy Jun 05 '18 at 18:55