I have a Realm database, in which I store my entries. Storing & querying work without any problems. I know in Swift Realm Results are lazy but I can't get why this is happening.
My code:
newsItems = databaseHelper.retriveAllNews()
//[...] this is on tableView method
let currentNew = newsItems[indexPath.row]
print(currentNew)
newsCell.newsTitle.text = currentNew.title
newsCell.newsText.text = currentNew.info
print(..)
currentNew
newsCell.newsTitle
newsCell.newsText
The most likely cause of the problem you're seeing is omitting the dynamic
modifier from the property declarations in your model class. The dynamic
modifier is necessary to ensure that Realm has an opportunity to intercept access to the properties, giving Realm an opportunity to read / write the data from the file on disk. Omitting these properties results in the Swift compiler accessing the instance variables directly, cutting Realm out of the loop.