-
-
Save mralexgray/f9bb3b13537f834289b2 to your computer and use it in GitHub Desktop.
NodObjC works with ObjC Blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = require 'nodobjc' | |
$.import 'Foundation' | |
$.NSAutoreleasePool 'new' | |
randChar = -> $(String.fromCharCode Math.round(Math.random() * 26) + 'a'.charCodeAt 0 ) | |
array = $.NSMutableArray 'new' | |
array 'addObject', randChar() for i in [1..10] | |
signature = ['v',['?', '@','I','^B']] | |
blockDecl = ((self, obj, index, bool) -> console.log "#{obj} == #{index}") | |
array 'enumerateObjectsUsingBlock' : $ blockDecl, signature | |
console.log array 'componentsJoinedByString' : $ ',' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment