Swift Package manager currently constrains the inclusion of a dependency to packages with an equal or lower deployment target than the host package. While this is intuitive at first-glance, in practice, the limitation causes issues and workarounds that are undesirable.
Elsewhere in the system, it is permitted to import libraries that aren't available to the minimum deployment target. You just need to gate usage of that library's APIs behind availability checks:
// App with <iOS 13 deployment target.
import SwiftUI // introduced iOS 13. No worries, you can import here.
...
@availability(iOS 13, *)
var someCoolView: some View { // This is fine.
...
}
However, with SPM, if you wish use a package behind availability checks, you can't – as you can't include the library as a dependency in the first place. Developers have been getting around this restriction by branching packages, lowering the minimum deployment target and marking all APIs with @available attributes. Package maintainers have been working around this issue by doing the same thing.
It would be far more convenient if Swift Package Manager allowed dependencies with greater minimum deployment targets than the target application's minimum deployment target, and then implicitly added the @available checks on the developer's behalf – matching the current experience for system libraries.