在 Xcode 中初始化新项目时没有 main.storyboard 或 ViewController.swift?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/58046092/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:01:19  来源:igfitidea点击:

No main.storyboard or ViewController.swift upon initialization of new project in Xcode?

iosxcodestoryboard

提问by Evan

I just got Xcode and I am trying to follow an online tutorial but in every single tutorial, when a new project is made (a single activity) app, the project comes with 2 files that I simply don't have by default! I can't figure out how to make a main.storyboard or ViewController.swift file by default upon creating a project.

我刚获得 Xcode,我正在尝试学习在线教程,但在每个教程中,当创建一个新项目(单个活动)应用程序时,该项目带有 2 个文件,我在默认情况下根本没有这些文件!我不知道如何在创建项目时默认创建 main.storyboard 或 ViewController.swift 文件。

The only files I have are AppDelegate.swift, SceneDelegate.swift, and ContentView.swift. I also have Assets.xcassets, LaunchScreen.storyboard, Info.plist, Preview Content directory, and Products directory.

我仅有的文件是 AppDelegate.swift、SceneDelegate.swift 和 ContentView.swift。我还有 Assets.xcassets、LaunchScreen.storyboard、Info.plist、Preview Content 目录和 Products 目录。

Is this part of a new update or something? Or is there some way I can get those 2 files to create upon initialization?

这是新更新的一部分还是什么?或者有什么方法可以让我在初始化时创建这两个文件?

I tried reinstalling, and have made multiple new projects - each time they lack those 2 crucial files, so any help would be appreciated.

我尝试重新安装,并制作了多个新项目 - 每次他们都缺少这 2 个关键文件,因此我们将不胜感激。

回答by Kamran

UncheckUse SwiftUIat the following step,

Use SwiftUI在以下步骤取消选中

enter image description here

在此处输入图片说明

Update

更新

In the latest Xcode, select SwiftUIfrom the User Interfacedropdown, enter image description here

在最新的XcodeSwiftUI用户界面下拉菜单中选择, 在此处输入图片说明

回答by Andrea Baccara

On latest Xcode release you should change in the dropdown menu from "Swift UI" to "Storyboard"

在最新的 Xcode 版本中,您应该将下拉菜单中的“Swift UI”更改为“Storyboard”