Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个对象数组。每个对象都有一个键“用户名”。
有没有一种快速的方法可以将这个对象数组按升序排序?
(array(at: indexPath.row) as AnyObject).value(forKey: "username") as? String)!
谢谢
yourArray.sorted({ $0.username < $1.username})