Xcode finds dependencies automatically sometimes. I think is is ok when I am the one who is defining the relationships and when I get lazy ...
But more than often I find myself facing an existent (medium to large size) project with several targets. Since the project has been made by someone else I find it very difficult to understand what targets depends on what since not all the relationships are explicit.
What are the rules Xcode use to find such relationships? ( I hope I can understand the logic so run it in my mind and maybe save me some time in the future) Or What makes a target qualifiable to be implicitly dependant of another?
A target and the product it creates can be related to another target. If a target requires the output of another target in order to build, the first target is said to depend upon the second. If both targets are in the same workspace, Xcode can discover the dependency, in which case it builds the products in the required order. Such a relationship is referred to as an implicit dependency.
Source: iOS Developer Library → Xcode Concepts → Xcode Target
A dependency is another target that must be built before the current target can be. For example, if you have an app target and a framework target, the app target can have the framework target as a dependency, to ensure that the framework is built first. That is, the app target "depends" on the framework.
When you create a new project from a template, Xcode adds one or more targets to the project automatically. For example, the multiplatform app template contains separate targets for an iOS app and Mac app. To view the targets in a project, select the project in the navigator area.
Implicit Dependencies The dependencies are implicit for a class if they exist only in the code within that class, and not in its public interface. Therefore, while instantiating our class, we will not be aware of any dependency that our class may have to perform its operations.
Implicit Dependencies If Xcode target Arequires output of another target B, then A dependson B. If both targets are in the same project or workspace, then Xcode can detect the dependency automatically. Thus, Xcode can automatically build target B before target A.
You can also specify explicit target dependencies in your build settings, and you can specify that two targets that Xcode might expect to have an implicit dependency are actually not dependent. For example, you might build both a library and an application that links against that library in the same workspace.
Xcode target is a specification for building a product. Implicit Dependencies If Xcode target Arequires output of another target B, then A dependson B. If both targets are in the same project or workspace, then Xcode can detect the dependency automatically. Thus, Xcode can automatically build target B before target A.
Use implicit dependencies for products that need only compilation and linking, that is, static libraries. Use explicit dependencies for products that need to be copied into target product bundle, that is, for dynamic frameworks and resource bundles.
This answer applies to Xcode 8.x, and I think for Xcode 9.0.
First off, you need to be sure that "Find Implicit Dependencies" is enabled in the the Build panel of the Scheme that you are attempting to build.
A target "A" can be made "implicitly" dependent on target "B" in two ways:
So why would anyone ever want to do the horror that is "2"? I can come up with a couple of reasons.
If you think these are contrived situations, I'm currently hitting both of them moving some legacy code from a series of explicit dependencies to implicit dependencies. Why am I moving to implicit dependencies? Because explicit dependencies in Xcode require project nesting, and once you get enough explicit dependencies, the project browser gets extremely slow, and you will see a lot of beachballs inside of Xcode for random things.
What happens if you happen to have two targets inside the same workspace that generate products with the same name and depend upon them from a third target? Implicit dependencies will pick one. It appears to do a match based on the base name of the product (so foo/bar.a and baz/bar.a are the same), and will pick the first one it finds.
Xcode Dependency
[About] is a dependency required to build a selected target.
Implicit
dependency
Non-compiled dependencies
. Xcode allows to add a dependency from the whole workspace
. A good example is a Project from GitHub or CocoaPods
[About] with source codePrecompiled dependencies
aka External
- external binary, CocoaPods
, Carthage
with closed codeImplicit dependency
is a dependency that is necessary to successfully build a target, but aren’t explicitly defined.
General
-> Framework, Libraries, and Embedded Content
or `Embedded Binaries and Linked Frameworks and Libraries[Link vs Embed]
Build Phases -> Dependencies || Target Dependencies
To turn on this functionality[No such module]
Edit Scheme -> Build -> Find Implicit Dependencies
[Explicit dependency]
[Vocabulary]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With