Martina Rauert
02/21/2023, 9:24 PMMartina Rauert
02/21/2023, 9:29 PMegor
02/21/2023, 10:11 PMdarkmoon_uk
02/21/2023, 10:42 PMdarkmoon_uk
02/21/2023, 10:46 PMMartina Rauert
02/21/2023, 10:53 PMdarkmoon_uk
02/21/2023, 10:56 PMdarkmoon_uk
02/21/2023, 10:59 PMdarkmoon_uk
02/21/2023, 11:01 PMPablichjenkov
02/21/2023, 11:01 PMPablichjenkov
02/21/2023, 11:04 PMrusshwolf
02/22/2023, 1:12 PMWould need to replace the API Client library we currently use with KTORThat's not necessarily true. You could instead write a shared Kotlin interface that calls into your existing API Clients. This lets you write shared logic that can make API calls, without throwing away your existing code, and avoids introducing new bugs into your API client that your existing code has already solved.
Mocking was not possible in the iOS envI bet your iOS engineers have strategies to deal with this. Maybe the tests in your shared code will look different than your Android code. Don't think of KMM as taking everything you have on Android and using it on iOS. Think of it as bringing the teams together and find the patterns that work for everyone.
Martina Rauert
02/22/2023, 3:38 PMYou could instead write a shared Kotlin interface that calls into your existing API Clients. This lets you write shared logic that can make API calls, without throwing away your existing codeThe main problem we’re trying to solve with KMM is to remove code duplication between our platforms, and I don’t see a way around pivoting to KTOR. Overall, you’re right - we could write a shared interface and leverage the existing Android implementation, but this cannot be used for the iOS implementation as it depends on the JVM. If we have to rewrite the API library in the iOS implementation that does not satisfy our requirement of duplicated code per platform. Unless I’m missing something obvious - I am not an Android developer by nature so I could certainly be overlooking something!
Think about what it looks like to introduce a small amount of shared code and incrementally grow from there, rather than trying to solve all the hard problems at once.I definitely need this reminder from time to time 😅 thanks!
russhwolf
02/22/2023, 3:58 PMMartina Rauert
02/22/2023, 4:03 PMdon’t be afraid to leave platform-specific pieces in placeI am definitely approaching KMM in the exact opposite way to this, so that is something I can work on 😄 Thanks for clarifying! It is super helpful!