3 ms·
Swizzling? Why not just override the event method in a class derived from UIApplication? That's what I do if I want to see all user events, works just fine.
by DenisM 13y ago
Swizzling? Why not just override the event method in a class derived from UIApplication? That's what I do if I want to see all user events, works just fine.
- Greenisus 13y agoMost iOS developers prefer to use composition (categories + swizzling) over subclassing because subclassing can have unexpected side effects depending on what you subclass. (I haven't tried subclassing UIApplication, so I don't doubt what you're saying at all.)
- matm 13y agoThat would require modifying existing code. Which is fine if you're adding automatic event-tracking directly to your own app. But for a third-party library (like our own), it exacerbates the integration process. Method swizzling allows for a purely drop-in solution.
- DenisM 13y agoConsider that you spent over 400 words describing what swizzling is, and you likely lost a lot of audience in those vast plains of text. For example, you lost me. Having stumbled on it, I couldn't bring myself to finish the piece. I actually do need an analytics solution for our iOS app, but this blog post just fell into "I will read it later" category, out of "I will read it now".
- matm 13y agoThis post was primarily written for a iOS dev-centric audience. I wanted to focus more on the underlying technical pieces than on selling Heap itself. Noted, though, that we lost you with the piece's verbosity.