Instantiate and Present a viewController in Swift

前端 未结 16 1716
难免孤独
难免孤独 2020-11-22 13:04

Issue

I started taking a look of the new Swift on Xcode 6, and I tried some demo projects and tutorials. Now I am stuck at:

16条回答
  •  余生分开走
    2020-11-22 13:12

    Swift 4.2 updated code is

    let storyboard = UIStoryboard(name: "StoryboardNameHere", bundle: nil)
    let controller = storyboard.instantiateViewController(withIdentifier: "ViewControllerNameHere")
    self.present(controller, animated: true, completion: nil)
    

提交回复
热议问题