Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swift support is somewhat confusing. #206

Closed
TimOrtel opened this issue Sep 16, 2022 · 3 comments
Closed

Swift support is somewhat confusing. #206

TimOrtel opened this issue Sep 16, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@TimOrtel
Copy link

While the android support is very well documented, I find the Swift support to be confusing.

For example in the documentation page of the components shows a class called ObservableValue which does not exist and nowhere it says what purpose it is for. Only when inspecting the sample application one can see that it is a class one must copy from the sample project. Shouldn't this class be in some kind of pod one can add to the App project?

I think the construction of the build.gradle.kts is very confusing. If the purpose of the sample project is that it should allow developers to know how to use Decompose, why do you obfuscate the logic behind your gradle plugin "com.arkivanov.gradle.setup"? This just makes it difficult to figure out why something is not working the way it should be. Is it because my build.gradle.kts is wrong? Am I missing something your gradle plugin does and I don't have in my build configuration?

@TimOrtel
Copy link
Author

In your documentation, you state that one does not have to explicitly add the essenty library. However, here you add it. Why is that?

@arkivanov
Copy link
Owner

Thanks for the questions.

For example in the documentation page of the components shows a class called ObservableValue which does not exist and nowhere it says what purpose it is for.

Indeed, it should be mentioned in the docs what is ObservableValue and how to use it. I will update the docs, thanks for raising.

Shouldn't this class be in some kind of pod one can add to the App project?

Unfortunately it is not possible to publish something for Swift that could be used with Decompose in a client's project. This was discussed in the old repo - badoo/Decompose#228. TLDR - two Kotlin frameworks can not communicate with each other, the same types are actually different and incompatible. See the article for more information.

I think the construction of the build.gradle.kts is very confusing.

Yes, I'm aware of this drawback. I considered all pros and cons and decided to go with the current approach. Here is the reasoning. There is nothing special in the Gradle configuration. That's just usual source sets setup plus dependencies, it is very well described in the KMP docs. You can also check other sample projects, they should be using normal Gradle setup - TodoApp and decompose-desktop-example. On the other hand, the usage of the com.arkivanov.gradle.setup plugin simplifies the maintenance of the project for me a lot, which is very valuable for me. Perhaps, this could be also mentioned in the docs.

Is it because my build.gradle.kts is wrong?

If you have any issues, feel free to ask!

In your documentation, you state that one does not have to explicitly add the essenty library. However, here you add it. Why is that?

Decompose uses Essenty library as api dependency, so you are able to use Essenty in your Kotlin module once you added Decompose. But if you wan't to use Essenty from Swift, you have to export Essenty to the framework, which also requires adding it as api dependency. You can also set transitiveExport=true instead, so all transitive dependencies will be exported automatically. However using tranisitiveExport is not recommended in the docs - "This could increase both compilation time and binary size.".

@arkivanov arkivanov added documentation Improvements or additions to documentation question Further information is requested labels Sep 16, 2022
@arkivanov
Copy link
Owner

Updated the docs, closing for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants