Apple frameworks
macOS frameworks are collections of reusable classes, functions, and resources designed to simplify the development of macOS applications. They provide a structured way to access system functionality and integrate seamlessly with macOS.
Linking against frameworks is very similar to linking normal libraries. First, they are located with find_package
or find_library
and then used with target_link_libraries
, with a slightly different syntax. The following example links the Cocoa
framework to the ch11_hello_world_apple
target:
target_link_libraries(ch11_hello_world_apple PRIVATE "-framework Cocoa")
Not that the –framework
keyword is necessary and that the name should be quoted. If multiple frameworks are linked, all of them need to be quoted individually.
Now that we can use frameworks, let’s look into creating our own. Frameworks are quite similar to app bundles, with a few differences. Notably, it is possible to install multiple versions...