0

index.swift

func didReceiveNewSession(_ session: QBRTCSession, userInfo: [String : String]? = nil) {
    print("Receive")
    let mainStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let goController = mainStoryboard.instantiateViewController(withIdentifier: "call") as! call
    self.present(goController, animated: true)
}

If I'm in index.swift and I receive session, print Receive for me and go to call.swift.

But if after load index.swift I go to page.swift, if receive session, print Receive but don't go to call.swift and stay on page.swift.

I want if I'm anywhere after present, go to call.swift

rmaddy
  • 314,917
  • 42
  • 532
  • 579
salari mameri
  • 228
  • 5
  • 13
  • It's difficult to follow exactly what you are asking here, can you elaborate more? You're just trying to programmatically open up a VC from a different storyboard then the VC you are currently viewing? – Justin Miller Jul 04 '18 at 13:14
  • @JustinMiller, Yes. i write codes in index VC, but i'm not in index VC. if i call index codes, don't go to another VC – salari mameri Jul 04 '18 at 13:17

1 Answers1

2
  • Open your first Storyboard and create a Storyboard Reference enter image description here

  • Enter the name of your second Storyboard in the "Storyboard" property and the Reference ID of the destination ViewController in the "Reference ID" property of your newly crated reference. (Reference ID is equivalent to Storyboard ID of the destination ViewController)

    enter image description here

  • Create a segue from your source ViewController to the newly created Storyboard Reference. Make sure the segue has an Identifier.

  • In your code perform the segue like this

.

func didReceiveNewSession(_ session: QBRTCSession, userInfo: [String : String]? = nil) {
    print("Receive")
    self.performSegue(withIdentifier: "mySegue", sender: self)
}

Credits to https://stackoverflow.com/a/33753164/7990095

ndreisg
  • 1,119
  • 13
  • 33
  • You mean Xcode project file? I'm sorry I can't send the project due to copyright reasons. Just ask if you can't follow the steps and I'll try to explain further. – ndreisg Jul 05 '18 at 13:04