Can I legally slice something from stdlib into a package?

Hi SE, what exactly do I need to do to be able to slice something from the stdlib and ship it in its own package?

In my case I desperately need the diffing API on OS's that have no Swift 5.1 stdlib features.

Here is a quote from @Ben_Cohen from his recent pitch regarding stdlib preview package:

I don't expect the preview package to contain the diffing API because it will be shipped with newest OSs soon, but I would like to legally slice the diffing API into a package and depend my codebase on it.

1 Like

I think you only have to follow the rules set by the Apache License 2.0 accompanying the code. In short you are producing a derivative work and the derivative work has to carry the appropriate copyright, patent, trademark, and attribution notices. It also should include a copy of the license, even though only some parts of that derivative work might be under that license. This is my non-lawyer interpretation. See section 4: Redistribution.