Why Swift is iOS only language

I know.
We have Kiutra, Vapor, Perfect ... for service side programming.
We have Swift Tensorflow.

But still many people think Swift as a language for Apple platform.

I really love working with Swift and I want to see Swift become more widely used languages.
Why doesnt it actually happen?

2 Likes

I think it’s happening, it just takes time. IMHO Swift is still quite young by programming language standards.

2 Likes

Swift is supported on ZERO current linux distros.
If you count old versions it is supported on only one. And it's not even available to be installed directly from the package manager.

8 Likes

In addition, the standard library is extremely anemic. For things as simple as JSON parsing you need to import Apple libraries (3rd party from the point of view of Swift). Same for networking, concurrency and other basic things that you would need to build something usefull in other platforms. This is a huge red flag for people outside the Apple ecosystem.

1 Like

so.. no hope for swift?

Not without some serious non-Darwinian evolution...

11 Likes

I think it because of 3 pieces which are still missed:

  1. Module Stability.

  2. C++ interpolation.

  3. IDE and tools outside of macOS.

You can actually use Swift for other platforms. Have a look at Silver: The Swift Language for .NET and Java/Android | RemObjects Software. There's IDE support for Mac and Windows, and you can develop for .NET, Java, Android, WebAssembly and more, all in Swift. It's free, too.

That looks rather than a reimplementation of Swift with a new compiler; something that may have its merits but also its own set of drawbacks (especially when there is no official language standard).

1 Like

I used Java for almost 15 years before switching to Swift and found Swift several orders of magnitude easier (and more fun) to use. Sure, the ecosystem is nowhere near what Java has and I don't expect Java developers to migrate to Swift anytime soon, but if you're building a back-end for a mobile app, I recommend you try server-side Swift first (instead of Java, Node, PHP, Ruby or whatever you've used in the past).

It is. Why is that a problem? There's not just one single C compiler world-wide, either...

Fwiw, with Elements you can use Swift on the Java platform (including the whole ecosystem, existing libraries, and all, and including Android). And you can can even mix with existing Java code, on the same project.

(You can also use the Java language, to target iOS, or other platforms, as well)

It's a deliberately incompatible reimplementation. All of the collections are reference types, with an explicit notice that they aren't going to ever make them value types, because, the authors claim, there's no way to make a copy-on-write collection type efficient on JVM or .NET.

You can provide your own, if you so desire. Also, I would not call that a "language incompatibility", it's merely a type in the framework that is does not have the same API, that's not the language.

in the nicc of time

4 Likes

And Elements lets you target Linux natively, via .NET/Mono or via JVM — whichever API/platform you prefer... ;)

Potato potato. Code written for the normal, "reference" if you will, implementation of Swift might very well not run on this. Silver certainly doesn't enable you to "use Swift for other platforms" not supported by upstream, at best it allows you to write code that looks a lot like Swift.

Additionally, it's a commercial closed source product, so you should probably at least mention you work for them when advertising it.

9 Likes

@marc_hoffman Sorry, but Silver lost me at the first screenshot. The code in those screenshots looks like it was translated from Java/C# with no attention to Swift's design guidelines whatsoever. It it wasn't for the .swift extension, I would have never known they contained Swift code.

I'm a language implementor. I'm always excited to see interesting new language implementations. I think Silver is a neat project, and I'd be happy to talk to you about ways you could efficiently implement full value semantics in a JVM or similar environment. I certainly don't begrudge the existence of a second implementation of Swift, although as a project maintainer, it does pain me a little to see that effort not going into improving the main implementation. (And I think SIL would help a lot with that efficient-value-semantics problem!)

But... a programming language is not just a grammar and a type system. There's a lot of room for variation between implementations, but basic semantics are part of the language, and that includes core library types. Many typical programs will not work the same way in the main Swift implementation and in Silver, and to me, that does make them not implementations of the same language. So, speaking just for myself, I'm not very happy about Silver calling itself a Swift implementation until it fixes that problem.

26 Likes

Now back to the original question: Why is Swift iOS only language?

Perhaps there’s some insight to be gained from Stack Overflow Trends:

The iPhone was and remains the killer app, initially driving the adoption of Objective-C. After the initial gold rush subsided, the interest in the platform has stabilized around 2012, while its primary language has peaked mid-2011 and is in steady decline (in terms of SO question share) ever since. Shortly after its introduction, Swift has succeeded in cleanly replacing Objective-C as THE language for the platform since 2015.

Programming languages backed by the platform vendor have built-in audience of majority of the developers for that platform, which enables a language to become overnight success. It is also not an accident, because such language is usually backed by the full might of the platform vendor’s in-house developers that work very hard to make the language well suited for the primary domain, while also adapting the platform to better fit the language. The smoothness of Swift dethroning the Objective-C is a testament to excellent job Apple did in making it work great for iOS development.

For a language to break out of initial niche (however large) into programming at large is a many years effort and Swift is simply too immature to have a serious shot at it at this point in time.

It would be very interesting to hear a coherent vision for the future of Swift directly from the horse’s mouth, because my impression is that the SE community is quite out of sync from the efforts currently in progress largely behind closed doors.

6 Likes