Alexey  Milahin Alexey Milahin - 10 months ago 114
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?


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

Here is the List API: