You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
People seems to be confused about the differences between a @published wrapped property and a CurrentValueSubject.
CurrentValueSubject is a value, a publisher and a subscriber all in one.
Sadly it doesn’t fire objectWillChange.send() when used inside an ObservableObject.
You can specify an error type.
@Published is a property wrapper, thus:
It is not yet supported in top-level code.
It is not supported in a protocol declaration.
It can only be used within a class.
@Published automatically fires objectWillChange.send() when used inside an ObservableObject.
Xcode will emit a warning if your try to publish to @Published wrapped property from a background queue. Probably because objectWillChange.send() must be called from the main thread.
The error type of its publisher is Never
My biggest beef against @Published is that it can’t behave as a subscriber and setting up Combine pipelines requires additional plumbing compared to a Current Value Subject.
We can declare a @Published property inside a protocol. It is kinda ugly.
People seems to be confused about the differences between a @published wrapped property and a CurrentValueSubject.
CurrentValueSubject
is a value, a publisher and a subscriber all in one.Sadly it doesn’t fire
objectWillChange.send()
when used inside an ObservableObject.You can specify an error type.
@Published
is a property wrapper, thus:@Published
automatically firesobjectWillChange.send()
when used inside an ObservableObject.Xcode will emit a warning if your try to publish to
@Published
wrapped property from a background queue. Probably becauseobjectWillChange.send()
must be called from the main thread.The error type of its publisher is
Never
My biggest beef against
@Published
is that it can’t behave as a subscriber and setting up Combine pipelines requires additional plumbing compared to a Current Value Subject.We can declare a
@Published
property inside a protocol. It is kinda ugly.The text was updated successfully, but these errors were encountered: