-
Notifications
You must be signed in to change notification settings - Fork 1.2k
NSMutableArray replaceObjectsInRange:withObjectsFromArray:range: #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -658,7 +658,10 @@ public class NSMutableArray : NSArray { | |||
} | |||
} | |||
} | |||
public func replaceObjectsInRange(range: NSRange, withObjectsFromArray otherArray: [AnyObject], range otherRange: NSRange) { NSUnimplemented() } | |||
public func replaceObjectsInRange(range: NSRange, withObjectsFromArray otherArray: [AnyObject], range otherRange: NSRange) { | |||
replaceObjectsInRange(range, withObjectsFromArray: otherArray.bridge().subarrayWithRange(otherRange)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the bridge here is not needed since otherArray is already an Array<AnyObject>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'm on it.
@phausler OK, I switched it to convert the |
@phausler I just saw your comment on #139 (which is another implementation of the same method) saying it should work like this: var list = [AnyObject]()
array.getObjects(&list, range:otherRange)
replaceObjectsInRange(range, withObjectsFromArray:list) Should I update the implementation in this PR to follow that pattern? |
Personally I think that is the most reasonable pattern: I will likely try to merge all of the unit tests together from the desperate requests for this implementation |
Hmm... Just looked at it and noticed that it only works if we bridge var list = [AnyObject]()
otherArray.bridge().getObjects(&list, range:otherRange)
replaceObjectsInRange(range, withObjectsFromArray:list) |
yea bridge is fine here, usually we have tried to use ._swiftObject internally to Foundation bridge is just a simple wrapper around that. |
…otherRange: per suggestions
Ready for review again. |
looks good to me |
NSMutableArray replaceObjectsInRange:withObjectsFromArray:range:
Add infrastructure for test projects using IndexStoreDB's "Tibs"
Tested and implemented NSMutableArray's
replaceObjectsInRange:withObjectsFromArray:range: