'some View' 类型的值没有成员 'badge'

Value of type 'some View' has no member 'badge'

我无法在 tabview 中使用 属性 badge,因为 xCode 抱怨说:

Value of type 'some View' has no member 'badge'

.

var body: some View {
      TabView {
          Text("Your home screen here")
             .tabItem {
                 Label("Home", systemImage: "house")
              }
              .badge(5)
      }
 }

只能从iOS 15开始获得,并且可以从Xcode 13开始建造

在 SwiftUI 声明中查看可用性: