Hacker News new | past | comments | ask | show | jobs | submit login

I’ve been writing Swift since the day it was announced.

I believe in the language as a system programming language (and I’ve done systems programming in the past).

That said, like C#, it is strongly associated with Apple as a “private” language (despite being open-source).

That’s probably a big reason it’s slow to be adopted in a wider fashion, but I’m sure there’s other issues.

It would be nice to see it be more widely adopted, but I’m OK with it being confined to the Apple ecosystem, as that is my ___domain.




There is more in that rationale than being privately owned. In comparison to C#, Swift is not natively adopted by any of the three big cloud providers (AWS, Azure and GCS) despite being the go-to language for half of all mobile apps (which is a huge market). C# is supported despite being Microsoft controlled. I believe that Swift does not have the confidence of the community due to Apple's radical technology choices.

IBM may have counter-balanced this.

What do other think is the reason for the slow backend adoption of Swift?


IBM has close to no momentum behind their cloud offerings compared to the big three.

I don't see how IBM will push for Swift in the future. They already pulled out (?) of the swift server working group, and didn't have the kind of pull to begin with.

IMO the most important reasons for the slow adaptation is lacking cross platform functionality (currently no upstream windows support + poor linux tooling) and questionable API design. Both make it difficult for new developers to give swift a try. Luckily, windows supportis supposed to come with the next version in a few months.

The API design is probably very subjective, but comparing the example in the blog post I don't understand how anyone could prefer:

import Foundation CFAbsoluteTimeGetCurrent()

over:

import time time.time()

The python way is much more intuitive IMO.


To play the devil’s advocate, I think time.time() is more vague than intuitive. What value does it have? 0? Current time? In what time zone? Is it monotonous?


You need to reverse the question: why would developers adopt Swift?

C# was successful because at the time it appeared people wanted an alternative to Java.


C# seems like much better time investment if you want to target many platforms and areas.

Now I do business web apps, but previously I did games. Which we published on all app stores + web. I'm also doing web sites. I did cross platform mobile apps with Xamarin. I can do even frontend web thanks to Blazor. I can use C# for embedded work - but that's not my thing. And you can use C# for machine learning, too.

With Swift I would be restricted. Which may be fine for some people who like to work only on certain kind of apps, but not for me.

Only Rust tempts me to learn and use as a new language.


For me as a long-term C# fanboy these modern times are hard. C# has benefits now because of the community and wide reach. That was always the argument against C# ;)


I see it picking traction. Probably won't happen in Bay Area but smaller shops worldwide are picking it because it has some advantages.

I don't expect it to takeover the world, I just want it to have enough success to keep me earning money and be kept up to date. Which kind of happens. :)


>What do other think is the reason for the slow backend adoption of Swift?

For web related work some other languages with their frameworks might yield better productivity: C#, PHP, Python, Java, Ruby.

In latest web framework benchmarks by Techempower, Java, C#, Kotlin beat it by a large margin.

It doesn't do very good against Java even in The Computer Language Benchmarks Game, where each wins in 5 tests.


> What do other think is the reason for the slow backend adoption of Swift?

It's not different enough. All the demos I've seen of it, felt like it was mostly an "also ran" language that modernised it to be a significant improvement over Obj-C.

But I've never seen any argument for it being a huge enough improvement over C#, Kotlin or others to be worth it to switch ecosystems.


I feel differently. I read the docs when it was first released and felt it was potentially hitting the sweet spot for "static yet expressive" and "familiar yet modern". I was mainly Python at the time and the readability and clarity impressed me and those are areas where I have very high standards.

More radical languages all tend to look a bit "read only" to me but I am aware that might just be unfamiliarity on my part.

C# and Kotlin both have nice features but they are more conservative Java-likes than Swift. Swift had enough modern features and syntax to feel like it would be reward the effort learning.

But I don't own an iOS device so I'm still waiting for a use case!


.NET and JVM also have Clojure, Scala, F#, C++ to choose from, metaprogramming runtimes, and AOT compilation support (although many seem to forget about this one).

So while Swift is a welcomed improvement over Objective-C, hardly brings anything worthwile to dump either the Java or .NET ecosystems.


Add the fact that both JVM and NET are huge ecosystems with tons of libraries.


I use Swift to write for all Apple systems (iOS, Mac, Watch and TV).

The only ones that are similar are iOS and TVOS, but there's a few differences in the way that you structure apps.


> C# and Kotlin both have nice features but they are more conservative Java-likes than Swift. Swift had enough modern features and syntax to feel like it would be reward the effort learning.

What does it have that Kotlin doesn't?

