Use C, C++ and Objective C Libraries in a Swift Project
summary
Shows step-by-step how to import C, C++ and Objective‑C into Swift by linking frameworks and static libs (e.g. add LibbasicCPP.a and LibpureC.a), creating an Obj‑C shim (rename .m to .mm), and exposing C headers via module.modulemap. Covers pointer handling (use String(cString:) and explicitly free C‑allocated memory), function pointers as @convention(c) closures that must be non‑capturing (store in globals), and wrapping C++ objects with new/delete. Provides working example projects and open‑source code — it works.
AI-written summary · about
chapters (11)
- 0:00Introduction and motivation
- 2:00Spotify's tech stack history
- 5:08Interoperability overview
- 6:45Integrating Objective-C
- 8:03Wrapping C++ with Objective-C
- 10:00Integrating C via modules
- 12:21Building friendly wrappers
- 15:32Memory management and closures
- 18:56Complex closure bridging
- 20:30Advanced C++ integration
- 22:25Conclusion and recap








