I am having problems with an object that returns to me in Realm, the strange thing is that if I printo by console the object if it gives me a good impression but nevertheless if I try to access its value it tells me that it is empty. The structure of the object is as follows:
class Favourite : Object {
var character : Character!
}
I create an object and add it to the BD
let fav = Favourite()
fav.character = character
FavouriteDao.sharedInstance.addFavourite(characterFavourite: fav)
I get all favorite type objects
func getAllFavourites () - > Results { return realm.objects (Favorite.self) }
When I get the item and I make a print
Favourite {
character = Character {
name = Spider-Man;
descriptionC = Bitten by a radioactive spider, high school student Peter Parker gained the speed, strength and powers of a spider. Adopting the name Spider-Man, Peter hoped to start a career using his new abilities. Taught that with great power comes great responsibility, Spidey has vowed to use his powers to help people.;
thumbnail = Thumbnail {
id = 815D93D0-C116-4267-978C-9E47C0074D0D;
path = http://i.annihil.us/u/prod/marvel/i/mg/3/50/526548a343e4b;
extensionImage = jpg;
};
};
If I try to access the character element, it tells me that it's nil
Someone manages to understand why if I make a print of the favorite object it shows me that there is a character inside but nevertheless if I try to access it, it tells me that it does not exist ??
Greetings.