Skip to content

Commit ecaab63

Browse files
committed
0.1.0
1 parent b00b0f4 commit ecaab63

File tree

3 files changed

+12
-23
lines changed

3 files changed

+12
-23
lines changed

shared/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ plugins {
77
kotlinMultiplatform
88
kotlinNativeCocoapods
99
androidLib
10-
kotlinKapt
1110
kotlinxSerialization
1211
daggerHiltAndroid
1312
mokoKSwift
@@ -211,7 +210,9 @@ tasks.withType<KotlinNativeLink>()
211210
.dir("${binary.baseName}Swift")
212211
.asFile
213212

214-
val kSwiftPodSourceDir = buildDir
213+
val kSwiftPodSourceDir = layout.buildDirectory
214+
.asFile
215+
.get()
215216
.resolve("cocoapods")
216217
.resolve("framework")
217218
.resolve("${binary.baseName}Swift")

shared/src/commonMain/kotlin/com/hoc081098/github_search_kmm/utils/LCE.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,14 @@ sealed interface EitherLCE<out L, out R> {
1616

1717
fun <L, R> eitherLceFlow(function: suspend () -> Either<L, R>): Flow<EitherLCE<L, R>> =
1818
flowFromSuspend(function)
19-
.map<Either<L, R>, EitherLCE<L, R>> { EitherLCE.ContentOrError(it) }
19+
.map<_, EitherLCE<L, R>> { EitherLCE.ContentOrError(it) }
2020
.onStart { emit(EitherLCE.Loading) }
2121

2222
sealed class LCE<out T> {
2323
data object Loading : LCE<Nothing>()
2424
data class Content<out T>(val content: T) : LCE<T>()
2525
data class Error(val error: Throwable) : LCE<Nothing>()
2626

27-
@Suppress("NOTHING_TO_INLINE")
28-
companion object Factory {
29-
inline fun <T> content(content: T): LCE<T> = Content(content)
30-
inline fun <T> loading(): LCE<T> = Loading
31-
inline fun <T> error(error: Throwable): LCE<T> = Error(error)
32-
}
33-
3427
inline fun <R> map(f: (T) -> R): LCE<R> = when (this) {
3528
is Content -> Content(f(content))
3629
is Error -> Error(error)
@@ -44,7 +37,14 @@ sealed class LCE<out T> {
4437
Loading -> Loading
4538
}
4639

47-
inline val isLoading: Boolean get() = this === Loading
40+
inline val isLoading: Boolean get() = this == Loading
4841

4942
inline val contentOrNull: T? get() = (this as? Content)?.content
43+
44+
@Suppress("NOTHING_TO_INLINE")
45+
companion object Factory {
46+
inline fun <T> content(content: T): LCE<T> = Content(content)
47+
inline fun <T> loading(): LCE<T> = Loading
48+
inline fun <T> error(error: Throwable): LCE<T> = Error(error)
49+
}
5050
}

shared/src/commonMain/kotlin/com/hoc081098/github_search_kmm/utils/flowExt.kt

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)