var error = PublishSubject<Error>() init(dispatcher: Dispatcher = .shared) { dispatcher.register(observer: self, key: TopAction.Item.load) { [weak self] (items: [Item]) in self?.items.value = items } dispatcher.register(observer: self, key: TopAction.Item.error) { [weak self] (error: Error) in self?.error.on(.next(error)) } dispatcher.register(observer: self, key: TopDetailAction.Item.update) { [weak self] (item: Item) in
if let i = self?.items.value.findFirstIndex ({ $0.id == item.id }) { self?.items.value[i] = match } } } }