Created
July 27, 2014 17:51
-
-
Save pocketkk/db5895d64a212a6e9ea1 to your computer and use it in GitHub Desktop.
Swift - Sort objects by date field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@objc(Note) | |
class Note: NSManagedObject { | |
@NSManaged var content: String | |
@NSManaged var date: NSDate | |
@NSManaged var business: Business | |
@NSManaged var coldcall: ColdCall | |
@NSManaged var contact: Contact | |
} | |
let notes : [Note] = //array of notes | |
// sort a collection of notes by date | |
notes.sort({$0.date.timeIntervalSinceNow > $1.date.timeIntervalSinceNow}) |
Do this just skip to the end in the vid and the code is there.
https://www.youtube.com/watch?v=SeL9NteSLjE&lc=z22aihfj1ybvs33vsacdp43bixck4drobt441esqxatw03c010c
👍
Thank you so muccch
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It showing error
Binary operator '<' cannot be applied to two 'TimeInterval?' (aka 'Optional') operands
what to do ?