32 ms·
Swift Tooling: Windows Edition
- dgellow 3y agoJust 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?
- deleted 3y ago[deleted]
- jwells89 3y agoI’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.
- behnamoh 3y ago[flagged]
- mark_l_watson 3y agoHes, I was really unhappy that Lattner was not encouraged to keep pushing deep learning capabilities in Swift. Major dissapointment.
- danpalmer 3y agoI've worked with Xcode for ~2 years of professional work spread across ~10 years of other work, and honestly, I don't fully get the criticism. It's not great, but for an IDE (not a text-editor with plugins), I've always found it miles better than the Intellij suite. I preferred Visual Studio when I was working on Windows, but that's a much bigger project, so perhaps not a fully fair comparison. Xcode from ~2021 onwards, with Swift package support, has been a significant improvement too. Now you can avoid much of the IDE configuration and just work with source code more, something I prefer. There was also a period of a few years where it crashed all the time (Swift 1-4?) but those days seem to be long gone now. The source control integration has always sucked and I steer clear, but I was always doing the same in Intellij/etc or Visual Studio anyway. Perhaps today VSCode is sufficiently IDE-like with enough packages, and perhaps it's fast enough, but I still feel like there's a difference, and even though I can do Swift in it I prefer to use Xcode. Changing Xcode's shortcuts to something more reasonable made a huge usability difference too. I'm interested to hear what you think is so terrible about Xcode. Perhaps I'm missing something!
- jwells89 3y agoHaving worked with it since it was still known as Project Builder I think it’s fine too. The only part that’s really bad is the XIB/storyboard editor, which was actually pretty good when it was its own independent program (Interface Builder) but has been awful ever since it got merged into Xcode. That’s easy enough to avoid though, with UIKit being pleasant and practical to write in pure code, as I’ve been doing for the past several years. Beyond that, there are some things that can make SourceKit (provider of syntax coloration, autocomplete, etc) grumpy, but those are almost all code smells that should be avoided anyway like pyramids of doom built of closures or way-too-long optional chains.
- danpalmer 3y agoThe GUI building was always pretty bad, true. I managed to skip most of that and either did UIKit mostly via code, or more recently SwiftUI (which is mostly pretty good) and server-side stuff. I think SourceKit was the source of many crashes a few years ago, more recently it seems to have transitioned to fewer crashes and more cases where it just gets "grumpy" as you said, and in the last few years I've even found most of those cases have ceased.
- jwells89 3y agoYeah things have been pretty smooth in recent years, especially after being able to drop CocoaPods in favor of Swift Package Manager. On average I find myself “fighting” the IntelliJ-based Android Studio more frequently than I do Xcode.
- developerDan 3y agoTo me the thing is that there is usually a major problem of some sort with Xcode and it can take up to a year to resolve (when they release the next major version). For example in Xcode 14.1 there was a bug that would make it crash when trying to open a project. It would crash over and over and over until it finally opened. That was finally fixed in 14.3. 15 was great then with 15.3 a bug was introduced where any time you change branches the package cache became invalidated and you had to close Xcode and reopen it. Of course it’s still not fixed in 15.4. 16 might be solid but I can guarantee some extremely annoying bug will be introduced in a point update and won’t be fixed until the next major. It has been this way since I started using Xcode 9. I’d rather deal with a slow and cumbersome IDE than one that moves things around with every major update and introduces major bugs that don’t get addressed in in a timely manner because the IDE updates are tied to iOS releases for some god forsaken reason. I was a fan of AppCode until JetBrains dropped it.
- saagarjha 3y ago> toxic behavior of its maintainers towards Chris Lattner Did I miss something?
- vlovich123 3y agoHadn't heard about this either. Chris claims he left the Swift language committee because of toxic behavior claiming he got yelled at on a conference call. https://news.ycombinator.com/item?id=30416070 https://news.ycombinator.com/item?id=30416070
- deleted 3y ago[deleted]
- rrishi 3y agoGotta 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 3y agoThey 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 3y agoIt’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 https://speakinginswift.substack.com/p/swift-meet-winrt
- zer0zzz 3y agoI thought folks like saleem already had been building up a UIKit-like layer for exactly this.
- felipefar 3y agoI hope Microsoft would settle for one UI library instead of pushing a new one every five years. WinUI 3 is their most recent invention. Application developers can't keep up with the changing standards.
- pjmlp 3y agoWith all the mismanagement around WinRT, only the Windows team themselves and companies with sunken cost into UWP looking into a migration path, still care about WinUI 3. Look no further than the Github repos for the general sentiment.
- deleted 3y ago
- dlahoda 3y agoseems 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 3y agoHow is the core/foundation framework porting (to Windows) going on?
- zerkten 3y agoIs 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 3y agoYes, but I mean the non-UI stuff: concurrency, networking, file system, etc...
- navanchauhan 3y agoYou 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_ 3y ago> without needing any library other than the cross platform Foundation implementation which is seemingly what the user above was talking about! I think
- zer0zzz 3y agoIt’s done?
- nolongerthere 3y agoVery 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 3y agoI'm a simple man. I see Swift outside of iOS, I upvote it.
- deleted 3y ago[deleted]
- Rimtariro 3y agoI 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 3y agoSwift 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-popular-technologies https://survey.stackoverflow.co/2023/#technology-most-popula...
- airstrike 3y agoless than 5% vs. over 6% is not that big of a difference
- deleted 3y ago[deleted]
- Rimtariro 3y agoIt'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 3y agoIt'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.
- self_awareness 3y agoWhat 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 3y agoSwift 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 3y agoLooking 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 3y agoIt 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 3y ago> 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/ https://www.swift.org/documentation/cxx-interop/ and https://forums.developer.apple.com/forums/thread/744361 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.
- zachwdc 3y agoI stumbled upon this comment from a related discussion in 2020 https://news.ycombinator.com/item?id=22823773 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 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 3y agoOn 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 3y agoYeah, consider it to be as relevant as Objective-C has ever been, even with GNUStep.
- KerrAvon 3y agoOpinionation 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.
- neonsunset 3y agoSwift 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 3y agoAnd for C# there’s mature backend frameworks.
- DeathArrow 3y agoYou 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 3y agoHere'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 https://www.youtube.com/watch?v=tzt36EGKEZo
- neonsunset 3y agoIt'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 3y agoI 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.
- pjmlp 3y ago
- briandear 3y agoMaybe 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 3y ago> 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 3y ago> 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.