Skip to content

Instantly share code, notes, and snippets.

@iurimatias
Created March 6, 2014 09:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iurimatias/9385800 to your computer and use it in GitHub Desktop.
Save iurimatias/9385800 to your computer and use it in GitHub Desktop.
module MyExtension
def [](index)
#this works in iOS but in OSX self is treted as a Fixnum
self.indexAtPosition(index)
end
end
class NSIndexPath
include MyExtension
end
index_path = NSIndexPath.indexPathWithIndex(3)
index_path[0] #=> works in iOS but fails in OSX
#iOS => returns 3
#OSX => #<NoMethodError: undefined method `indexAtPosition' for 826:Fixnum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment