I was building a Kotlin Multiplatform SDK that needed to support four analytics providers—Google Analytics, Facebook, AppsFlyer, and Amplitude. Each customer typically only uses one or two, never all four.
The Challenge: How to let developers pick and choose which analytics integrations to include, without forcing them to bundle everything?
The solution seemed obvious: build separate implementations for each analytics provider and let developers include only what they need.
On Android, this is straightforward—create separate Gradle modules, and developers pick which ones to add. Done in 30 seconds.
dependencies { implementation("com.example:shared:1.2.3") implementation("com.example:analytics-google:1.2.3") // ✓ Just this } But on iOS? I had no idea where to start.
So I had two terrible options (or maybe more, but I could only think of these...