Tristan
05/31/2021, 1:52 PMTiago Nunes
05/31/2021, 4:40 PMsuspend fun wait() = withContext(Dispatchers.Default) {
delay(1000)
true
}
How do I call this in Swift? I know I can launch a coroutine in shared and provide callbacks (and then call this in swift):
fun waitIos(onFinished: OnFinishedCallback) = GlobalScope.launch {
val result = wait()
onFinished.finish(result)
}
But this way I need to write lots of wrappers and use callbacks, which kind of takes the fun out of using coroutines... (in the ios side)
It makes sense if it isn't possible, I just want to make sure that it really isn'tAldan Rizki Santosa
06/02/2021, 4:12 AMspierce7
06/02/2021, 4:57 AMAlex Anisimov
06/02/2021, 12:18 PMOsman Saral
06/02/2021, 12:44 PMCharles Prado
06/02/2021, 1:27 PMSessionManagerCheckInResult<UserInfo>?
being SessionManagerCheckInResult
is the sealed class:
sealed class CheckInResult<out T : Any> {
data class Success(val data: UserInfo) : CheckInResult<UserInfo>()
data class Error(val exception: Throwable) : CheckInResult<Nothing>()
}
I'm trying to get the error when I receive one, but I'm not able to get the result or error separated here. What I get if I print the object is:
▿ Optional<SharedSessionManagerCheckInResult>
- some : Error(exception=ApiError(code=400112, message=Invalid or missing members in payload
...
How can I get this error in iOS side? Some way I can convert the data to a SharedSessionManagerCheckInResultError
here?Vitor Prado
06/02/2021, 1:31 PMcompose compiler
running on K/N?? We can expect composables in KMP world?solidogen
06/02/2021, 6:22 PMAhmed Mourad
06/02/2021, 9:45 PMA
and B
, both of which only contain commonMain
and commonTest
source sets and have jvm
, js
and ios
as targets. Also B
depends on A
.
The problem is I can't reference the classes defined in the commonMain
of A
inside the commonMain
of B
, so something is probably wrong with my Gradle files...jw
06/03/2021, 2:29 AMjsTest { kotlin { exclude '..' } }
but it seems to have no effect. my current workaround is to eliminate the commonTest srcDir and add it as a srcDir to each platform-specific target's test source set and then do the excludeursus
06/03/2021, 3:14 AMFabio Santo
06/03/2021, 5:54 AMiosX64Test
hangs on loading ? No error is surfaced... 🤔Osman Saral
06/03/2021, 7:20 AMtylerwilson
06/03/2021, 1:14 PMGlobalScope.apply {
launch(ApplicationDispatcher) {
try {
val result: String = client.get {
I know that GlobalScope is now a ‘delicate’ API. What is the preferred/canonical/best way to launch network calls in common code now? Thanks!Hossein Amini
06/03/2021, 3:56 PMandylamax
06/04/2021, 12:28 AMGamadril
06/04/2021, 8:37 AMAnton Afanasev
06/04/2021, 7:16 PMexpect class MailBox(firstName: String) {}
Now, I want that my Android actual implementation will have some Android specific object passed as well. Lets say Context
I can not do
actual class MailBox actual constructor(firstName: String, context: Context) // not allowed as actual constructor does not match the expected.
If I use a secondary constructor, I cannot be sure that it will be called and therefore Context is going to be of Nullable
type and smell.
actual class MailBox actual constructor(firstName: String) {
private var context: Context? = null // Context is of Nullable - not nice
constructor(context: Context, firstName: String = "Bobby", ) : this(firstName) {
this.context = context
}
Obviously, I can declare my expected without primary constructor - but then I have no control over each platform passing a mandatory argument.
expect class MailBox {} //commonMain
actual class MailBox(context: Context, firstName: String) {} //androidMain
actual class MailBox(firstName: String) {} //iOSMain
//No ability to force passing `firstName` argument. Any platform can decide to modify/remove `firstName` on their will.
QUESTION: Are there any other, cleaner approaches that allows me to force some expected constructor values mandatory, while others can be platform specific?Ola Adolfsson
06/04/2021, 8:18 PMspierce7
06/04/2021, 10:14 PMxxfast
06/05/2021, 1:23 AMColton Idle
06/05/2021, 4:21 AMcomposables
module. Android only. This left my composables module with a build.gradle with a top level dependencies{}
block. I now converted it to multiplatform for compose desktop and so I have dependencies declared in a kotlin {}
block.
i.e.
kotlin {
android()
jvm("desktop")
sourceSets {
named("commonMain") {
dependencies {
api(compose.runtime)
api(compose.foundation)
api(compose.material)
}
}
}
}
My question (sorry for being a complete kmm noob) is that is there any reason why I would keep a top level dependencies{} block around? I still have dependencies defined there, but if I remove it then everything seems fine. When using kmm is the gist that we never use top level dependencies block?Charles Prado
06/05/2021, 5:19 PM@Serializable
@Parcelize
data class SomeClass(
val id: String = "",
val name: String = "",
val mandatory1: String,
val mandatory2: String,
)
On the iOS side, what I want is:
// SomeiOSClass.swift
let instance = SomeClass(mandatory1: "foo", mandatory2: "bar")
instead of :
// SomeiOSClass.swift
let instance = SomeClass(id: "someId", name: "someName", mandatory1: "foo", mandatory2: "bar")
Is it possible to not have to set those properties that already have a default value defined on Kotlin's side?xxfast
06/06/2021, 3:25 AMColton Idle
06/06/2021, 12:50 PM/main
or /test
anymore for any reason, right? common code goes into commonMain and android specific code would go into androidMain, while desktop specific goes into desktopMain?Alexey Glushkov
06/06/2021, 4:00 PMAndroid Studio Arctic Fox | 2020.3.1 Canary 12
. But when I try to switch to 2020.3.1 Beta 2
it requires gradle plugin 7.0.0-beta02 which, I suppose, isn’t supported by KMM. I think so as I get this error
Please initialize at least one Kotlin target in 'shared (:shared)'
Should I keep using 2020.3.1 Canary 12
or there is a way to make beta work?mayojava
06/07/2021, 7:20 AMNapa Ram
06/07/2021, 11:11 AMrobjperez
06/07/2021, 3:51 PMrobjperez
06/07/2021, 3:51 PMahmedre
06/07/2021, 6:07 PM