ObservedResults is empty when using it in the body RealmSync SwiftUI

I’m having issues after changing the Realm to a Sync Realm Db, when using the local realm it was working well, the issue here is that I’m using an ObservedResults object and passing it to the custom picker view to display the content of the results, if I print the content in the init of the first view, I can see the data but when I pass it to the custom Picker View the array is empty.

This is when I’m getting the result with the ObservedResults

@ObservedResults(AccountType.self) var accountTypes

When I print the results in the init it prints the data correctly, it shows that I have 3 items in the collection, which is correct

print("Account Types: \(accountTypes), Count: \(accountTypes.count)")

Here I’m mapping the data from the results to pass it into the custom picker view, here is the issue, the result at this point is empty, any thoughts?

CustomPickerView(itemIndex: $accountTypeIndex, items: accountTypes.map { return $0.typeDescription }, length: accountTypes.count, pickerName: Constants.accountTypePicker, offsetX: -95)

And the data that is coming in the array I cannot see it in the Atlas server, it’s supposed to be a sync realm but for some reason is not working. Any help would be greatly appreciated.

If any other code snippet is needed I can add it.

This is working well now, I was using Partition Sync, but I changed that to use Flexible Sync and it’s working correctly.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.