iosswiftrealmobjectmapper

Cannot access realm fetched data


I successfully fetch my Board data via

let boards: [Board] = try! db.fetch(FetchRequest<Board>())

After that I iterate over boards an make a

print(board)

which outputs:

Board {
    id = 1;
    name = The Name;
    shortDescription = The Description;
    slug = the_name;
}

But when I want to access the board name directly with e.g.

 board.name

the following Error is thrown:

fatal error: unexpectedly found nil while unwrapping an Optional value

What´s my mistake? If board is not an Object, how I can achieve that it will be one?

I´m using:

SugarRecord
ObjectMapper 
RealmSwift
ObjectMapper_Realm

Solution

  • Through the missing Documentation in ObjectMapper_Realm i didn´t had the

     dynamic
    

    keyword in front of my var declaration.