WeakErased

WeakErased is a property wrapper to hold objects with a weak reference when using type-erasure.

Create this wrapper using an initial value and a closure to create the type-erased object. Make sure to not create a WeakErased wrapper for already type-erased objects, since their reference is most likely instantly lost.

  • The type-erased or otherwise mapped version of the value being held weakly.