Is it possible to have a CBLModel property that is not added to the database?


#1

I would like to have a property on my CBLModel derived class that does not get added to the database. Is it possible to communicate to the framework that a property should not be persisted?


#2

Sure, just don’t declare it @dynamic.


#3

That simple :blush:

Or alternatively leave @dynamic and create a setter and getter that do not call super?


#4

@dynamic just tells the compiler “don’t complain if there’s no getter or setter”. So if you provide those methods, you may as well leave off @dynamic.

The hookup to the persistent storage is made when the Obj-C runtime fails to find a method for the getter or setter, and asks the CBLModel implementation to provide one. It creates a method that accesses the document property.


#5

Thanks for the explanation, that makes sense.