Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Use of undeclared type BindableObject

I’m following this tutorial for SwiftUI amplify app where I came across this error when creating a final class which conforms to Bindable object.

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
    }
}

Is it possible that Apple has changed the class name?
How do I find that out?

like image 578
Nic Wanavit Avatar asked Feb 27 '20 01:02

Nic Wanavit


1 Answers

BindableObject has been renamed ObservableObject

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

Source: https://developer.apple.com/documentation/ios_ipados_release_notes/ios_13_release_notes

like image 184
sfung3 Avatar answered Oct 22 '22 13:10

sfung3