-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I would be nice to have ObjC blocks translation
as promised, here are the snippets
e.g:
Objective C blocks without params
[UIView animateWithDuration:0.2
animations:^{view.alpha = 0.0;}]to ruby
UIView.animateWithDuration(0.2, animations: -> { view.alpha = 0.0 })Objective-C blocks with one params
[UIView animateWithDuration:0.2
animations:^{view.alpha = 0.0;}
completion:^(BOOL finished){ [view removeFromSuperview]; }];to ruby
UIView.animateWithDuration(0.2,
animations:-> { view.alpha = 0.0 },
completion:-> finished { view.removeFromSuperview })Objective-C Blocks with two arguments
[aSet enumerateObjectsUsingBlock:^(id obj, BOOL *stop){
if ([obj localizedCaseInsensitiveCompare:aString]==NSOrderedSame) {
NSLog(@"Object Found: %@", obj);
*stop = YES;
}
} ];to ruby using different lambda syntax:
the_set.enumerateObjectsUsingBlock(lambda do |obj, stop|
if obj.localizedCaseInsensitiveCompare(the_str) == NSOrderedSame
NSLog("Object Found: %@", obj)
stop.assign(true)
end
end)and so on
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels