未知属性“对象绑定”SwiftUI [已关闭]

toiithl6  于 2023-01-04  发布在  Swift
关注(0)|答案(1)|浏览(124)

编辑问题以包含desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将有助于其他人回答问题。
14小时前关门了。
Improve this question
当我尝试在我的应用程序中使用@ObjectBinding时,我收到此错误。

@ObjectBinding var state: AppState

即使AppState符合BindableObject协议。

class AppState: BindableObject{
var count = 0 {
    didSet{
        self.didChange.send()
    }
 }

var didChange = PassthroughSubject<Void, Never>
}

我使用的是Xcode 14.2,在构建设置中选择了Swift 5,但我没有看到Swift 5.2的任何选项。请告诉我如何解决这个问题?

bf1o4zei

bf1o4zei1#

BindableObject被重命名为ObservableObject,ObjectBidning被重命名为ObservedObject。我正在遵循一个使用这些的旧教程。

相关问题