Trying to add ktor/coroutines to AppCode 2019.1 ge...
# kotlin-native
t
Trying to add ktor/coroutines to AppCode 2019.1 generated Framework. No love. I have a build.gradle.kts which appears to result in the right libs being added - they show up in the gradle toolpane. But AppCode does not recognize import io.ktor or kotlinx.coroutines. Anybody else see this? What is the magic for dependencies to be seen in editor?
d
Build
t
Task KotlinNativeFrameworkcompileKotlinKotlinNativeFramework
/Users/tylerwilson/Projects/nativetest/KotlinNativeFramework/src/KotlinNativeFrameworkMain/kotlin/KotlinNativeFramework.kt108: error: unresolved reference: io import io.ktor.* ^
d
Have you enabled metadata?
enableFeaturePreview('GRADLE_METADATA')
in your
settings.gradle.kts
t
trying. i was using a fresh template project, which uses settings.gradle and build.gradle.kts. added metadata flag and it got further. checking now…
okay, imports now recognized. thank you! (aside: i think the template projects should use just the standard groovy gradle)
d
I think KTS is better but that's only my opinion.
t
the issue for me is that 90% of the scripts out there are grovy, and unless the IDE does the conversion for you, I spend more time hand converting everything. from a theoretical pov i love the kts idea. but with mix of old and new it just adds wasted development time. my humble 2 cents
thank you very much for your help @Dominaezzz It is running in simulator now! now to the fun part of writing working code…
d
No problem! Have fun.
t
Finally got a successful network call. Next issue is that it appears if I set any breakpoints in AppCode then it hangs and never returns from GlobalScope.launch(myDispatcher). Will keep playing with it, but so far I am pleased.
d
Breakpoints and coroutines don't play very nice yet.
t
Good to know. If the coroutines are in a Framework used by an iOS in Xcode, there should be no issues there correct?
d
No, I don't think so. As long as you don't do anything funky with threading.
t
Nope, I do the minimum threading funkyness possible! 😉
🙂 1