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
Post a Comment