iZettle / Flow

Flow is a Swift library for working with asynchronous flows and life cycles
MIT License
231 stars 14 forks source link

Added `Delegate` `set(withWeak:callback:)` variant of `set(callback:… #83

Closed mansbernhardt closed 5 years ago

mansbernhardt commented 5 years ago

…)` to help breaking retain cycles.

mansbernhardt commented 5 years ago

As for Delegate I couldn't see an obvious design for supporting multiple weak objects. The most common case is that you have zero or one weak object, and if you have more you just have to do it the old way. As for the signal with(weak:) you can just add as many as you like as shown in the testDoubleWeakly() test:

 bag += rw.with(weak: object1).with(weak: object2).atOnce().onValue { value, obj1, obj2 in