swift - way to purge all but one object types (models) in a realm -


i want realm.delete() 1 model in realm. there way without listing of them?
maybe way loop through types existing in realm?

you can access types realm configuration, filter them exclude 1 want keep delete each object of each type don't want keep.

let typetobekept = myobjectclass.self realm.configuration.objecttypes?.filter{$0 != typetobekept}.foreach{ type in     try! realm.write {         realm.delete(realm.objects(type.self))     } } 

Comments

Popular posts from this blog

sql - Time in datatime field -

javascript - How to split the success output from an Ajax post? -

java - sharing object across different classes -