How to use NSIndexSet

it would be the proper way: NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 3)]; or you can use the NSMutableIndexSet for the random indexes: NSMutableIndexSet *mutableIndexSet = [[NSMutableIndexSet alloc] init]; [mutableIndexSet addIndex:0]; [mutableIndexSet addIndex:2]; [mutableIndexSet addIndex:9]; etc.

CoreFoundation vs Foundation

In a technical sense, yes, it is faster, for exactly that reason. In a practical sense, no, it’s not faster. For one thing, the speed difference is tiny. We’re talking milliseconds saved over the life of the entire process. The savings might be bigger on the iPhone, but it’s still pretty much the tiniest speed … Read more

What am I doing wrong with allowsFractionalUnits on NSDateComponentsFormatter?

According to Open Radar #32024200: After doing some digging (disassembling Foundation), it looks like every call to -[_unitFormatter stringFromNumber:] in -[NSDateComponentsFormatter _stringFromDateComponents:] is passed an +[NSNumber numberWithInteger:] which drops floating point data. You’re not doing anything wrong. The flag is simply broken.

Can’t pass Date to NSPredicate(format: …) without “as CVarArg”

The %@ format expect a Foundation object as argument, compare “Predicate Format String Syntax” in the “Predicate Programming Guide”. Therefore you have to cast the overlay type Date back to its Foundation counterpart NSDate: let endDate = Date() let pred = NSPredicate(format: “endDate == %@”, endDate as NSDate)