This link tells you what your sorting function has to look like, but I just can't make a Swift function look like that.
Here's my call:
packetsArray.sortUsingFunction(comparePacketDates, context: nil)
Here's my function, and I've tried a zillion other variations of it:
static func comparePacketDates(packet1 : AnyObject, packet2: AnyObject, context: UnsafeMutablePointer<Void>) -> Int {
And I've tried using a c function instead, this and a few other variations:
NSInteger comparePacketDates(id packet1, id packet2, void* dummy);
It's always "cannot invoke with argument list ..." saying the function isn't what's expected as the first argument.
Does anyone have example code of a Swift function that would be accepted as the first argument of the Swift sortUsingFunction? Or even a c function that would be accepted as the first argument of the Swift SortUsingFunction?