News for hackers. Stuff that matters.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by ternaryoperator on Sunday December 19, 2021 @07:41PM (#29620291)
Swift is a language that feels right to me in ways that others don't. I code on Linux and Windows, not on Macs. Swift on Linux works OK, but it's there that you really see how few pure Swift libraries there are. For example, on the project we were exploring, the only Swift library for handling zip files--and we asked the community several times--was a personal project with 14 stars. That was not going to work for our enterprise.

The port of Swift to Windows barely functions and in every dimension is in worse shape.

It's a shame b/c the language is truly beautifully designed.

Re:Apple’s use of Swift and SwiftUI in iOS 15 by thepete2 on Sunday December 19, 2021 @08:00PM (#29620420)
Don't swift and rust share a few of these things that make it "feel right"? With rust the whole ecosystem thing seems to be a lot better. Also rust has C(++) interop (so you have every library you could wish for), does swift not have that?
Re:Apple’s use of Swift and SwiftUI in iOS 15 by Redoubts on Sunday December 19, 2021 @09:47PM (#29621041)
It does have c interop so you could just use libarchive. Though writing c in swift is a bit less magical.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by randomNumber7 on Monday December 20, 2021 @05:07AM (#29623044)
While technically true you then have to use pointers in swift and they made it hard by design to do that.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by heavyset_go on Monday December 20, 2021 @02:30AM (#29622293)
Last time I looked, Swift didn't have a stable way to export C-compatible ABIs.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by saagarjha on Monday December 20, 2021 @07:31AM (#29624135)
@_cdecl exists, although it's underscored.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by heavyset_go on Monday December 20, 2021 @03:27PM (#29629863)
I was under the impression that this feature wasn't stable, but it's been years since I've thought about it.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by mshockwave on Sunday December 19, 2021 @07:53PM (#29620364)
Second this. IMO Swift is extremely easy to pickup, especially if you're coming from C++ land like me. But sometimes I feel its ecosystem being...obscure.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by mmargerum on Monday December 20, 2021 @05:50AM (#29623357)
well yeh if you can pick up c++ then swift is easy, but apple is positioning it as a first language which it is definitely not.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by tonyedgecombe on Monday December 20, 2021 @02:33AM (#29622301)
I don’t think the story is ever going to change much on non Apple platforms. It just doesn’t make sense for them.
Re:Apple’s use of Swift and SwiftUI in iOS 15 by zapnuk on Monday December 20, 2021 @05:35AM (#29623230)
> It just doesn’t make sense for them.

It does though. As least for me. Better support on Windows and Linux would increase the number swift developers which would the in turn result in more and better open source libraries.

For Apple this could mean that their own open source libraries could get better, they have more tools/libraries to choose from, or simply that they have a greater pool of talent for hiring.

Looking at Go (and Rust) I think this is somewhat shown. There are a lot of different factors, but I think the development tools of Go is the #1 reason why it is basically the only "new" language in a long time that gained a large enough popularity to become mainstream - as in you actually find jobs developing in Go. Which is in some ways sad. It seems like Swift could be the very good fit for backend/serverless development.

I guess the real question is how much effort would it take to get the development tools like editor support to the next level?

Re:Apple’s use of Swift and SwiftUI in iOS 15 by auggierose on Monday December 20, 2021 @07:07AM (#29623943)
Swift is designed to be a lock-in to Apple development for Apple. If it was otherwise, why WOULDN'T you also provide compilation to Wasm and Javascript, etc., if you are a company with the resources of Apple? Don't get me wrong, Swift is great, but it is a big lock-in.

I have programmed for the last 4 years or so almost exclusively in Swift, but I am now switching to TypeScript in general. Writing my libraries in TypeScript, I will still be able to access them from Swift and other languages via embedded browser engines.

Re:Apple’s use of Swift and SwiftUI in iOS 15 by tasogare on Monday December 20, 2021 @10:37AM (#29626061)
> why WOULDN'T you also provide compilation to Wasm and Javascript

Because it's useless save for a single kind of development (websites) and the main issue is not even in spitting out WASM but making the language runtime and libraries work in the browser. Most languages have no first-party WASM or Typescript support either.

Re:Apple’s use of Swift and SwiftUI in iOS 15 by auggierose on Monday December 20, 2021 @10:57AM (#29626284)
Yes, because those other languages are made by other companies with equally vested lock-in aspirations.

You are right, Apple has no interest in supporting Javascript, what good would it do them except more work and hassle?

It would help many programmers though, to make their code more portable and available on more platforms. It would not be that easy to do, but also not that difficult. Rust is supporting WASM, Scala is supporting Javascript. Kotlin as well. Apple can't do it? Come on.

Just stating the obvious: The interests of Apple and programmers are aligned in some aspects, and opposed in others.

Re:Apple’s use of Swift and SwiftUI in iOS 15 by weichsel on Monday December 20, 2021 @03:02AM (#29622429)
If you are still looking for a pure Swift ZIP handling library, you can check out ZIPFoundation: https://github.com/weichsel/ZIPFoundation
Re:Apple’s use of Swift and SwiftUI in iOS 15 by Zababa on Monday December 20, 2021 @03:58AM (#29622688)
You could take a look at either Rust or OCaml, Swift feels like it's between the two.