Skip to content

Commit

Permalink
starting to use backing fields
Browse files Browse the repository at this point in the history
  • Loading branch information
joreilly committed Jun 15, 2024
1 parent 6fe3861 commit 53a9e4d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
6 changes: 6 additions & 0 deletions androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,10 @@ dependencies {
androidTestImplementation("androidx.test:runner:1.5.2")

implementation(project(":common"))
}


kotlin.sourceSets.all {
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
languageSettings.enableLanguageFeature("ExplicitBackingFields")
}
7 changes: 3 additions & 4 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ kotlin {
}

sourceSets {
all {
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
}

commonMain.dependencies {
implementation(libs.kotlinx.coroutines)
implementation(libs.kotlinx.serialization)
Expand Down Expand Up @@ -96,6 +92,9 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach
}

kotlin.sourceSets.all {
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
languageSettings.optIn("kotlin.experimental.ExperimentalObjCName")
languageSettings.enableLanguageFeature("ExplicitBackingFields")
}


Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@ class NetworkDb: RealmObject {
var longitude: Double = 0.0
}



class CityBikesRepository: KoinComponent {
private val cityBikesApi: CityBikesApi by inject()
private val realm: Realm by inject()

private val mainScope: CoroutineScope = MainScope()

private val _groupedNetworkList = MutableStateFlow<Map<String,List<Network>>>(emptyMap())
val groupedNetworkList: StateFlow<Map<String,List<Network>>> = _groupedNetworkList
val groupedNetworkList: StateFlow<Map<String,List<Network>>>
field = MutableStateFlow<Map<String,List<Network>>>(emptyMap())

private val _networkList = MutableStateFlow<List<Network>>(emptyList())

Expand All @@ -46,7 +48,7 @@ class CityBikesRepository: KoinComponent {
_networkList.value = it.toList().map {
Network(it.id, it.name, it.city, it.country, it.latitude, it.longitude)
}
_groupedNetworkList.value =
groupedNetworkList.value =
_networkList.value.groupBy { it.country }
}
}
Expand Down
5 changes: 5 additions & 0 deletions compose-desktop/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ dependencies {
application {
mainClass.set("MainKt")
}

kotlin.sourceSets.all {
languageSettings.optIn("kotlinx.cinterop.ExperimentalForeignApi")
languageSettings.enableLanguageFeature("ExplicitBackingFields")
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ kotlin.mpp.stability.nowarn=true

xcodeproj=./ios/BikeShare

kotlin.jvm.target.validation.mode = IGNORE

# https://twitter.com/Sellmair/status/1543938828062392322
import_orphan_source_sets=false
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ coroutines = "1.8.1"
kotlinxSerialization = "1.6.3"
kotlinxDateTime = "0.6.0"

androidGradlePlugin = "8.4.1"
androidGradlePlugin = "8.5.0"
koin = "3.6.0-Beta4"
koin-android-compose = "3.6.0-Beta4"
koin-compose-multiplatform = "1.2.0-Beta4"
Expand Down

0 comments on commit 53a9e4d

Please sign in to comment.