While working with universal framework that targets all apple platforms I wish to conditionally link to another
ld: framework not found
This can be achieved without resorting to Linked Framework and Libraries.
While we have a universal target with full range of supported platforms:
macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator, consider the case that we want to link a framework for OSX only.
For linking our framework we need two things:
.frameworkto Framework Search Path
-framework YourFrameworkNameto Other Linker Flags
And Build settings allows us to specify fields conditional for specific platform. When expanding the individual field and hovering the mouse over Debug/Release, you will be able see the plus sign appearing, pressing on the plus sign will bring you the picker where you will be able to select the desired platform.
The hypothetical added build settings for linking
RealmSwift for OSX will look the following way:
(both Intel 64-bit arch and Any macOS SDK will represent building for OSX)