Search code examples
swiftxcodeswift-package-manager

Swift Package Manager Files In Alphabetical Order?


I'm working on removing code from a project file and making it it's own standalone Swift Package. In doing so, I imported a bunch of files, and these files are now in alphabetical order.

Is there anyway to change this?

Thanks


Solution

  • Solution

    A package consists of Swift source files and a manifest file. The manifest file is called Package.swift. Xcode uses Package.swift file to open Swift Package Manager packages. A package is not a project and has not had a project/workspace file like .xcodeproj or .xcworkspace.

    By convention, a target includes any source files located in the Sources/ directory. Just because it has no project or workspace file it has no rules like alphabetical order or such so.

    Try this

    Open Finder, and add any source file on the disk system via copy to the package's sources directory. The file will immediately appear on the (Xcode) package too.

    Short Answer

    For now, this is not possible. Who knows about future releases? Personally, I didn't care much until I added an Objective-C project. Then I realized that it's super hard to organize things. I understand your point.

    I hope this explains the situation.

    Best