This is the code causing the warning:
private override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes
In addition to the great answer above.
I know the example code is written in swift, but I thought that it can be helpful to have the Objective-C version.
For Objective-C, this won't work, because the copy function does only a shallow copy. You will have to do this:
NSArray * original = [super layoutAttributesForElementsInRect:rect];
NSArray * attributes = [[NSArray alloc] initWithArray:original copyItems:YES];
I have added a temp variable for readability.