Tye Howatt
Tye Howatt

Reputation: 105

present storyboard controller from a programmed made controller

Hi my app is made without a storyboard and in one of my classes I want to present the one controller made in my storyboard but it crashes every time here are some screen shots The Controller im trying to [present

[!][This is how im presenting it2]2

Upvotes: 0

Views: 41

Answers (1)

Sweeper
Sweeper

Reputation: 271420

If you want to present something that is in the storyboard, you need to instantiate the VC class using instantiateViewController(withIdentifier:):

let newNoteVC = UIStoryboard.main.
    instantiateViewController(withIdentifier: "A")

"A" is the storyboard ID that you gave the VC.

Now it can be presented:

present(newNoteVC, animated: true, completion: nil)

Upvotes: 1

Related Questions