swift - SwiftUI - “容器文字中的预期表达式”
问题描述
我是 swift 和 Xcode 的新手,但我想知道我的代码有什么问题?我输入了下面显示的代码,并收到错误消息“容器文字中的预期表达式”。在此先感谢您的帮助。
.background(
LinearGradient(
gradient: Gradient(colors: [
Color("ColourBlueberryLight"), Color("ColourBlueberryDark"),)]),
startPoint: .top,
endPoint: .bottom)
)
解决方案
小心放置括号和逗号的位置。这是固定代码:
LinearGradient(
gradient: Gradient(colors: [
Color("ColourBlueberryLight"), Color("ColourBlueberryDark") /// you had an extra ) here
]),
startPoint: .top,
endPoint: .bottom
)
结果:
推荐阅读
- python - 通过三种方法将 Django 应用部署到 Azure 失败(创建/访问 tmp 文件的问题)
- python - 如何在 codalab 上运行 python 文件?
- google-apps-script - 如何使用 OAuth2 库从 Google App Script 发布推文?
- monaco-editor - 在摩纳哥编辑器中按条件换行
- python - 熊猫:找到/选择列具有nan列表的记录
- arrays - 一组可读的常数参数 C
- r - 编织 ar markdown 文件时 as.data.frame.default(data, optional = TRUE) 出错
- java - 你能告诉我我的代码是否可以找到数组中的最大和最小元素是否足够有效..?
- excel - 从 ComboBox 插入变量
- python - 生成具有 x 维的嵌套列表