Reputation: 1
When I try to set a value, I have an error:
Cannot assign to property: 'value' is a get-only property
var value: BehaviorRelay<Any?>
var unpackedValue: Any? {
get {
return value.value
}
set {
value.value = newValue // error
}
}
Upvotes: 0
Views: 1013
Reputation: 4239
on BehaviorRelay
properies you need to use accept(_ event: Element)
to send a new value
var unpackedValue: Any? {
get {
return value.value
}
set {
value.accept(newValue)
}
}
Refer to the implementation of BehaviorRelay
Accepts
event
and emits it to subscribers
Upvotes: 3