Alexey  Milahin Alexey Milahin - 2 years ago 197
Swift Question

How to move objects in Realm

I have Realm data model

import RealmSwift

class Priority: Object {

dynamic var id = ""
dynamic var text = ""
dynamic var time = ""

And I can get all the stored objects

let realm = try! Realm()
let objects = realm.objects(Priority)

How to move an object from the index 7 in the index 3 and save the table?

Answer Source

You can put the Objects in Realm List, then you can use both move and swap methods to reorder.

Here is the List API:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download