I am trying to get the realm object results and iterate through the results like an array. Here is my code
func getStore(){
let user = realmApp.currentUser()
let partitionValue = "depth"
Realm.asyncOpen(configuration: (user?.configuration(partitionValue: partitionValue))!,
callback: { (maybeRealm, error) in
guard error == nil else {
fatalError("Failed to open realm: \(error!)")
}
guard let realm = maybeRealm else {
fatalError("realm is nil!")
}
// realm opened
let tasks = realm.objects(shipwreck.self)
print("Here is the result", tasks)
})
}
however this is what i got as print out
Sync: Connection[1]: Connected to endpoint 'xxxxxxxxx' (from '1xxxxxxx0') Here is the result []
how can I access the realm result and iterate through them?