TomKnig/TOMSMorphingLabel — pull request #22 by wanderwaltz (2014-11-22 03:29:02+00:00)
Title: Break the strong reference cycle between CADisplayLink and TOMSMorphingLabel.

Hi, I've implemented a simple solution to the retain cycle problem described in #12. Please tell if that works for you.

`CADisplayLink` retains the object set as its target and `TOMSMorphingLabel` references the display link strongly. This gives a strong reference cycle and `TOMSMorphingLabel` is never deallocated. This PR adds a helper class named `TOMSMorphingLabelWeakWrapper` which holds a weak reference to the label and forwards necessary messages to it. This breaks the reference cycle and allows deallocating the label.

Note that if the weak wrapper's label reference gets nullified due to the label being deallocated, the display link would continue firing its events to the weak wrapper. So it is necessary to properly invalidate the display link in the `TOMSMorphingLabel`'s dealloc.