I'm trying to using Swift Combine to get the changed event of a property.
I have this class that publish the isLogged
property
class CurrentUser: Account {
static let me = CurrentUser() //Singleton
@Published var isLogged: Bool = false
}
that inherit from this other class that publish the profileImageVersion
property
class Account {
@Published var profileImageVersion: String?
init(){
self.profileImageVersion = ""
}
}
I'm trying to subscribe to the published inherit profileImageVersion
property like this without success!
// Subscribe to account image changes
userImageChangedSubscriber = CurrentUser.me.$profileImageVersion.receive(on: DispatchQueue.main).sink(receiveValue: { (imageVersion) in
...
}
})
The error is Fatal error: Call of deleted method
if, on the other hand, I subscribe to the isLogged
property, all Is working fine...
// Subscribe to logged changes
userLoggedSubscriber = CurrentUser.me.$isLogged.receive(on: DispatchQueue.main).sink(receiveValue: { (logged) in
...
})
This error is thrown only on Xcode 11.4 beta 2 / iOS 13.4.
Using Xcode 11.3.1 / 13.3 all is working fine!