首页 > 解决方案 > 自 Xcode beta 2 以来调用 PresentationButton 的新方法如何?

问题描述

我正在尝试像文档中所说的那样实现 PresentationButton 但不起作用。

这是 Xcode beta 2

PresentationButton(destination: LoginScreen(),
    label: Text("Login"))

我收到此错误“无法将 'Text' 类型的值转换为预期的参数类型 '() -> _'”

标签: swiftui

解决方案


应该是这样的:

PresentationButton(destination: LoginScreen(),
    label: { Text("Login") })

或这个:

PresentationButton(destination: LoginScreen()) { Text("Login") }

反而。


推荐阅读