How to combine Swift/Kotlin with C/C++
summary
A push-up counter app is built with platform UIs in Swift and Kotlin and a shared C++ business layer using OpenCV for face-distance detection; glue code is generated with Genie IDL (optionally SWIG), requiring a custom OpenCV mat converter to map Java/ObjC wrappers to C++ pointers. Android uses JNI-loaded shared libraries and CMake; iOS links at build time. The prototype achieves ~50–60 FPS in camera debug mode, and Genie covers about 95% of binding work.
AI-written summary · about
chapters (19)
- 0:00Introduction
- 0:47Why use C++
- 2:59Reusing legacy code
- 5:30Push-up counter demo
- 7:40Architecture decisions
- 9:53OpenCV and performance
- 13:14Language bindings
- 14:20SWIG vs Genie
- 17:52IDL file structure
- 21:55Generating glue code
- 22:16Android project setup
- 26:21iOS project setup
- 29:58Debugging camera feed
- 33:15Custom type converters
- 36:05Java native interface
- 37:07Personal fitness journey
- 37:47Key takeaways
- 39:59Alternatives and resources
- 41:50Q&A session
related talks
40mKMP with non-Kotlin languages
43mDoppl Code Sharing
41mCrossplatform 2019: C ++ as an antagonist in a progressive world
44mSwift on Android: The Future of Cross-Platform Programming?
25mThe ever increasing convergence of native Android and iOS development
40mlet swift == val kotlin - Why iOS is so important for Android, and vice versa
29mWorking with C and C++ in Apple environment
28mThe ever increasing convergence of native iOS and Android mobile development
