michaeljbishop / NGAParallaxMotion

A tiny category on UIView that allows you to set one property: "parallaxIntensity" to achieve a parallax effect with UIMotionEffect
MIT License
641 stars 31 forks source link

Why all the objc_runtime stuff? #8

Closed harlanhaskins closed 10 years ago

harlanhaskins commented 10 years ago

Can't all of that be done much more cleanly with properties inside class extensions or instance variables?

michaeljbishop commented 10 years ago

I could be wrong here but my reading of the documentation implies:

  1. Categories can't have ivars
  2. Class extensions can, but you can only make a class extension on a class for which you are compiling the source code.

Because of this, I have to use the objc runtime to allocate storage to back the property.