new fear unlocked
how are we supposed to implement the delegate pattern now in Swift?
new fear unlocked
how are we supposed to implement the delegate pattern now in Swift?
I believe you can put a weak var in an actor without a warning. If Foo can't be an actor itself, you could have some sort of inner actor where you store the weak var instead.
Something like this. Not saying it's awesome, but it works.
Someone will inevitably tell you to just not use a delegate pattern because delegate patterns are unequivocally bad or whatever.
Unfortunately, some problems just don't have a more elegant alternative solution.