In the Meet AsyncSequence talk, there's a very cool use case that's shown in one of the slides - the new notifications
property on NotificationCenter
is an async sequence and the code sample does something like:
let notification = await center.notifications(named: ....).first { ... }
This seems really intriguing and useful to me but I had a few questions about the details of how this works:
- What is the type of
notification
in this snippet? ATask
? Where would I store this value? - What context should this be invoked in, especially if I want to have a long-running notification filter running that will remain active for the lifetime of the app?
Basically, I'm curious to see an example of the code surrounding this snippet.