166 points · by pjmlp · 2y ago · 110 comments
Though I haven't used Swift in production I have enjoyed its ergonomics in my tinkerings with it. So I'd be so glad if Swift is able to break out of its niche into broader usage.
Well that was until late 2023. Then they realized nobody was writing pure Windows UI code in WinUI 3. (Probably because people were still playing catch up). So they have now have unofficially mothballed WinUI 3 and the new hotness is now MAUI - cross-platform UI! - in 2024. (But no Linux support ho-ho)
Not sure what it will be next year.
Imagine how many developers would just release to the App Store and re-release that on Android/etc to not need two codebase, and Apple would expand their 30% cut massively.
A lot of Android users would get apps from Apple’s store due to vetting/generally higher investment in App Store apps from major companies.
Apple is the iPhone company, everything else is just accessories.
The strategy Apple employed in not prioritizing C++ as a primary language, while also introducing Swift as a new language, is quite intriguing. It raises questions about the factors contributing to its success—whether it’s a result of the approach itself or despite it.
AFAIK, the main factor contributing to the success of Swift in the Apple ecosystem is probably it being the replacement for Objective-C. Unlike C or C++, which required going through Objective-C or Objective-C++ to access the native platform libraries, Swift could access them directly.
That advantage does not exist on non-Apple platforms, which already have C or C++ as the most direct way to access the native platform libraries.
How common is it to need manual FTI bindings and if so, how hard is that? Reading https://www.swift.org/documentation/cxx-interop/ and https://forums.developer.apple.com/forums/thread/744361, I get the impression it’s fairly simple, if not often fully automated, and both Swift-to-C++ and C++-to-Swift calls look like normal calls in the respective languages.
> The strategy Apple employed in not prioritizing C++ as a primary language, while also introducing Swift as a new language, is quite intriguing.
They’re aiming to have good compatibility with existing C++ code, with all new code getting written in Swift.
It's a shame, because Foundation.framework circa 1994 was a better standard library than any other language had at the time. Many have caught up since!
Swift has many virtues outside of SwiftUI -- real static typing, functional, sophisticated generics without all the gotchas of C++ templates, complete ABI, efficient exceptions, the syntax isn't so foreign to people used to C++/Java/Rust/Ruby/Python; I could go on and on.
I've written Objective-C code for 23ish years, and I like it a lot, but no one entering the workforce cares about its remaining virtues and the language has been mostly unchanged for almost two decades.
Also Objective-C had comparably miniscule community effort in open source, the Swift on Server community is humming along, active, and businesses are using it on Linux. It's only grown in popularity... not sure Objective-C ever saw any amount of growth outside of Apple's platforms!
Secondly, yes Swift is quite relevant on Apple platforms, and that is exactly why the only ones that really care about using Swift on Linux, are mostly Apple shops writing the server side of their iDevice apps, since Apple killed OS X Server, leaving Linux distributions as the only option for server side.
This on Windows is kind of nice that it exists, but I doubt it will ever take off beyond what the folks at the Arc browser are doing.
The language is great, however the whole ecosystem speaks Apple Frameworks.
The only thing it does is spreading the FUD further.
(I knew it was him even before opening the link, as he's the only source of vocal publicity of this kind)
I would also say that it is generally a better language feature-wise. C# suffers from having been an almost carbon copy of Java originally (with some Delphi thrown in for good measure).
We are way beyond C# 1.0 nowadays, and Valhala is still not here.
>"Saleem Abdulrasool is the release manager for the Windows platform (@compnerd), is a prolific contributor to the Swift project and the primary instigator behind the port of Swift to Windows." Saleem's github, https://github.com/compnerd, lists swift-win32 repo, which is a "a thin wrapper over the Win32 APIs for graphics on Windows." So it's one person wrapping Win32. Not too promising yet, but it's early and there's room for Windows programmers to get involved.
Amazing work by Saleem and the team at The Browser Company to devote years to this and make it a success.
Windows still commands about three-quarters of desktop OS market share. If you want to leave a lot of money on the table by not targeting/developing for Windows, I suppose then there's no benefit. Not even mentioning that Windows unironically is a decent platform to develop on and develop for.
Windows also has the advantage (shared with Linux) of working on a very wide variety of desktop/laptop/workstation/server/etc hardware models from many independent vendors, while macOS is restricted to only a small number of hardware models from a single vendor.
support of cmake of swift seems good path for interop cpp(build it and codegen).
csharp did not have ideal story there.
Microsoft and Google each have languages/ecosystems with larger developer share (Google at over 6% for Dart, and Microsoft at over 27% for C#).
[1] https://survey.stackoverflow.co/2023/#technology-most-popula...
> It would be a completely new source of developers for these platforms.
I have no idea who you're referring to here. Who are the developers that are locked-in to iOS/MacOS but would consider ChromeOS or Windows if it supported Swift better? I cannot think of a single person I know that fills that bill. If anything it's the other way around, where people end up switching away because they don't have any use for Swift/AppleScript.
Opposite is not true though, there are lots of troubles you have to go through to have Swift on Android/Windows.
Very often, especially in startups, when the new app is created, it is first created for iOS and then for Android. Having proper Swift support would reduce effort for bringing apps to Android/Windows.
The future is not that far off where you can write a 100% native Android app and, minus any Android OS-specific functionality, port it over as-is to iOS and desktop.
I mean, this is just absurd logic. How is the lack of Swift support on non-Apple platforms somehow up to Google or Microsoft? The burden to support more platforms is on the language developer, not the platform dev.
I wouldn’t assume that any iOS engineer would be jumping all over the opportunity to make Android or Windows apps just because they can do it with Swift. They have their (typically pretty lucrative!) niche and are happy living in it.