An Tran
02/22/2022, 6:58 AMMarc Reichelt
02/22/2022, 10:45 AMKotlinMultiplatformExtension
into their buildSrc
folder? I’m trying to write some logic to make it easier for multiple targets to configure ios targets + tests…Marc Reichelt
02/22/2022, 12:17 PMkotlin {
jvm()
ios()
sourceSets {
commonMain {
dependencies {
api(project(":ModuleOne"))
api(project(":ModuleTwo"))
}
}
}
// ...
}
But: the generated lib only has 261 bytes, it only contains the META-INF/MANIFEST.MF
and that’s it. No classes compiled. What should I be doing instead?Stylianos Gakis
02/22/2022, 12:30 PM:shared:iosSimulatorArm64Test: java.lang.IllegalStateException: command '/usr/bin/xcrun' exited with errors (exit code: 86)
when running ./gradlew shared:allTests
?
And as a side-note running ./gradlew shared:check
seems to run just fine, I would guess these should do the same-ish thing? Not sure what the difference is or why one may be failing like that and the other runs just fine 🤔Prateek Sharma
02/22/2022, 1:07 PMMarco
02/22/2022, 2:00 PMclass GenericClass<T> {
fun <A> clone(block: (GenericClass<T>) -> GenericClass<A>): GenericClass<A>{
return block(this)
}
}
Because currently the compiler generates this implementation that not fill my requirements because the return type is GenericClass<`AnyObject`> instead of be generic <A>
public class GenericClass<T> : KotlinBase where T : AnyObject {
public init()
open func clone(block: @escaping (GenericClass<T>) -> GenericClass<AnyObject>) -> GenericClass<AnyObject>
}
Is this implementation wrong? There is a proper way to do that? Thank you!Andrew O Hart
02/22/2022, 3:08 PMMarc Dietrichstein
02/22/2022, 5:06 PMandroidMain/kotlin
is marked as source folder.
The strange thing is that this only occurs on Mac OSX. On Ubuntu everything works fine (second screenshot). The versions of Android Studio, Kotlin, Plugins etc are the same on both machines. The command line build also works on both machines.
Does anyone here know how to fix this? I would also like to know why some source folders are marked with a blue square and others with three vertical bars. Does this have any deeper meaning?Skolson5903
02/22/2022, 7:41 PMimport platform.Compression
statement can work, not a third-party cocoapod, so I can import it and use it in KMP code. I'm still searching around but so far not having much luck. Thanks in advance for any info...Sunny
02/23/2022, 9:07 AM// in src/jsMain/kotlin
actual suspend fun provideDbDriver(schema: SqlDriver.Schema): SqlDriver {
return initSqlDriver(schema).await()
}
While replicating in our project running into. Anyone ran into something similar?
Unresolved reference: initSqlDriver
Marco Righini
02/23/2022, 1:20 PMtasks {
named<Test>("jvmTest") {
useJUnit {
includeCategories("category_package_and_category_name")
}
}
}
but the filter is not taken into account and all the jvm tests are run.Andrew O Hart
02/23/2022, 3:31 PMTravis Reitter
02/23/2022, 5:18 PMcinterops
seem to be built with bitcode (well, marker) as well as my KMM library and the app works as a release build but if I try to create the archive in Xcode, I hit this error:
ld: bitcode bundle could not be generated because '/Users/treitter/doublestrain/DoubleStrain/SharedCode/build/xcode-frameworks/Release/iphoneos15.2/SharedCode.framework/SharedCode' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/Users/treitter/doublestrain/DoubleStrain/SharedCode/build/xcode-frameworks/Release/iphoneos15.2/SharedCode.framework/SharedCode' for architecture arm64
I get the same error whether or not I include embedBitcode("bitcode")
in my framework
block. This is with Kotlin 1.6.10 on an M1 Mac.
This is the only thing blocking me from my first KMM-based release so any help is greatly appreciated! 🙂Matthias Geisler
02/23/2022, 7:56 PMJOSEPH FISHER
02/23/2022, 10:02 PMfun doLaunchOperation() {
println("START: doLaunchOperation()")
var i = 0;
val launchJob = GlobalScope.launch {
println("START: launch")
while (i<100){
println(i)
i++
}
println("END: launch")
}
while(launchJob.isActive){
println("launchJob.isActive")
}
println("done")
println("END: doLaunchOperation()")
}
Rohan Maity
02/24/2022, 1:34 AMAndrew O Hart
02/24/2022, 3:29 PMimplementation(kotlin("test"))
In the commonTest in build.gradle, it works, but I don't see something like this being declared in kampkitLandry Norris
02/24/2022, 4:36 PMTravis Reitter
02/24/2022, 4:56 PMAndrew O Hart
02/24/2022, 5:42 PM@Test
fun testDownloadCompletedSuccessfully() {
runBlocking {
launch(Dispatchers.Main) {
val result = retriever.fetchData()
assertEquals(RemoteResultType.SUCCESS, result.type)
}
}
}
which does this:
override suspend fun fetchData(): RemoteDataResult {
val responseContent: String
return try {
responseContent = httpClient.get { url(hostURL + serviceURL) }.body()
RemoteDataResult(responseContent, RemoteResultType.SUCCESS)
} catch (e: ClientRequestException) {
return RemoteDataResult(e.message, RemoteResultType.CLIENT_ERROR)
} catch (e: ServerResponseException) {
return RemoteDataResult(e.message, RemoteResultType.SERVER_ERROR)
} catch (e: Exception) {
return RemoteDataResult(e.message, RemoteResultType.GENERAL_ERROR)
}
}
But it always returns as GENERAL_ERROR.
I tried debugging and it says this:
Exception in http request: Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “run.mocky.io” which could put your confidential information at risk."
We do have some test endpoints on mocky to simulate stuff like 500 errors etc.
How can I work around this?Alen Kirm
02/24/2022, 8:28 PMenum class SomeEnum(val id: String) { VALUE1("value1"), VALUE2("value2") }
which you can instantiate in your Kotlin code via valueOf
method.
How can I instantiate it in Swift code? Swift doesn’t see valueOf
method. I’ve tried to add a compation object into an enum, to “fake” valueOf
method but its not visible on Swift side either.
I guess workaround is to pattern match on Swift side, and just return an instance of SomeEnum
case:
switch valueInstance {
case "value1": return .value1
case "value2": return .value2
}
Are there any other solutions ? 😄brabo-hi
02/24/2022, 11:42 PMroom
is not moving to kmm ?Slackbot
02/25/2022, 12:08 AMade
02/25/2022, 9:27 AMsealed class Resolved<out T> {
data class Success<out T>(val data: T) : Resolved<T>()
data class Error(val exception: Exception) : Resolved<Nothing>()
But in case of Error, how can I extract the exception on the iOS side? If Resolved.Error has a type parameter (Error<T>) i can do in swift:
if
*let* val = response *as*? ResolvedError { ...
But when it doesnt and is typed as Resolved<Nothing> I cannot. Or at least I don't know how. Any tips?Andrew O Hart
02/25/2022, 10:01 AMStylianos Gakis
02/25/2022, 10:19 AMAhmet Özcan
02/25/2022, 2:32 PMshaktiman_droid
02/25/2022, 7:32 PMmike.holler
02/25/2022, 9:09 PMr
02/25/2022, 10:49 PMcocoapods {
framework {
baseName = "MyAppSharedLib"
//Dynamic framework support
isStatic = false
}
summary = "Multiplatform shared functionality"
homepage = "<https://myapp.com>"
podfile = project.file("../../app/MyApp/Podfile")
ios.deploymentTarget = "13.5"
osx.deploymentTarget = "10.15"
watchos.deploymentTarget = "6.2"
// Maps custom Xcode configuration to NativeBuildType
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE
}
I'm using a Macbook Pro MX. The project seems to build correctly (I can see a build
folder with generated code for different platforms) but when I do a podInstall
the installed pod just contains a skeleton of the library with an empty placeholder.h
file in it. My current targets are android()
, jvm()
, and ios()
. I tried with iosSimulatorArm64()
as well with no luck. Any ideas?r
02/25/2022, 10:49 PMcocoapods {
framework {
baseName = "MyAppSharedLib"
//Dynamic framework support
isStatic = false
}
summary = "Multiplatform shared functionality"
homepage = "<https://myapp.com>"
podfile = project.file("../../app/MyApp/Podfile")
ios.deploymentTarget = "13.5"
osx.deploymentTarget = "10.15"
watchos.deploymentTarget = "6.2"
// Maps custom Xcode configuration to NativeBuildType
xcodeConfigurationToNativeBuildType["CUSTOM_DEBUG"] = NativeBuildType.DEBUG
xcodeConfigurationToNativeBuildType["CUSTOM_RELEASE"] = NativeBuildType.RELEASE
}
I'm using a Macbook Pro MX. The project seems to build correctly (I can see a build
folder with generated code for different platforms) but when I do a podInstall
the installed pod just contains a skeleton of the library with an empty placeholder.h
file in it. My current targets are android()
, jvm()
, and ios()
. I tried with iosSimulatorArm64()
as well with no luck. Any ideas?Skolson5903
02/26/2022, 12:33 AMr
02/26/2022, 12:44 AM