How to create content?
For example, you want to create content named MyFormat. To do this, you must perform the following actions:
- Copy
templatefolder fromcore/featuresincore/features/content - Rename this folder in
myformat - Inside the
myformatfolder rename all thetemplateoncontent.myformat - In the
settings.gradlefile in theincludesarray add the following code:String[] includes = [ ... ":features:content:myformat:common", ":features:content:myformat:client", ":features:content:myformat:server", ... ] - In the
core/features/content/myformat/common/srcfolder create folders with appropriate subfolderscommonMain/kotlin/dev/inmo/postssystem/features/content/myformat/common: - In the last folder
сommon, create a data class and the configurator as shown below:// MyFormatContent.kt @Serializable data class MyFormatContent( // Your code ) : Content // MyFormatContentSerializerModuleConfigurator.kt object MyFormatContentSerializerModuleConfigurator : ContentSerializersModuleConfigurator.Element { override fun PolymorphicModuleBuilder<Content>.invoke() { subclass(MyFormatContent::class, MyFormatContent.serializer()) } } - In two
di.ktfile located incore/client/src/commonMain/kotlin/dev/inmo/postsystem/clientandcore/server/src/main/java/dev/inmo/postsystem/clientrespectively add the following string:
singleWithRandomQualifier<ContentSerializersModuleConfigurator.Element> { MyFormatContentSerializerModuleConfigurator }