Change to use the standard cancellables set

This commit is contained in:
Maurice Parker 2020-07-18 21:33:24 -05:00
parent 16555d829a
commit 859d9fc972
1 changed files with 5 additions and 6 deletions

View File

@ -35,8 +35,7 @@ final class SceneModel: ObservableObject {
private(set) var sidebarModel = SidebarModel()
private(set) var timelineModel = TimelineModel()
private var articlesCancellable: AnyCancellable?
private var selectedArticlesCancellable: AnyCancellable?
private var cancellables = Set<AnyCancellable>()
// MARK: Initialization API
@ -51,13 +50,13 @@ final class SceneModel: ObservableObject {
NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)
articlesCancellable = timelineModel.$articles.sink { [weak self] articles in
timelineModel.$articles.sink { [weak self] articles in
self?.updateMarkAllAsReadButtonsState(articles: articles)
}
}.store(in: &cancellables)
selectedArticlesCancellable = timelineModel.$selectedArticles.sink { [weak self] articles in
timelineModel.$selectedArticles.sink { [weak self] articles in
self?.updateArticleButtonsState(selectedArticles: articles)
}
}.store(in: &cancellables)
}
// MARK: Article Management API