Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid MainActor.assumeIsolated #265

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions Sources/PulseUI/Features/Console/ConsoleDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ protocol ConsoleDataSourceDelegate: AnyObject {
func dataSource(_ dataSource: ConsoleDataSource, didUpdateWith diff: CollectionDifference<NSManagedObjectID>?)
}

@MainActor
final class ConsoleDataSource: NSObject, NSFetchedResultsControllerDelegate {
weak var delegate: ConsoleDataSourceDelegate?

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -135,16 +134,12 @@ final class ConsoleDataSource: NSObject, NSFetchedResultsControllerDelegate {

// MARK: NSFetchedResultsControllerDelegate

nonisolated func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
MainActor.assumeIsolated {
delegate?.dataSource(self, didUpdateWith: nil)
}
func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
delegate?.dataSource(self, didUpdateWith: nil)
}

nonisolated func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChangeContentWith diff: CollectionDifference<NSManagedObjectID>) {
MainActor.assumeIsolated {
delegate?.dataSource(self, didUpdateWith: diff)
}
func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChangeContentWith diff: CollectionDifference<NSManagedObjectID>) {
delegate?.dataSource(self, didUpdateWith: diff)
}

// MARK: Predicate
Expand Down
Loading