Swift Objective-C API Note
3.9 | 18 Votes
What is an APINOTES file?
Swift is an Apple-maintained programming language that developers use to create programs for macOS, iOS, tvOS, and watchOS. Developers creating Swift programs may have those programs make API calls to programs written in Objective-C, which is the language Swift replaced.
If an Objective-C API's header does not contain all the information needed for the Swift program to correctly interpret information it receives from the API, developers can annotate the API using an APINOTES file. This file contains YAML-formatted text that defines how and what information a Swift program can receive from the associated Objective-C API.
After a developer creates an APINOTES file, they must place it in the same directory as the Objective-C framework to which it corresponds and update CMakeLists.txt. Then, the next time the developer builds their Swift program, the compiler will load the APINOTES file along with the corresponding framework.