runtime.get is currently making use of function overloading to create and cache reactive versions of non-reactive objects. This will create problems when working with sub-types, such as CAShapeLayer, because now the sub-type has its own cache. Consider the following example:
let shapeLayer = CAShapeLayer()
let layer: CALayer = shapeLayer
let reactiveShapeLayer = runtime.get(shapeLayer)
let reactiveLayer = runtime.get(layer)
// reactiveShapeLayer !== reactiveLayer
Note that even though we're using the same shape layer instance, we get a different reacitve object instance depending on the type of the variable we pass to runtime.get. This will lead to unexpected behavior in practice and we should consider alternative solutions to this.
runtime.get
is currently making use of function overloading to create and cache reactive versions of non-reactive objects. This will create problems when working with sub-types, such as CAShapeLayer, because now the sub-type has its own cache. Consider the following example:Note that even though we're using the same shape layer instance, we get a different reacitve object instance depending on the type of the variable we pass to
runtime.get
. This will lead to unexpected behavior in practice and we should consider alternative solutions to this.