Swift - Sorting an array retrieved from Core Data [duplicate]
问题 This question already has an answer here : Sorting Array received from Core Data in Swift (1 answer) Closed 6 years ago . I want to sort the array with usernames that I retrieve from my core data. I retrieve it like this: override func viewDidAppear(animated: Bool) { let appDel:AppDelegate = UIApplication.sharedApplication().delegate as AppDelegate let context:NSManagedObjectContext = appDel.managedObjectContext! let freq = NSFetchRequest(entityName: "User") let en = NSEntityDescription