RealmField and RealmClass for Swift

We have MondoDB Cloud with Android Support. We are developing iOS Side. We wonder If there is a mapping feature like RealmField(for properties) and RealmClass(for classes)

Welcome to the forums!

When you say ‘mapping’, what’s the goal? e.g. if you create a class in iOS that matches the structure/schema of the document stored in MongoDB Atlas, it will work (MongoDB is cross platform) and give you access to those documents in your iOS App.

1 Like

I mean there is a property called “description” type of String in Swift. Also in my db scheme there is a description and its type is another model. I what to map db property to myDescription etc. I kotlin we can use annotation like RealmFiled.
var myDescription: Name? = null
Is there something in Swift? I could not find anything in documents and also in realm swift codes.

@Ali_TANIRLAR one way to do this is to override the _realmColumnNames function (See here). Please note that this should only be used with our legacy property syntax and not the new @Persisted property declaration syntax.

We will need to expose a way to rename the column names for @Persisted in the meantime.

1 Like

Thank you. It worked.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.