swiftui - 自 Xcode beta 2 以来调用 PresentationButton 的新方法如何?
问题描述
我正在尝试像文档中所说的那样实现 PresentationButton 但不起作用。
这是 Xcode beta 2
PresentationButton(destination: LoginScreen(),
label: Text("Login"))
我收到此错误“无法将 'Text' 类型的值转换为预期的参数类型 '() -> _'”
解决方案
应该是这样的:
PresentationButton(destination: LoginScreen(),
label: { Text("Login") })
或这个:
PresentationButton(destination: LoginScreen()) { Text("Login") }
反而。
推荐阅读
- android - Firebase VDT 不运行 Gherkin (Cucumber) 测试
- javascript - 在完整日历中设置过去和未来事件的颜色
- v8 - V8 c++ 和 JS:如何在上下文之间共享对象
- javascript - 将嵌套数组长度相乘并返回单个值
- c++ - 简易计算器
- exception - 捕获 SAPSQL_DATA_LOSS
- c# - C# 将 C# 中的两个小数位四舍五入?
- flutter - Flutter - 基于设备的动态语言
- jquery - JQUERY Datepicker 星期和年份
- docker - Docker in Docker, Building docker agent in a docker contains Jenkins Server