Home / IOS Development / Realm Class vs Swift Class? : iOSProgramming

Realm Class vs Swift Class? : iOSProgramming

I’m building an app that requires multiple local Realm tables to store and maintain data. When the app is running, this data will be changed, added and stored again in the Realm tables. The classes themselves will require several functions / methods to manipulate the data and perhaps a few calculated properties.

My question is: Is it better to create a Realm class for my object and apply it to everything I need to do with that data while my program is running (add all my necessary features to it)? Or is it better to just create a Realm class dedicated to loading and storing the data and then copying the data to a Native Swift (NSObject) class that contains the methods the app needs while running it?

I go for the second approach, because with it I can use Arrays and Dictionaries instead of just Lists <> – but it seems redundant in many ways, and there would be a lot of conversion to / from the two classes. I get the feeling that it is “wrong”.

What is the “right” way to handle something like this?


Source link