Navigating the Ecosystem
Now that Swift is installed, there's still a major problem: the ecosystem. Many Swift libraries are designed with macOS and/or iOS in mind, meaning they rely (either intentionally or accidentally) on Cocoa APIs and Darwin C library bindings.
The best indicator that a library will work on Linux is if it mentions pure Swift somewhere in the name. This term basically means that it likely won't depend on any Cococa APIs, at minimum.
In addition, the presence of a
Package.swift file, used by the Swift package
manager, means that it doesn't require something like CocoaPods to build.
Note that when I say pure Swift, I'm not referring to this GitHub organization. Although they create pure Swift libraries, that's about it.
Here are some awesome libraries that work on Linux:
- Vapor: A popular backend web framework. The developers also maintain the PPA mentioned in :ref:`Installing Swift`.
- Kitura: A web framework by IBM. Note that, although they have Linux support, the documentation is very macOS-centric. It tends to assume you develop on macOS and deploy to Linux.
- SwiftGtk: GTK+ bindings. These seem to be rather complete and are auto-generated.
- Qlift: Qt bindings. Not sure how complete these are.
- Cacao: A UIKit implementation that works on macOS and Linux. No commits since late 2017, and there are open bugs related to building it.
- Regex: Regular expressions.
Feel free to submit more libraries!