From 2d264ea7488fcc58c03bbcdf9fb19e3a157f391a Mon Sep 17 00:00:00 2001 From: Hal Date: Sun, 23 Jun 2024 10:23:59 -0400 Subject: [PATCH] Avoid `MainActor.assumeIsolated` --- .../Features/Console/ConsoleDataSource.swift | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Sources/PulseUI/Features/Console/ConsoleDataSource.swift b/Sources/PulseUI/Features/Console/ConsoleDataSource.swift index cfda5a7e6..326eddcb5 100644 --- a/Sources/PulseUI/Features/Console/ConsoleDataSource.swift +++ b/Sources/PulseUI/Features/Console/ConsoleDataSource.swift @@ -17,7 +17,6 @@ protocol ConsoleDataSourceDelegate: AnyObject { func dataSource(_ dataSource: ConsoleDataSource, didUpdateWith diff: CollectionDifference?) } -@MainActor final class ConsoleDataSource: NSObject, NSFetchedResultsControllerDelegate { weak var delegate: ConsoleDataSourceDelegate? @@ -103,7 +102,7 @@ final class ConsoleDataSource: NSObject, NSFetchedResultsControllerDelegate { controller.delegate = controllerDelegate } - func bind(_ filters: ConsoleFiltersViewModel) { + @MainActor func bind(_ filters: ConsoleFiltersViewModel) { cancellables = [] filters.$options.sink { [weak self] in self?.predicate = $0 @@ -135,16 +134,12 @@ final class ConsoleDataSource: NSObject, NSFetchedResultsControllerDelegate { // MARK: NSFetchedResultsControllerDelegate - nonisolated func controllerDidChangeContent(_ controller: NSFetchedResultsController) { - MainActor.assumeIsolated { - delegate?.dataSource(self, didUpdateWith: nil) - } + func controllerDidChangeContent(_ controller: NSFetchedResultsController) { + delegate?.dataSource(self, didUpdateWith: nil) } - nonisolated func controller(_ controller: NSFetchedResultsController, didChangeContentWith diff: CollectionDifference) { - MainActor.assumeIsolated { - delegate?.dataSource(self, didUpdateWith: diff) - } + func controller(_ controller: NSFetchedResultsController, didChangeContentWith diff: CollectionDifference) { + delegate?.dataSource(self, didUpdateWith: diff) } // MARK: Predicate