【问题标题】:Error: Use of undeclared type BindableObject错误:使用未声明的类型 BindableObject
【发布时间】:2020-02-27 01:07:53
【问题描述】:

我正在关注 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
    }
}

Apple 是否可能更改了类名?
我怎样才能知道呢?

【问题讨论】:

    标签: ios swift swiftui aws-amplify


    【解决方案1】:

    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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-26
      • 2018-11-16
      相关资源
      最近更新 更多