I'm taking an app of mine and breaking it up into several smaller Swift packages. The app is almost completely protocol-driven so I can do protocol-based dependency injection in nearly every component.
As I've been splitting it up, I've been including the protocol and implementation in the same package, but this is leading to large dependency graphs for components that really only need the protocols.
I've been considering creating separate "protocol packages" that are basically just the protocols of a particular feature and the implementation in another package, ie:
- UserServiceProtocol package - few dependencies, should just be other protocol packages - UserService package - imports UserServiceProtocol - other implementation dependencies (potentially lots of dependencies) - FeatureA package - imports UserServiceProtocol, but not UserService
Has anyone else done similar things or have thoughts / suggestions for this? I'm a bit concerned about having to add that many more packages, but for the most part, they shouldn't change much.