Swift Glue Code
summary
Bottom-up migration strategy: concrete techniques for writing transient glue that maps Swift enums, structs and tuples into Objective C representations so legacy code keeps building. Demonstrates a sample command‑line + framework, uses wrappers and C module maps, shows how to write wrap/unwrap functions for tag unions and tuples, and inspects calling conventions in SIL and LLVM and even assembly. Covers issues that break this approach: Swift 3 beta ABI instability, SE-0058 being deferred, framework size (+~5MB), bitcode/optimization effects and practical workarounds.
AI-written summary · about
chapters (21)
- 0:00Start
- 1:32Our agenda
- 2:56Migration Basics
- 4:33What is glue code?
- 6:31A word of warning
- 12:11Preparing for migration (enums)
- 13:45Preparing for migration (C imports)
- 14:51Preparing for migration (extern consts)
- 15:57Preparing for migration (errors)
- 16:55Some basic pitfalls
- 18:35The @objc annotation
- 21:38Builtin-sensitive promotions
- 36:19Direct call bridging: Contiguous data types
- 37:18Handling function names
- 38:33x86_64 assembly to know
- 40:05What about optionals?
- 40:24C-style bridging: tuples
- 42:32A Warning time A
- 43:29Handling return optimizations natively
- 44:43C-style bridging: structs OOOOO
- 45:09Closing remarks








