Backbone includes an elegant and awesome events system that allows for some beautiful code organization in web apps. The events system lets you put your code where it belongs, rather than being tied in to a bunch of function calls in the event trigger. You can add and remove functionality from different events as well. It’s especially useful for game systems like keeping track of events that count towards achievements.
I wanted this functionality for Krate, my iPhone puzzle game, so I wrote a fast solution that mimics the most usable parts of Backbone’s system for custom Swift events triggering.
You can find it here: Swift Events on GitHub. There’s some examples and more information on using the class. Give it a try and let me know how you like it – it’s very usable right now, but I’m definitely open to feedback and improvements.