nsfetchrequest - NSSortDescriptor sorting using NSDate in Swift -



nsfetchrequest - NSSortDescriptor sorting using NSDate in Swift -

how sort nsfetchrequest date property of managed object. creates array dates going in order?

here code far...

var request : nsfetchrequest = nsfetchrequest(entityname: "history"); request.predicate = nspredicate(format: "counts = %@", true) request.sortdescriptors = [???] <- should set here? var results : [nsmanagedobject] = context.executefetchrequest(request, error: nil) [nsmanagedobject]

// newest first request.sortdescriptors = [nssortdescriptor(key: "date", ascending: false)]

nb: not need : [nsmanagedobject] if have as [nsmanagedobject]. you not need : nsfetchrequest when utilize mill method of nsfetchrequest.

swift nsfetchrequest nssortdescriptor

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -