How to use BehaviorRelay as an alternate to Variable in RxSwift?
Have you considered simply creating a new array from the existing value on the relay, appending, then calling accept
?
myFilter.accept(myFilter.value + [newModel])
Building on Dalton's answer, here is a handy extension:
extension BehaviorRelay where Element: RangeReplaceableCollection {
func acceptAppending(_ element: Element.Element) {
accept(value + [element])
}
}