From the course: Exploring Ktor with Kotlin Multiplatform and Compose

Xcode project configuration

- [Instructor] In this module, we'll get your composed multi-platform app running on the iOS simulator without ever opening Xcode. The beauty of composed multi-platform is that you can develop, build, and test your iOS app entirely from Android studio. Make no mistake though, you still need Xcode. Only, it just runs in the background. Look at your run configurations. You'll see iOS simulator options alongside your Android targets. So if we do a dropdown here, we can see that there's an iOS app here. There's a compose app, which is Android, which even can run tests from here and other things. Gradle handles everything, compiling Kotlin native, packaging the app, launching the simulator, and installing your app. The same APOD view model and today's screen that you've been testing on Android will appear on the iOS simulator. The iOS simulator runs your actual composed UI code, tap interaction, scroll, navigate, everything behaves like a native iOS app because it is a native iOS app, just written in Kotlin and composed instead of Swift and Swift UI. If you need to debugs iOS specific behavior, you can use the same debugging tools you use for Android, set break points. In fact, let's go ahead and click on one of these pictures and you notice there's a break point and we ended up in the picture details page. Okay, so let's go ahead and let that finish running. We go back, we go to today. Oh, and look, we've hit our break point again at picture detail screen. So we're doing a lot of code sharing here. If we go ahead and let that run one more time, and I think that you've guessed what's going to happen. So we type in a date, we say find the picture, we say view full picture, and we end up once again at the picture details page. Set break points in APOD repository or home screen, and they'll work on iOS too. They share code base means they share debugging experience. For network testing, remember to update server config to use the correct IP address for the iOS simulator. It can reach your development server just like the Android emulator can. This streamlined workflow means you can iterate quickly across both platforms without context switching between IDEs or learning platform specific tools.

Contents