This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// commonMain | |
expect val platformModule: Module | |
val sharedModule = module { | |
includes(platformModule) | |
} | |
// mobileMain | |
actual val platformModule = module { | |
singleOf(::DataRepository) { bind<IDataRepository>() } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// commonMain | |
expect val dataRepository: IDataRepository | |
// mobileMain | |
actual val dataRepository: IDataRepository = object : IDataRepository { | |
// Room and DataStore logic here | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val mobileMain = create("mobileMain") { | |
kotlin.srcDir("src/mobileMain/kotlin") | |
dependsOn(commonMain) | |
dependencies { | |
implementation(libs.androidx.data.store.core) | |
implementation(libs.androidx.room.runtime) | |
implementation(libs.sqlite.bundled) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
Theme { | |
Surface { | |
MainScreen(mainViewModel = MainViewModel()) | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ferg.componentmash | |
import android.app.Activity | |
import android.os.Bundle | |
import androidx.activity.compose.setContent | |
import androidx.compose.animation.animateColorAsState | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Arrangement | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.Column |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String file contents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Demo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Demo |