Swift is open-source but is it patent-free as well?

So it seems that some or all of Swift is open-source, I'm not sure what if any parts of it are not at this point.
But I am now wondering, are there any Apple patents that people need to take into account or worry about when adopting Swift?

I'm no lawyer so take all this with a grain of salt, but the relevant part of the license seems to be this: https://github.com/apple/swift/blob/ecebce8b2eae7613dd8422fb8bcd7e519d0606cd/LICENSE.txt#L73

So as I understand it you'd only have to worry if someone contributed some patented construct to Swift without having a right to do that (and even then I don't know whether it'd be users of Swift or the contributor that would be in trouble). I know this sometimes becomes relevant in video codecs, but I don't think you'll need to worry much about this with Swift.

I think you folks are misunderstanding me. I'm not interested in whether Apple is going to take my patents. I'm interested in the moral issue of whether Apple has patented parts of Swift itself. There is a plague of software patents nowadays, for instance US 9,672,152, in which every tiny detail of how software works is getting patented even though there is ample preexisting use of those same mechanisms i.e. Prior Art. If Apple has patented parts of Swift, then at any time they can demand payment for anyone using the patented parts of the language or runtime, and you may find the friendly face disappears and is replaced by the angry monster demanding a pound of flesh.

In what context are you talking about? Are you thinking about lifting pieces of code of the Swift compiler into your own work? Because with that, I think you might run into issues with the license and any patents used in the software.

Or are you talking about using Swift on your server/app/IoT device? Because if they could do this, and did, I could almost guarantee a tremendous backlash that would almost certainly cause Swift adoption to drop to next to nothing. So I wouldn't worry too much about it.

Swift is licensed under the Apache license, which includes a clause stating that all contributors, implicitly in the act of contributing, grant a license to all users to use any component of any patent they own that is necessary in order to use their contributions as part of Swift. That grant is perpetual and irrevocable with regard to both all past contributions and all current contributions. Apple could, in theory, publicly declare at any point that its future contributions will no longer be licensed under the Apache license, and then it could pursue patent infringement claims against any users of versions of the Swift code that incorporate those future contributions. However, (1) that would obviously kill the project, so (2) we have no intention of doing that, and (3) you would know about it in advance if we did because we'd have to be very explicit about it, and finally (4) you'd still be able to freely use all versions of Swift up to that point.


This leaves unspecified what happens when a contributor violates the license by contributing code which they themself do not legally have the right to.

It is even conceivable that someone might have the legal right to a piece of code in one jurisdiction but not another.

Yes, but that’s not what we were talking about.

I’m not sure that there’s anything we could do about that particular risk — someone contributing code that they do not in fact have copyright or patent rights to contribute — as a project, other than responding promptly to any notice of violation. At any rate, it’s not an Apple- or Swift-specific problem. I’m fairly certain this cannot possibly affect you if you’re just using a project- or Apple-supplied toolchain, but if you’re very concerned about this, you should talk to a patent attorney.


I am not a lawyer, and this is not legal advice.

However I can share that the choice of releasing Swift under the Apache 2 license was specifically driven by the goal of allowing widespread adoption and use of the code, without worrying about patents or other related issues.

I don't speak for Apple at all, but my understanding is that they want to see the code used very widely.