yusuf3000
02/27/2018, 10:30 AMTobi
02/27/2018, 11:24 AMcommon code cannot depend on any platform specific library like RxJava or RxSwift. In case you need to reference this code from your common module you have for now these choices:
1. Using expect and actual keywords from the multiplatform feature
Declaring an expect class in the common module forces you to provide an actual implementation written in kotlin for each platform. You can either use the kotlin stdlib or the interoperability feature to fulfill this contract on the ios module. The interoperability feature allows you to call any native library from kotlin. If RxSwift is a native library this might be an option.
2. Use interfaces
Alternatively you could declare and use an interface in the common module to model the async part. This interface will be then compiled to a protocol which you then can implement in swift.
A pure kotlin implementation of rxjava would be great. Or even better a common reactive api for multiple platforms:
https://github.com/JakeWharton/Reagentyusuf3000
02/27/2018, 11:50 AM