Pitch: Generate `Package.swift` files with newer macOS versions

Hey everyone!

I wrote a short pitch about how I believe we should start generating Package.swift files when using swift package init with a default macOS version as opposed to using the current default version of macOS 10.13.

The pitch text is here and you can also see the initial implementation here.

I'm interested to hear what folks think is the right default here!

1 Like

Some unordered thoughts:

  • Just changing the macOS deployment target doesn't seem right to me from the perspective that we assume packages to be cross-platform since it implies that by default the package will not work on other Apple platforms without intervention. Typically you'd want all the deployment targets to be aligned.
  • There's a tension here of course between this nudging people to not support older versions vs. the current default errs on supporting older versions. I can definitely see a higher deployment target by default being almost unconditionally useful for executables, though.
  • In the fullness of time, the ideal experience would probably be giving people a simple way to change the deployment target once it is needed, e.g. when they add that dependency on swift-syntax or when they try to use unavailable API. An approach similar to SE-301 could help there, e.g. add-dependency could automatically adjust the setting for you.

Yea I was wondering how we could easily throw in the other potential versions as well, and I think it would be fine for that to be part of the change if we could figure out a useful way to do that.

Fair point that this could definitely apply more to executables than other types. I didn't mention this in the doc but of course apply to everything matches Xcode's new project behavior for better or worse.

That could be nice! It looks like the PR for that proposal is no longer being worked on. Are there plans that aren't linked there about making that part of the default installation?

Yep, I have been working on this: https://github.com/apple/swift-package-manager/pull/5802