How to sort @ObservedResults for List

I just learning about Swift and Realm, I’m following the Realm Database with SwiftUI QuickStart, which is really helpful.

But I was stacked here

@ObservedResults(Group.self) var groups

I know I can use sortDescriptor to sort the group, but I’d like to sort the groups.items by, how can I implement with @ObservedResults?

I’m also trying let sortedGroup.items = group.items.sorted(byKeyPath: "name") . But the onDelete function won’t works since the IndexSet has changed.