Sahil Kapoor Sahil Kapoor - 1 year ago 1198
Swift Question

RealmSwift: Convert Results to Swift Array

What I want to implement:

class func getSomeObject() -> [SomeObject]? {
let objects = Realm().objects(SomeObject)

return objects.count > 0 ? objects : nil

I want to return objects as
instead if

Answer Source

Weird, the answer is very straight forward. Here is how I do it:

let array = Array(results) // la fin
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download