For tomorrow’s launch of KoboldTouch I made a quick 6-minute presentation about KoboldTouch and what makes it special.
Not everything made it into the presentation. There’s a couple things that may be worth adding or stressing:
First of all, ARC. Seriously, if you’re not using ARC today, right now, you’re doing yourself a HUGE disservice. KoboldTouch does not only allow you to write ARC code, KT itself is written using ARC. You’ll see how much cleaner code gets when you don’t have to consider release, autorelease or retain anymore.
Secondly, zeroing weak references are a fundamental aspect of KoboldTouch development. It makes it so easy to avoid retain cycles, and it makes a couple things easier for you too. For example, if you forget to unregister a delegate – it doesn’t matter! KT classes providing a delegate property declare the delegate as weak reference, so there won’t be a crash if you don’t unregister, and in fact you don’t have to unregister delegates at all.
Classes that can have multiple delegate will clean up the delegates when a scene change occurs. Again this is to prevent crashes or leaks due to accidentally forgetting to unregister a delegate.
Lastly, zeroing weak references enable KoboldTouch to actually catch and warn about a memory leak! If shortly after a scene change the previous scene’s reference hasn’t been nil’ed automatically, KoboldTouch knows that the scene is still in memory for whatever reason. This will raise an exception, and then you know about the leak when it first occurs. It’s a lot easier to figure out and fix the cause for such a leak when you’re still aware of the changes you did most recently.
|Follow @gaminghorror||Follow @kobold2d|