PredicateControllerDelegate#3
Conversation
| /// Notified when the predicate of the `UIPredicateEditor`will change. | ||
| /// | ||
| /// The `object` on the `Notification` will be the editor. | ||
| @available(*, deprecated, message: "Utilize `PredicateControllerDelegate`") |
There was a problem hiding this comment.
I made the assumption that you wanted to switch to a delegate in place of using Notifications. I can easily remove the deprecation if that wasn't the intent.
| func notifyPredicateWillChange() { | ||
| delegate?.predicateWillChangeForPredicateController(self) |
There was a problem hiding this comment.
Since the class was already @MainActor isolated, (and the delegate is also @MainActor annotated), it didn't seem necessary to repeat the annotations here and use the detached Task { @MainActor in ... } in the updatePredicate(for:) methods above.
I'm still coming up to speed on the Swift 6 concurrency changes, so I might be missing something.
| // We assume the first row is the root container if available. | ||
| // If we have no rows, we have no predicate. | ||
| guard !requiredRowTemplates.isEmpty else { | ||
| guard !requiredRowTemplates.isEmpty, !rowTemplates.isEmpty else { |
There was a problem hiding this comment.
Additional check here for the rowTemplates. When this was empty the access below of rowTemplates[0] would throw an index out of bounds error.
I noticed the comments in
PredicateControllerSo, I thought this might be a good task to become more familiar with the code. I created the
PredicateControllerDelegateprotocol with methods to match the Notification Center Notifications, and called those in parallel with firing the notifications.I also corrected a couple spelling mistakes in the comments.