![]() ![]() One can imagine a situation where the shared common sub-module needs a function to log a message, but the platforms have different ways of doing it. This mechanism works as follows: The Common sub-module "expects" that the declaration exists, and the platform sub-modules provide the "actual" declaration. It works for most of Kotlin declarations, such as: The declaration is a Kotlin Multiplatform specific feature. ![]() The following sections will describe two ways which can be used to shared code: The "Expect and Actual declaration" and "Dependency inversion". The sub-modules are irrelevant because depending on the platform, only the corresponding will be included. The client modules for the apps (Android, React) have only a dependency on the shared module.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |