Realm Model generation across platforms

Hi,

I’m looking for any tips about making it easy to generate realm model objects across different platforms. It seems quite fiddly getting them matched and I wondered if there’s any good strategies for making it simpler.

I saw that it’s possible to generate language specific models using the Realm Studio tool, but the generated code isn’t always the best object structure and it’s a manual process.

Ideal would be something like protocol buffers that you could check into a single repo and reference from many projects. Is that too hopeful?

Hi Jason - sorry for the long wait …

Currently Realm Studio is the only tool that we provide (and I know of) which can generate the language specific code. Although it’s not a separate package, the part of Realm Studio responsible for this is highly decoupled from the rest of Realm Studio: https://github.com/realm/realm-studio/tree/master/src/services/schema-export, it should be fairly easy to repurpose for your need.
I added an issue in the Realm JS repository with a suggestion to build and publish this as a separate package on NPM. Although I don’t know what the priority of getting that solved would be.

but the generated code isn’t always the best object structure

I would love specific suggestions on how to improve this.

1 Like