(As a Scala programmer, Swift and Kotlin look pretty much the same to me; as far as I can see they're both polished but conservative languages that don't fundamentally offer anything that wasn't in OCaml)


They're pretty similar on the surface but Kotlin is a bit hindered by it's Java legacy, generics are better in Swift (and for example C#) because of that. Swift has associated values with enums, Kotlin can assign a value to a variable with a when (switch) statement. Swift uses more pass by value, Kotlin does a lot more pass by reference. Kotlin has Java's form of garbage collection, Swift uses ARC. ARC is simpler to predict but can induce a performance penalty.

I don't think Kotlin has any form of the "ugly C" API Swift has.

Swift is a bit more secure in terms of "it compiles, it works" than Kotlin, but Kotlin is definitely a huge improvement over Java.


As someone who writes Kotlin and Swift on a regular basis, the Java bits that leak through to Kotlin are quite frustrating at times. If you picked up the language without a feel for Java’s quirks (as I did), Kotlin feels somewhat finicky and temperamental compared to Swift.

In contrast, Swift has done an excellent job of making a real clean break from its Obj-C predecessor, despite sporting full Obj-C interop. It has for most practical purposes none of Obj-C’s quirks for pure Swift code, which is great.

I frequently find myself wishing that Kotlin shared Swift’s level of independence from its predecessor, or that I could just use Swift instead. While Kotlin isn’t a bad language, its ties to Java leave me less than enamored.


> generics are better in Swift (and for example C#) because of that

Disagree. Reified generics let you write functions that do different things based on the runtime type of an object, but such functions are confusing to a reader and best avoided.

> Swift has associated values with enums

Java/Kotlin style enums are my favourite from any language, since they're first-class objects; you can give them a value in a field if that's what you want, but you can also have them implement an interface etc.

> ARC is simpler to predict but can induce a performance penalty.

In the general case ARC has the same pause problems as traditional GC, since you can't tell when one reference is the last living reference to an arbitrarily large object graph.

> Swift is a bit more secure in terms of "it compiles, it works" than Kotlin

How so? If anything I'd have expected the opposite.


Enumerations can satisfy protocol requirements in Swift; they're first class.


Fair enough. Looking into it, swift's "associated values" sound super weird; it seems like it means you can have multiple distinct instances for the same enum case, which breaks what I'd expect an enum to be. In fact an enum with associated values sounds more like a sealed class - both those concepts exist in Kotlin, but they're different and the difference is useful.


Associated values in enums make sense, if you look at the enum as a class/struct, under the hood.

It's quite powerful, once you get your head around it.

I write about that here: https://littlegreenviper.com/miscellany/swiftwater/enums-wit...

And here: https://littlegreenviper.com/miscellany/swiftwater/writing-a...


> Associated values in enums make sense, if you look at the enum as a class/struct, under the hood.

But they don't make sense as enums. If you have to look "under the hood" to get a reasonable model of a feature, it's a bad design.

> It's quite powerful, once you get your head around it.

> I write about that here: https://littlegreenviper.com/miscellany/swiftwater/enums-wit....

Like I said, you can write the same kind of thing very easily in Kotlin by using a sealed class - your example would translate line-for-line. It's a useful feature. But it's very confusing to call it a kind of enum rather than as a kind of class; as your other post acknowledges, it means Swift essentially has two different things that are differently implemented but both called "enum".


Yes. The enum behaves quite differently, depending on whether or not it has associated values.


>C# and Kotlin both have nice features but they are more conservative Java-likes than Swift. Swift had enough modern features and syntax to feel like it would be reward the effort learning.

What necessary modern features do you feel Swift has and C# doesn't?


Is there any kind of framework for backend use? I think that is a major factor in deciding what language to use.


https://vapor.codes/ seems to be the most popular one.

These guys are great: https://www.objc.io

I'm pretty sure their site is a Vapor server.


>That said, like C#, it is strongly associated with Apple as a “private” language (despite being open-source).

You can't use Swift on Windows. You can target practically target most operating systems with C#. C# is not only open source, but an international standard. Ecma (ECMA-334) and ISO (ISO/IEC 23270:2018)

Although both started as proprietary languages, both are open source now, both are developed mainly by one big company, the difference is that Microsoft is interested seeing C# on many platforms, while Apple doesn't have that interest.

I think Kotlin, Go, Rust have greater potential to rise in popularity than Swift.


Swift 5.3 (i.e. the next minor version) will support Windows: https://swift.org/blog/5-3-release-process/


If it supports Windows half as good as it does currently support Linux, that isn't much better than not supporting at all.


Swift wasn't open source when it was first released, and first impressions matter. Reputation also matters, and Apple has a poor track record of being a proponent of open source.

I would've been excited about Swift if it weren't for these things.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: