Passing variables between Storyboards without Segues - Swift

前端 未结 4 1117
终归单人心
终归单人心 2020-12-16 06:06

I\'m passing data between two different UIViewControllers located within two different .storyboard files within Xcode. (It\'s quite a large project so I had to break it up i

4条回答
  •  再見小時候
    2020-12-16 06:36

    I'm assuming that the viewController that you want to pass the data to is a custom viewController. In that case, use this amended code here:

    var storyboard = UIStoryboard(name: "IDEInterface", bundle: nil)
    var controller = storyboard.instantiateViewControllerWithIdentifier("IDENavController") as! MyCustomViewController
    
    controller.exercisedPassed = "Ex1"
    
    self.presentViewController(controller, animated: true, completion: nil)
    

提交回复
热议问题