[HN Gopher] Swift Tooling: Windows Edition
___________________________________________________________________
Swift Tooling: Windows Edition
Author : pjmlp
Score : 150 points
Date : 2024-05-19 06:26 UTC (1 days ago)
(HTM) web link (speakinginswift.substack.com)
(TXT) w3m dump (speakinginswift.substack.com)
| rrishi wrote:
| Gotta hand it to The Browser Company for doing so much for Swift
| lang.
|
| 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.
| cube2222 wrote:
| They supposedly also got SwiftUI working on windows. I'd be
| curious to hear more about that, cause I believe the article
| doesn't touch on this one.
| iamkonstantin wrote:
| It's not SwiftUI (which would require Apple's AppKit or
| UIKit), but rather interop with the Windows native WinRT
| https://speakinginswift.substack.com/p/swift-meet-winrt
| zer0zzz wrote:
| I thought folks like saleem already had been building up a
| UIKit-like layer for exactly this.
| newZWhoDis wrote:
| A properly motivated Apple would have been pushing cross
| platform Swift/SwiftUI and launched an App Store on both
| Android and Windows.
|
| 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.
| dlahoda wrote:
| seems component object model(binding model and ref counting,
| winrt and dx) well fit for swift scripting.
|
| support of cmake of swift seems good path for interop cpp(build
| it and codegen).
|
| csharp did not have ideal story there.
| zerr wrote:
| How is the core/foundation framework porting (to Windows) going
| on?
| zerkten wrote:
| Is that how they are handling any of the Swift UI work for Arc
| (their browser)? I think they are 100% focused on bringing the
| Swift compiler etc. over and leaving all UX to the Windows UI
| (WinUI lib?) so that they have a native experience on macOS and
| Windows.
| zerr wrote:
| Yes, but I mean the non-UI stuff: concurrency, networking,
| file system, etc...
| navanchauhan wrote:
| You have Swift-NIO for cross platform form networking,
| OpenCombine as an open source implementation of Combine,
| and I'm not sure what you mean by file system but you can
| read/write files without needing any library other than the
| cross platform Foundation implementation
| fao_ wrote:
| > without needing any library other than the cross
| platform Foundation implementation
|
| which is seemingly what the user above was talking about!
| I think
| zer0zzz wrote:
| It's done?
| nolongerthere wrote:
| Very impressive, when TBC said they were implementing their app
| in swift for Windows I wrote it off as vaporware that would never
| ship, as the goal seemed too audacious and unnecessary, but they
| did it and continued to push forward!
| airstrike wrote:
| I'm a simple man. I see Swift outside of iOS, I upvote it.
| Rimtariro wrote:
| I feel like Swift is a big miss from Google/Microsoft. If they
| supported Swift on their systems (properly supported), they would
| immediately open up their platforms to lots of Swift developers,
| and I think the benefit would be more than they would need to
| invest into supporting Swift.
| stakhanov wrote:
| Swift developers are not that many. It's less than 5% of
| respondents to the Stack Overflow developer survey [1].
|
| 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...
| airstrike wrote:
| less than 5% vs. over 6% is not that big of a difference
| Rimtariro wrote:
| It's not a zero-sum game, they don't have to reduce support
| for other languages. It would be a completely new source of
| developers for these platforms. Better 1% than 0%, and I
| would say that effort for that would not outweigh the
| possible benefits and income from new devs/apps.
| talldayo wrote:
| It's not Microsoft and Google's job to write Apple's
| software for them. It's like complaining that Apple doesn't
| write a good Dotnet runtime; of course they don't. It's not
| their job, and they don't want to anyways.
|
| > 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.
| binkHN wrote:
| Kotlin is at 9% and Java developers, at 30% here, could
| easily switch over.
| briandear wrote:
| Is that survey actually scientific? I have been doing Ruby
| and Swift for years and never completed that survey. That
| survey is of reasonably active users to Stack Overflow --
| there is a selection bias. There isn't a lot of great Swift
| content on SO, so that's going to attract fewer developers to
| answer the survey.
| surajrmal wrote:
| Apple not supporting kotlin/java/c# is a big miss by that
| logic. Those languages are far larger in market share than
| swift.
| Rimtariro wrote:
| Those languages are already well supported on Apple platforms
| from the language makers themselves, there is not much Apple
| can do to "support them" better.
|
| 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.
| charles_f wrote:
| So how's that not a big miss from Apple to support Swift on
| other platforms and open themselves to have more developers
| supporting theirs?
| hu3 wrote:
| Somehow it's never Apple's fault.
|
| Apple doesn't really care about Swift outside their
| wallet garden. How dare other companies refrain from
| investing in such a wonderful creation!
| Rimtariro wrote:
| It's not about Apple. Google/MS would invest for their
| own sake, so that it would translate into more apps
| (earlier, not as a second class citizen) on their
| platform, which in the end would bring money as well.
| hu3 wrote:
| The math is not that simple.
|
| Investing in Swift would to an extent canibalize Go,
| Dart/Flutter, TypeScript, C#. You know, the technologies
| which have creators that actually care and invest
| billions in cross-platform development.
|
| Not to mention fragmentation.
|
| Apple doesn't even care about Linux running in their own
| hardware. Their contribution towards that goal ranges
| from hostile to scraps, depending on who you ask.
| Rimtariro wrote:
| Don't make it sound like a zero-sum game, because it is
| not. They don't have to drop any of the support they
| provide for other languages right now.
|
| In fact, they don't even have to do that much for Swift.
| They don't have to develop neither the language nor the
| compiler.
|
| They need to do similar to what The Browser Company did,
| exposing and allowing usage of their APIs from Swift, and
| maintain it as their API evolves.
|
| If The Browser Company could afford it, while developing
| the browser, Google and Microsoft can afford it as well.
| hu3 wrote:
| > If The Browser Company could afford it, while
| developing the browser, Google and Microsoft can afford
| it as well.
|
| If The Browser Company could afford it, 3 trillion USD
| market cap Apple can afford it as well.
| stonemetal12 wrote:
| For an Apple\Google owned ecosystem it is. If leaving the
| walled garden is a button click away, what app would be
| Apple or Google exclusive? Suddenly an iPhone Owner's
| favorite apps are on the other platform too, so when
| upgrade time rolls around why buy an iPhone (and vice
| versa for Android)?
|
| Commoditizing your own product is never in a company's
| best interest so don't expect it to happen willingly.
| stonemetal12 wrote:
| If anything they care about keeping it inside their wall.
| Just think, if Swift apps were a button click away from
| running on Android. Suddenly the best iOS apps become
| multi platform at no additional effort, dependence on
| Apple becomes a little less.
| Rimtariro wrote:
| "open themselves to have more developers supporting
| theirs?" -- Thats exactly what is missing from
| Google/Microsoft. Apple is already supporting Swift on
| other platforms, however, developer experience is not as
| good as on macOS and I don't think that can/will be
| solved by Apple. It is exactly where other players
| missing out, by making their dev experience as good or
| better, they could help developers write apps for their
| platforms.
| farmerbb wrote:
| We've had Kotlin Multiplatform for a while now, so a
| developer writing an Android app in Kotlin could bring it
| over to iOS and desktop platforms today with reduced
| effort. Compose Multiplatform aims to take this a step
| further by allowing UI code sharing instead of just
| business logic.
|
| 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.
| afavour wrote:
| There are very few "Swift developers" out there. Much more
| common are "iOS developers who write in Swift".
|
| 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.
| Rimtariro wrote:
| They don't have to jump though, many iOS developers also do
| watchOS/macOS apps but they are still "iOS developers". If
| they can bring one more platform under their belt with little
| effort, I would say that many of them would consider it.
| callalex wrote:
| watch/mac/iOS are all the same platform just with a
| different window manager.
| pjmlp wrote:
| Not really, but it is easier to think that way.
| callalex wrote:
| At this point how do they differ?
| jwells89 wrote:
| Different toolkits and interaction models.
|
| AppKit is still dominant on macOS (despite the addition
| of Catalyst), UIKit is the chief framework on
| iOS/iPadOS/tvOS/visionOS, SwiftUI is native on watchOS
| and mostly wraps AppKit/UIKit on the other platforms.
| macOS is oriented around KB+mouse usage,
| iOS/iPadOS/watchOS are touch-dominant, tvOS is made to be
| remote-friendly, and visionOS is oriented around eye
| navigation and hand gestures.
| raydev wrote:
| macOS is far more complex and flexible than the iOS
| family of OSes (which are really all just iOS, including
| iPadOS).
|
| Apple claimed they were running OSX back at the iPhone
| launch, but it was truly very stripped down to
| accommodate the underpowered hardware, and they've only
| made incremental, very targeted expansions in the last 16
| years.
| steve1977 wrote:
| In order to properly support it, Microsoft and Google would
| need to have a level of control over the language that Apple
| will never yield to them.
| self_awareness wrote:
| What potential roles could Swift fulfill within the Windows
| ecosystem? Is there a specific segment they aim to serve? One
| might inquire about the feasibility of developing GUI
| applications using Swift on Windows, particularly regarding the
| necessity for manual FFI bindings, given the current state of
| Windows-specific tooling which is largely GUI-centric.
|
| 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.
| surajrmal wrote:
| Swift was a play by Apple to make application developers (and I
| suppose their own internal developers) more productive. Swift
| absolutely became successful because it had a strong reason for
| developers to learn it. That said, it probably also made Apple
| more successful in some way as well as you cannot undercut the
| value of productivity.
| steve1977 wrote:
| Looking at the application landscape (and quality) in the
| early years of Mac OS X with Objective-C and later on with
| Swift, I'm not so sure about that. Even worse when you look
| at Cocoa vs SwiftUI.
| zerkten wrote:
| It seems like a better fit for high-end apps that want to adopt
| the native framework for Windows and macOS. Developers of these
| apps will often accept some of the quirks with manual bindings
| to get the performance they need while trying to maximize code
| sharing and minimizing divergence for as much of the shared
| code as possible. This is not going to be accepted by most
| developers on the Windows platform, but they seem out of sorts
| with their current options anyway.
| Someone wrote:
| > One might inquire about the feasibility of developing GUI
| applications using Swift on Windows, particularly regarding the
| necessity for manual FFI bindings,
|
| 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.
| cesarb wrote:
| > 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.
| zachwdc wrote:
| I stumbled upon this comment from a related discussion in 2020
| https://news.ycombinator.com/item?id=22823773:
|
| >"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.
| geodel wrote:
| On this WWDC '24 it will be 10th anniversary of Swift. Great
| milestone for language. There is so much work going on improving
| it. However From outside it does look like it still is few years
| away from being general purpose outside Apple ecosystem.
| pjmlp wrote:
| Yeah, consider it to be as relevant as Objective-C has ever
| been, even with GNUStep.
| KerrAvon wrote:
| Opinionation Incoming! Objective-C is completely irrelevant
| outside of Apple because Interface Builder was the killer app
| for Objective-C and there was never a version that worked
| well with anything except AppKit -- even UIKit has always
| been painful to use with it. iOS developers had to tolerate
| Objective-C, but no one else bothered.
|
| 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.
| fao_ wrote:
| What are it's remaining virtues? (Purely curious)
| efnx wrote:
| It's the most widely used dialect of smalltalk and it
| compiles down to native code.
|
| Also it's a superset of C and C++ so you can mix all
| three in a single file, for better or worse.
| deergomoo wrote:
| Not OP, but it compiles orders of magnitude quicker than
| Swift. It also doesn't tend to grind Xcode to a halt as
| the language server tries to work out what's going on.
|
| But, in fairness, it's a much simpler language than
| Swift. Which can also be a virtue.
| raydev wrote:
| If you need to be nitpicky about squeezing every last bit
| of performance out, then Objective-C is still useful,
| especially given you can just drop down to C in the same
| source files. I've become a big "C is bad and C lovers
| should feel bad" guy in recent years, but I can't ignore
| the "simplicity" (for some experience level definiton of
| simplicity) and speed of the old tools.
| raydev wrote:
| You'd consider wrong. Given iOS and macOS are exponentially
| more popular than when Objective-C was the primary language
| for both OSX/iOS, Swift is far more relevant than Objective-C
| ever was.
|
| 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!
| neonsunset wrote:
| Swift is a nice language. But unfortunately it heavily overlaps
| with C# making it difficult to justify picking the former
| anywhere besides macOS application development.
| steve1977 wrote:
| And for C# there's mature backend frameworks.
| DeathArrow wrote:
| You can run C# on almost any device and you can do backed,
| front-end, desktop, games, utilities and whatnot using it. I
| think Swift has a lower appeal being tied to iDevices.
| KerrAvon wrote:
| Here's a good talk on that very subject from one of the key
| people whose fault that is:
|
| https://www.youtube.com/watch?v=tzt36EGKEZo
| neonsunset wrote:
| It's not a good idea to take Miguel's criticism of .NET
| seriously in the last couple of years, after the falling out.
| Give it more years and we might just hear the similar style
| of statements towards Swift and Apple's ecosystem now that he
| is promoting it.
|
| 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)
| metaltyphoon wrote:
| I don't know what happened but these days Miguel does seem
| very salty about w/e happened at his time at MS. Like you,
| I would take what he says with a grain of salt.
| dgellow wrote:
| Just curious, how is Swift as a language in 2024? What are the
| interesting developments, shortcomings? How does that compare to
| modern C# and Kotlin for example?
| jwells89 wrote:
| I'm likely biased since I've been writing Swift for about twice
| as long as I've been writing Kotlin, but between the two I
| prefer Swift by a good margin. In comparison it feels less
| idiosyncratic/fussy and more flexible/ergonomic, and it's nice
| not having to contend with the likes of Gradle and Proguard.
| briandear wrote:
| Maybe I don't speak Windows fluently enough, but this sounds
| exhausting. I guess I don't see the benefit of using Windows for
| anything.
| delta_p_delta_x wrote:
| > I guess I don't see the benefit of using Windows for
| anything.
|
| 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.
| cesarb wrote:
| > Windows still commands about three-quarters of desktop OS
| market share.
|
| 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.
___________________________________________________________________
(page generated 2024-05-20 23:01 UTC)