So I have a very simple model of a book in the kingdom
class Book: Object { dynamic var title: String! dynamic var author: String! }
And I'm trying to get all my books in a helper class:
var userBookLibrary = [Book]() let realm = try! Realm() func getBooksFromLocalDatastore() { userBookLibrary = realm.objects(Book) }
This line:
userBookLibrary = realm.objects(Book)
produces an error in the header.
Am I crazy or is this not exactly what the Realm documentation tells us?
ios swift realm
ray john
source share