Is substitution of block-function parameters OK when it's an object type?
Is substitution of block-function parameters OK when it's an object type?
- Subject: Is substitution of block-function parameters OK when it's an object type?
- From: Daryle Walker <email@hidden>
- Date: Tue, 05 Aug 2014 12:38:04 -0400
Some code I just wrote to implement history menus for my browser’s back and forward buttons:
[[backForwardList backListWithLimit:(int)maxMenuLength] enumerateObjectsWithOptions:NSEnumerationReverse usingBlock:^(WebHistoryItem *obj, NSUInteger idx, BOOL *stop){
The type of “obj” was originally “id,” but I changed it to what I knew the NSArray object actually held. The compiler accepted it. Can I change any block parameter, or only ones that are Objective-C objects? (For example, would changing the type of “idx” or “stop” cause errors?) What happens if I use the wrong Objective-C type?
—
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden