The below code doesn’t run first time, but when I close the app and re-open it, it works.
Could someone please explain why this is happening
class Singleton {
func observe() {
guard let config, let user_id ....
let realm = try! Realm(configuration: config)
let mee = realm.object(ofType: Person.self, forPrimaryKey: user_id)
// is nil first time I run it, even if data proper exists
guard let meeee = mee else {
print("incomplete USER")
return
}
}
}