xcode SwiftUI 忽略导入
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/56505797/
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
SwiftUI ignoring import
提问by PinkeshGjr
I have just installed Xcode11 and when i try to create new fresh project with SwiftUI check mark selected it returns error.
我刚刚安装了 Xcode11,当我尝试使用 SwiftUI 复选标记创建新项目时,它返回错误。
Not able to build and run successfully.
无法成功构建和运行。
File 'ContentView.swift' is part of module 'SwiftUI'; ignoring import
文件“ContentView.swift”是模块“SwiftUI”的一部分;忽略进口
ContentView.swift
内容视图.swift
Use of undeclared type 'View'
使用未声明的类型“视图”
SceneDelegate.swift
SceneDelegate.swift
Use of unresolved identifier 'UIHostingController'
使用未解析的标识符“UIHostingController”
I have tried removing all derived data and also set command-line tools to 11
我尝试删除所有派生数据并将命令行工具设置为 11
回答by Matteo Pacini
Your project is named SwiftUI
- please try using a different name.
您的项目已命名SwiftUI
- 请尝试使用不同的名称。
回答by Mahendra Y
You should never create app with name SwiftUI, it will always show compilation error. Just change the name and enjoy coding with SwiftUI
你永远不应该创建名为SwiftUI 的应用程序,它总是会显示编译错误。只需更改名称即可享受使用SwiftUI编码的乐趣