API 在 Xcode 11 Beta 5 中更改后,如何在 SwiftUI 中为 TextField 使用 RoundedBorderTextFieldStyle?

How to use RoundedBorderTextFieldStyle in SwiftUI for TextField after API change in Xcode 11 Beta 5?

在 Xcode 11 Beta 5 之前。我使用此语法在我的 TextField 外放置一个圆角边框:

TextField("Expression", text: $expression)
      .textFieldStyle(.roundedBorder)

遗憾的是,这种方法已被弃用,现在给我警告。

新方法应该是:roundedBorder' 已弃用:直接使用 RoundedBorderTextFieldStyle

但我想不出使用它的方法。

正如我从开发者文档中得知的那样。 RoundedBorderTextFieldStyle 符合 TextFieldStyle 协议。

TextField 似乎有 RoundedBorderTextFieldStyle 作为嵌套结构?(不确定我是否理解正确,RoundedBorderTextFieldStyle 在开发者文档中写在 TextField 下面)

我不知道如何使用新的 RoundedBorderTextFieldStyle。

我正在寻找在 Beta 5 中编写以下代码的正确方法:

    TextField("Placeholder", text: $texts)
        .textFieldStyle(.roundedBorder)

你说:

 .textFieldStyle(RoundedBorderTextFieldStyle())