gpt4 book ai didi

ios - 错误: Use of undeclared type BindableObject

转载 作者:行者123 更新时间:2023-12-01 15:21:31 25 4
gpt4 key购买 nike

我正在跟踪SwiftUI放大应用程序的本教程,在创建符合Bindable对象的最终类时遇到了此错误。
Error:Use of undeclared type 'BindableObject'

import Combine  
import SwiftUI
import AWSAppSync

final class TalkStore: BindableObject {
/*
Required by SwiftUI
*/
let didChange = PassthroughSubject<TalkStore, Never>()
var listTalks: [ListTodosQuery.Data.ListTodo.Item] {
didSet {
didChange.send(self)
}
}

//We will be using this later.
private let appSyncClient: AWSAppSyncClient!

/*
Init if running app is using SwiftUI Content View
*/
init(talks: [ListTodosQuery.Data.ListTodo.Item]) {
self.appSyncClient = nil
self.listTalks = talks
}
}

苹果有可能更改了类(class)名称吗?
我如何找到答案?

最佳答案

BindableObject已重命名为ObservableObject

BindableObject is replaced by the ObservableObject protocol from the Combine framework. (50800624)

资料来源: https://developer.apple.com/documentation/ios_ipados_release_notes/ios_13_release_notes

关于ios - 错误: Use of undeclared type BindableObject,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60424909/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com