I've several open source projects that build libraries of frameworks. I'd like to provide a Swift Package. But the file structure of the source is already fixed. Can I just add a folder, put the Package.swift file inside it, then use relative addressing (../../../SomeDir/File.m) to indicate source files?
The Package.swift
file needs to be at the repository root if you want it to be usable as a dependency outside the repository. (If it is just a local thing for use inside the same project it doesn’t matter.)
But besides that, you have a lot of freedom to arrange it however you want. The path
, exclude
and sources
arguments for target
are what you need to use whenever something isn’t in the standard location.
Won't I need a huge long list of files to exclude? And won't I need to update that every time new files are added?
Well, that said I recall I can exclude whole folders at a time, which would help a lot.
So yeah, maybe its not as bad as I thought it would be. I just never saw anyone post on doing it...
Thanks!
Both exclude
and sources
accept directory paths. But yes, it is not as convenient as using the standard locations and not needing to declare anything.