Swift Package Organization

Hey folks. I've been working pretty steadily to decouple a lot of our codebase's services and I'm at the point in which our package directory has grown substantially. Ultimately I'll have to go through and organize these packages which entails editing paths. My question to you all is: do any of you have any methodologies or tools that you use in modularizing your iOS (etc) codebases?

Edit: found this repo apple-apps/Packages at main · Dashlane/apple-apps · GitHub Looks like maybe just doing the work to change paths is probably the right route to take

You might need to refine the question a bit to get more responses.

The example you cite uses relative paths to dependencies, which means no versioning and no package access. If they are always versioned (i.e., deployed) together, you could even use a single package, but likely you'd prefer per-dependency versions and hence 1 package per separately-versioned module dependency.

As for editing paths, for simple projects with few dependencies, I use the package String literals, but for anything complex I define variables and factories to support local and SCM modes using local paths or versioned URL's respectively. It's copy/paste for boilerplate given the Package.swift parsing process, but any change translates to one edit.

For analysis to re-organize a codebase, Swift offers some tooling:

For Use
package-to-package dependencies swift package show-dependencies
package to module or product swift package describe
module declarations swift package dump-symbol-graph

People also grep for (non-implicit) imports to get file-module dependencies, or use nm -ul to extract symbols (which need to be demangled and vary with build type). There's certainly opportunity to build analysis and/or refactoring tools on top of swift-syntax.