Dependencies
Target dependency types that define how targets depend on other code.Overview
TheTargetDependency enum defines all possible types of dependencies that a target can have, including dependencies on other targets, external packages, system frameworks, and prebuilt binaries.
Dependency Types
Target Dependency
Depend on another target within the same project.String
required
Name of the target to depend on.
LinkingStatus
default:".required"
The dependency status. Use
.optional for weak linking, .required for strong linking, or .none to skip linking.PlatformCondition?
default:"nil"
Condition under which to use this dependency.
nil means always use it.Macro Dependency
Depend on a Swift macro target within the same project.String
required
Name of the macro target to depend on.
Project Dependency
Depend on a target within another project.String
required
Name of the target to depend on.
Path
required
Relative path to the other project directory.
LinkingStatus
default:".required"
The dependency status (optional dependencies are weakly linked).
PlatformCondition?
default:"nil"
Condition under which to use this dependency.
External Dependency
Depend on an external dependency imported throughPackage.swift. This is the recommended approach.
String
required
Name of the external dependency as declared in Package.swift.
PlatformCondition?
default:"nil"
Condition under which to use this dependency.
Package Dependency
Depend on a Swift Package Manager product using Xcode native integration. It’s recommended to use.external instead. For more info, check the external dependencies documentation.
String
required
The name of the output product (e.g., “RxSwift”).
PackageType
default:".runtime"
The type of package being integrated:
.runtime- Standard package linked at runtime.runtimeEmbedded- Package embedded in the product at runtime.plugin- Build system plugin loaded at compile-time.macro- Swift Macro package
PlatformCondition?
default:"nil"
Condition under which to use this dependency.
Framework Dependency
Depend on a prebuilt framework.Path
required
Relative path to the prebuilt framework.
LinkingStatus
default:".required"
The dependency status (optional dependencies are weakly linked).
PlatformCondition?
default:"nil"
Condition under which to use this dependency.
XCFramework Dependency
Depend on an XCFramework.Path
required
Relative path to the xcframework.
XCFrameworkSignature?
default:"nil"
The expected signature if the xcframework is signed. Used for verifying integrity.
.unsigned- The XCFramework is not signed.signedWithAppleCertificate(teamIdentifier:teamName:)- Signed with Apple Development certificate.selfSigned(fingerprint:)- Signed with self-issued code signing identity
LinkingStatus
default:".required"
The dependency status (optional dependencies are weakly linked).
PlatformCondition?
default:"nil"
Condition under which to use this dependency.
Library Dependency
Depend on a prebuilt static library.Path
required
Relative path to the prebuilt library.
Path
required
Relative path to the library’s public headers directory.
Path?
required
Relative path to the library’s Swift module map file.
PlatformCondition?
default:"nil"
Condition under which to use this dependency.
SDK Dependency
Depend on a system library or framework.String
required
Name of the system library or framework without extension (e.g., “ARKit”, “c++”).
SDKType
required
The dependency type:
.framework- Framework SDK.library- Library SDK (inusr/lib).swiftLibrary- Swift library SDK (inusr/lib/swift)
LinkingStatus
default:".required"
The dependency status (optional dependencies are weakly linked).
PlatformCondition?
default:"nil"
Condition under which to use this dependency.
XCTest Dependency
Depend on XCTest framework.LinkingStatus
Controls how a dependency is linked:.required- Required dependency (strong linking).optional- Optional dependency (weak linking).none- Skip linking entirely