从Int列获取最大值的最佳和最有效的方法是什么?
想法A.
let maxId = realm.objects(Books).sorted("id").last
Run Code Online (Sandbox Code Playgroud)
想法B.
let maxId = realm.objects(Books).sorted("id", ascending: false).first
Run Code Online (Sandbox Code Playgroud)
还是另一个想法?
(是的,我的代码片段只会返回ID最高的对象,而不是实际值)