Swift builds upon the strong heritage of Objective-C. When Apple released the first version of Swift, they also reassured all developers that their Objective-C code bases would be able to integrate Swift progressively thanks to a strong interoperability layer. Even today, many applications haven't fully migrated to Swift, and interoperability is key to ensure that the Objective-C code isn't bringing instability and unsafe types into your shiny Swift modules.
In this chapter, we'll have a look at techniques to write safer Objective-C code:
- How to import Swift code in Objective-C and vice versa
- How to add nullability to Objective-C
- How to expose renamed methods to Swift
- How to leverage lightweight generics in Objective-C
- How the Cocoa design patterns translate in Swift