Home About Notes

Swift Package Manager custom path for target

Apr 03, 2023

When you set your .target() up in your .targets[] in SPM you dont specifiy a path, it will look at [PackageRoot]/Sources/[TargetName] but if you are doing something different, you can specify that path with .target(path: "PathToSource")

path: The custom path for the target. By default, the Swift Package Manager requires a target's sources to reside at predefined search paths;  for example, `[PackageRoot]/Sources/[TargetName]`. Don't escape the package root; for example, values like `../Foo` or `/Foo` are invalid.

You can also do a mega package by specifying just Sources as the path.