Add new Objective C subscripting to your own objects
The new Objective C literal syntax is a huge leap forward in syntax - especially in terms of accessing arrays and dictionaries using subscripts.
Have you ever wanted to add subscripting to your own app? You just need to add some secret methods:
Kinda dictionary-ey?So, let's say you want to add a hash style keyed subscript to an object, you can use it like this:
Or maybe array-ey?Or if you want to add an indexed style (like an array):
Shameless plug - I gave a talk about the new literals at the London Ruby Users Group. Check it out here: http://skillsmatter.com/podcast/home/objective-c-for-rubyists