I would like to transition from the .swift file to the ViewController on the StoryBoard, but if you know how to transition, please give me a method name or reference.
Thank you for your cooperation.
swift3
Class UIStoryboard
Use the UIStoryboard
class.There are only three items, including the initiators, so there is no doubt about it.
After pressing the button (goNext(_:)
), instantiate the "Next.storyboard" with the UINavigationController
as the Initial View Controller and include the code you want to transition to as a sample.
@IBAction funcgoNext(_sender:Any){
let storyboard = UIStoryboard (name: "Next", bundle:nil)
iflet navigationController=storyboard.instantiateInitialViewController()as?UINavigationController{
present(navigationController, animated:true, completion:nil)
}
}
Be careful not to forget to specify the Initial View Controller when you create a new Storyboard.You must specify a View Controller from which to start the Storyboard, which is called the Initial View Controller.
If you check "Is Initial View Controller" in the Attributes Inspector of the View Controller, an arrow indicates that it is the View Controller at the starting point.
© 2024 OneMinuteCode. All rights reserved.