top | item 45838219

(no title)

vtail | 3 months ago

Do people use Swift outside of Apple iOS/macOS development in real life? Especially on platforms like Windows/Linux/*BSD?

discuss

order

lukeh|3 months ago

I’m using it on Linux for an embedded product. No reason other than it’s a nice language that I am familiar with and productive in. The async/await features are quite nice too when you need to implement a lot of protocols / state machines.

wkat4242|3 months ago

Personally I stay away from Corp owned languages. Even cross platform ones like .net, Java and also swift. With the single commercial party owning it you never know if theyll close it, change things for the worse or get acquired by a hostile party which obviously happened to java :(

vlovich123|3 months ago

Which language would you classify as not corp owned?

It’s also weird to include Java and Swift in that list considering both afaik are maintained by a separate foundation. Java from Sun is even predominantly basically OpenJDK with some remaining proprietary Sun / Oracle bits but it’s the reference open source implementation used by most everyone.

MattDamonSpace|3 months ago

Apple’s the exception that proves the rule, they do a fantastic job supporting legacy APIs, frameworks, and devices

andrewl-hn|3 months ago

Arc browser famously had native parts of the UI done in Swift, which admittedly is not a lot: browser tabs, some popups and buttons here and there, a lot of their settings UI is rendered in HTML and is stock Chromium. Which is probably why they actually made a port of it to run on Windows rather than rewriting it into something like Qt or WPF or whatever.

Ladybird browser team planned to start using Swift in their codebase, but it hasn't happen yet.

andrekandre|3 months ago

  > Ladybird browser team planned to start using Swift in their codebase, but it hasn't happen yet.
whats the holdup?

afavour|3 months ago

Chicken/egg, I think. There was a burst of activity of Swift on the server a few years ago and frameworks like Vapor seem like they’re still pretty active:

https://vapor.codes/

But I think “why” remains a valid question when you could make a safe pick like Node, Python etc. I really like Swift as a language but I’d still struggle to justify using it outside of iOS.

wlesieutre|3 months ago

There were three major server side Swift projects, and Vapor is the surviving one from that era

Dead projects are

- Kitura https://github.com/Kitura/Kitura

- Perfect https://github.com/PerfectlySoft/Perfect

Don't know of large organizations using it in production, the vibe I get is that it's useful for an iOS developer who wants to deploy a small server for their product without learning Python or Javascript.

You could certainly use it at larger scale, but you have to justify giving up the big ecosystems of its competitors.

KerrAvon|3 months ago

Swift is a peer to Rust, not Node / Python. It has some nice affordances that Rust doesn't, while still being a native-compiled language.

zerr|3 months ago

Does not support Windows.

GeekyBear|3 months ago

Like Rust, Swift is a compiled language that offers memory safety and data race safety by default.

viktorcode|3 months ago

Data race safety is not offered by default. In Swift 6.2 you can enable strict mode and it will cover majority of data race problem, but not all.

timeon|3 months ago

> by default

As far as I know there is no clear boundary between safe and unsafe.

worik|3 months ago

Not really that much

It's been two years since I was an iOSSwift programmer, but the concurrent/parallel facilities were quite woeful. Memory protection no nonexsistant

I do not miss it. This might be useful for porting Apple software, but do not start new projects with it.

rootnod3|3 months ago

I guess so. In a way it makes sense if you can share your code base between the iOS/MacOS app and your backend. It makes development easier. But I guess that the majority of apps is not running MacOS servers for the backend. So far it's probably some node backends and all going JSON inbetween. But for some dedicated apps without a web portal inbetween it might be easier if app and backend are both in Swift.

tiltowait|3 months ago

It’s not super popular, but support is necessary to make it so. There are some well-regarded frameworks, like Vapor, that are written in Swift.

mk89|3 months ago

It'd be nice to use it for server side too, but the ecosystem is really not mature and the build system is not on the same level of Gradle or similar.

Plus, most of the open source libs are one person's weekend projects, from 3 years ago...

It's a great language, but nowadays tooling/ecosystem and build systems are key to success.

cosmic_cheese|3 months ago

> …and the build system is not on the same level of Gradle or similar.

Worth noting that Gradle's long list of capabilities can sometimes be as much of a liability (or at least a frustration) as it is a boon. A great many projects don't need even a fifth of its complexity.

pjmlp|3 months ago

Yes, because Apple gave up on the server market, so that demography usually uses Linux based servers and does code sharing between backend and their iDevices apps.

repelsteeltje|3 months ago

Only for iOS apps. Apple does not offer a backend.

turnsout|3 months ago

Not true at all. Swift is a very capable backend language, Apple has open sourced a lot of great libraries to power server software development, and there are projects like Vapor [0] that are used in production.

[0]: https://vapor.codes

tehnub|3 months ago

Could SwiftUI ever be used outside of Apple?

viktorcode|3 months ago

SwiftUI is build upon Apple's frameworks like Metal, CoreGraphics, CoreAnimation, and UIKit / AppKit. If someone want's to make a version for another platform, they will have a whole lot of work to do. That is the real show stopper, and not the core SwiftUI features like many were led to believe

MattDamonSpace|3 months ago

Probably not, Apple would have to opensource it and that’s unlikely

dejv|3 months ago

No