realm-cocoa

how to convert RealmSwift List to Results?

雨燕双飞 提交于 2019-12-22 04:26:23
问题 I am using a Realm List/Results as my dataSource for a UITableView . At some point I assign a list to it. like: var dataSource:List<SomeObject>! // Or >> Results<SomeObject>! let aRealmObject = realm.objectForPrimaryKey(SomeObject.self, key: objectId) dataSource = aRealmObject.someList // dataSource should be List Then I have a filter on this list If the user changed the filter dates, I do like this: dataSource = dataSource.filter("FILTER THE DATES",newDates) // dataSource should be Results

how to convert RealmSwift List to Results?

做~自己de王妃 提交于 2019-12-05 02:47:06
I am using a Realm List/Results as my dataSource for a UITableView . At some point I assign a list to it. like: var dataSource:List<SomeObject>! // Or >> Results<SomeObject>! let aRealmObject = realm.objectForPrimaryKey(SomeObject.self, key: objectId) dataSource = aRealmObject.someList // dataSource should be List Then I have a filter on this list If the user changed the filter dates, I do like this: dataSource = dataSource.filter("FILTER THE DATES",newDates) // dataSource should be Results But the line above causes an error as the return type of filter is a Results object and aRealmObject