Search code examples
ioscore-datapersistencegetter-setter

Can properties that are not persisted have getters and setters?


I am using getters and setters on some computed properties, and I do not want to store the values for these properties in the database. Can properties that are not persisted have getters and setters?


Solution

  • Yes, of course non-persisted properties can have getters and setters. There is no relationship between the 2 things, other than the fact that custom getters/setters are a pretty common place to put your code for reading/writing to your persistent store.