There is no viewcontroller.swift file when I start the project [duplicate]

柔情痞子 提交于 2020-01-22 04:01:08

问题


I tried to start the project and play around with viewcontroller but I do not see it. Only appdelegate and scenedelegeate and contentview. The code below was supposed to be added to viewcontroller but I do not know where to add. It keeps giving me a error message saying unresolved identifier present and action. please help.

    @IBAction func hello() {
        // add alert

        let alert = UIAlertController(title: "hello", message: "daaaammmmmn", preferredStyle: .alert)
        let okAction = UIAlertAction(title: "ok", style: .default, handler: nil)
        alert.addAction(action)

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

}


回答1:


When you created the project, in the User Interface pop-up, you chose SwiftUI.

Choose Storyboard instead.



来源:https://stackoverflow.com/questions/58050723/there-is-no-viewcontroller-swift-file-when-i-start-the-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!