Closed AlexIach closed 1 year ago
Hi! The breedsNative
property is actually named breeds
in ObjC/Swift. The following should work:
createObservable(for: repository.breeds)
Let me know if that isn't the case.
The BreedsRepository
is in your shared
module, right? In that case you won't need any Gradle related changes.
Hey @rickclephas ,
Thanks for quick response. Using just repository.breeds
is working indeed. I don't why I was confused by breedsNative
property name. I thought that KSP code generation should rename the property from breeds
to breedsNative
or it does it only when I specify this inside Gradle by changing suffix?
nativeCoroutines {
.....
}
The Native
suffix is only used on the Kotlin side since we can't create a property with the same name.
This suffix can indeed be customised in your build.gradle.kts
file.
However the @ObjcName
annotation is used to rename the property to its original name in the ObjC header.
This way you don't have to use different property/function names in Swift 😁.
Thanks for detailed explanation @rickclephas. I'll close this issue since it's not an issue but just my mistake.
I've just started my KMP journey and I thought that it would be a very good idea to add native coroutines into my test project using this cool library. I was following the instructions to integrate this library and unfortunately I faced exact the same problem that was mentioned in this Closed Issue (Sorry for opening another issue). I've updated my Gradle configuration according to mentioned suggestions but I'm still facing the issue.
Link to test project.
:shared:build.gradle.kts
Top level build.gradle.kts
Repository class I want to share:
I can see that generated code is present:
But when I'm trying to access generated code in XCode I'm getting errors.
Here is my Pod file:
I'm pretty sure I'm missing smth but I'm not getting what exactly. Should add any configuration to make generated code be accessible in XCode?