1. 26

Swift seems like a lovely language, but it seems almost exclusively tied to the Apple ecosystem.

Obviously, Swift is an Apple project and I would expect it to be popular there but what surprises me is that Swift doesn’t seem to have made any inroads into non-Apple ecosystems. Apple has made it a point of porting Swift to Windows and Linux but I’ve never seen it used there.

So, I ask: is it because I haven’t looked in the right places, or is it because Swift isn’t used much outside of Apple? If you’re using Swift on a non-Apple platform, I’d love to hear about your project.

    1. 6

      After ~24 hours, the answer would appear to be “no”.

      That’s a shame. I know it’s blasphemous, but I think Swift is a more elegant and usable language than Rust. I’m sad that it’s probably going to be Apple-only for the foreseeable future.

      1. 2

        Swift for most part, is an “application” language. To me, a good application language can express interactions with end-users in succinct manner. When we speak non-Apple language in production environment, what most people refer to would be either Android apps, Windows apps, Web backend or micro-services (maybe with the exception of games).

        Android apps / Windows apps, it would be a good fit but apparently no. Swift is too immature and people won’t want to shoot their foot with a language that is not officially blessed by the platform. Windows is probably more open in that regard, but it takes time to mature on that platform.

        Web backend, these are dominated with Go / JavaScript at the moment. Swift have some open-source frameworks, but it is going to be niche. Web backend for most part aggregates data from micro-services and do some basic business logic. The language is simply not there for basic building blocks that we think would be good for efficient web backend logic such as coroutines.

        Micro-services, this is a big category with all kinds of different requirements. Swift is actually not a bad language for these, but it doesn’t have a nice deployment story as Go / Rust (static binary just supported towards the end of last year, otherwise it requires Swift runtime). Not to mention the lack of coroutines which would be useful for some simple micro-services.

        Games, I think Swift would be excel at that. But we are in a world with only two game engine that matters, and they have their own supported language.

        I personally use Swift for all kinds of things on Linux, from Jupyter notebook to command line tools. The language is nice, but its ecosystem will take another 3 to 5 years to mature.

        Swift does mature slower than Rust or Go though if you consider the language itself is already 7-year old now.

    2. 5

      I tried using the Vapor web framework on Linux, it seems to have a decent following for something that targets a non-Apple environment. It, and Swift on Linux, felt too immature at the time though, with some flaws like terrible compiler error messages and very bad compilation times. This was probably two years ago now though so things may have changed.

    3. 5

      IBM must have been for a while, as they lead the server-side swift efforts, but IIRC they’ve abandoned them to the community now.

    4. 3

      My last two clients write their backend services with swift and it’s going well for them. Those services are running on linux. I honestly don’t see much usage of swift outside of the apple ecosystem. I should add that my client’s business is an iOS app.

    5. 3

      Doesn’t answer your questions but if you’re looking into something similar with wider adoption, from my experience, Kotlin Native is pretty close from Swift and benefit from a larger community.

      1. 4

        I was thinking the same thing. Relevant article http://nilhcem.com/swift-is-like-kotlin/

        1. [Comment removed by author]

      2. 2

        Afaik swift uses exclusively value types (using cow to avoid spurious copies), while kotlin has reference semantics. Which is a pretty big difference.

        1. 7

          No, in Swift a “class” type is a (ref-counted) heap object with reference semantics. A “struct” is a value.

          Most standard library types — strings, collections — are structs, because value semantics are useful. Internally they are wrappers around a class object holding the data, with some COW idioms that allow the class object to be mutated if its refcount is 1, else copied.

          1. 1

            Most standard library types are structs, because value semantics are useful

            So, my point stands: swift has pervasive value types, in a way that kotlin doesn’t.

            1. 2

              I don’t think your point stands. You might as well say that C++ “uses exclusively value types” instead of reference semantics, because the STL containers and strings are value types. Which is silly.

              (Is this an English-language issue? “Exclusively” means “only”, so you were saying that Swift only has value types.)

    6. 2

      These people are building their server side service in Swift:


      ORM, JWT, ed25519 implementation, etc.

    7. 2

      I’ve heard that DeepMind uses it, or some derivative of it. I think the guy who invented it at Apple got hired by Google.

      1. 5

        That guy was Chris Lattner. He and others developed Swift for Tensorflow with it, but it got archived last month. I dont know if they still use it internally.

        1. 2

          He and others developed Swift

          and LLVM ;)