I have a couple of side projects going on, although it is always a challenge to find time of them. One of them, SignalPath, is what I created back in 2015. Currently, I have been spending some time to bump the Swift version to 6 which brought a quite a list of errors. In many places I had code what dealt with observing multiple notifications, but of course Swift 6 was not happy about it.
After moving all of the notification observing to publishers instead, I can ignore the whole sendable closure problem all together.
Great, compiler is happy again although this code could cause trouble if any of the notifications are posted from a background thread. But since this is not a case here, I went for skipping .receive(on: DispatchQueue.main)
. Assign weakly is a custom operator and the implementation looks like this:
If this was helpful, please let me know on Mastodon@toomasvahter orย Twitter @toomasvahter. Feel free to subscribe to RSS feed. Thank you for reading.