Live data from Hacker News

Swift on Windows

swift.org

71–80 of 209 posts

Re: Swift on Windows

#71
post #41

Earlier quoted context omitted.

I hope WinForms never dies, it is the OG Windows "look" and much less amenable to all the web-app looking BS that permeates desktop apps today

A lot of Windows Forms is non-Win32 controls with custom drawing, by the way. Especially things like menus, toolbars, etc. So a lot of Windows Forms controls are basically as native as WPF controls (just a lot harder to work with imho).

Are you sure? The source is available for both Core and old .NET and to me they all seem to be Win32 controls with some customization... unless I'm missing something. AFAIK WPF uses DirectX for rendering, so it's a bit different (it's more like Flutter... or a game engine).

Button: https://github.com/dotnet/winforms/blob/master/src/System.Wi... / https://referencesource.microsoft.com/#System.Windows.Forms/...

Toolstrip (also base for menu): https://github.com/dotnet/winforms/blob/master/src/System.Wi... / https://referencesource.microsoft.com/#System.Windows.Forms/...

Re: Swift on Windows

#72

Earlier quoted context omitted.

Swift alone would be nice, but implementations of UIKit and/or SwiftUI for Android would be even better. SwiftUI in particular makes a lot of sense as a cross-platform UI framework, since its appearance and behavior adapts to the platform it's running on instead of trying to shoehorn in a single look and feel everywhere.

If thats what you are after then flutter is available today

Flutter doesn't use native controls/frameworks under the hood, so it generally falls into the category of "trying to shoehorn in a single look and feel everywhere".

Re: Swift on Windows

#73
post #26

To abuse an old meme: "...yes, but does it run on Linux..." It seems like Windows already has a glut of similar tools; if you wanted to make a real impact with a fairly new language, which Swift is, with massive corporate backing, which Swift has, the one would think Linux would be a far more opportune destination for an effort like this.

Yes, it had official Linux support since 2015.

Re: Swift on Windows

#75
I'm more interested in a compiler that takes any of these languages (C#, Kotlin, Swift) that do the same thing slightly differently, converts them into a lowest common denominator language that can then compile into any target I choose.

For example write code in Swift, compile to X, compile to Kotlin. Voila, I have cross platform code, just need to write some cross platform libraries that wrap UI, networking, etc for each platform.

Elements compiler [0] seems to do just that. Does anyone have experience using it in production? Why is this not being adopted as a viable cross platform solution?

[0] https://www.elementscompiler.com/elements/#platforms

Re: Swift on Windows

#76
post #48

Why?

It seems that there is some "community" of people not employed by Apple around the development of Swift. And it seems that they believe that the "outside" world cares about what is inside Apple's walled garden. Truth is, for non-Apple people: Swift => Apple => no thanks. It is easier to see an Apple programmer excited about .Net than a Windows programmer paying attention to Swift.

I'm not sure why that has to be the case. For example, C# found a home outside of the Microsoft ecosystem inside of the Unity game SDK. That was a result of the initial grass-roots Mono [1] project. There was the same handwringing when Mono started and as it started to gain traction. Nowadays I think most people consider it to be a viable cross-platform language. I see no reason Swift can't go this way as well.

1. https://en.wikipedia.org/wiki/Mono_(software)

Re: Swift on Windows

#77
post #63

Earlier quoted context omitted.

In practice I don't think it's that confusing. You have a large standard library which is available everywhere, and then you have a set of proprietary API's which are only available on Apple platforms. Is the situation that different from C# and windows API's?

.Net 5 and C# 9.0 are very much 100% open all the way down to the core. https://github.com/dotnet/roslyn (c#) https://github.com/dotnet/winforms (UI) https://github.com/dotnet/wpf (UI) https://github.com/dotnet/core (Foundation) I don't consider the Win32 API itself part of .NET or C# as they've existed long before either.

Exactly, and most of the proprietary libraries and frameworks in Swift are in the exact same situation. They are mostly wrappers around macOS and iOS libs and UIKit/AppKit

Re: Swift on Windows

#78
post #26

To abuse an old meme: "...yes, but does it run on Linux..." It seems like Windows already has a glut of similar tools; if you wanted to make a real impact with a fairly new language, which Swift is, with massive corporate backing, which Swift has, the one would think Linux would be a far more opportune destination for an effort like this.

Swift had Linux support almost right on the beginning. I think that even Apple are supporting this effort.

Windows on the other side were started as a community effort of only one brave fellow. That later was even hired by Apple as far as i know.

I guess this is why this is much splashy than the Linux support. It was more of a community thing and less of a corporate thing as the Linux support was.

Re: Swift on Windows

#79
post #64

Swift has this weird sort of ecosystem where Apple builds much of the platform in a very secret (most of the roadmap isn't shared), closed-source variant for its own OS. Then it has this open source version, with a very public compiler (roadmap IS shared) that allows cross platform toolchains like this one to exist. I call it out as weird because take SwiftUI for example, the main excuse Apple engineers gave for why…

SwiftUI isn't tied to the OS version. It has a runtime API that should work with different versions of the OS. There were changes to the compiler that they didn't talk about until after the fact though. After SwiftUI was announced they did run those through swift-evolution. SwiftUI for the most part is just a runtime library, the compiler changes made things a bit nicer, but most of it could be achieved without compi…

Just curious, why can’t SwiftUI apps run on any iOS version prior to 13?

My clients app requires supporting iOS 11, but I’d love to start mixing in sone SwiftUI.

Re: Swift on Windows

#80

Earlier quoted context omitted.

this is actually a community project, the guy behind all this (Saleem) isnt even at Apple, hes at Google.

Is it just a hobby project, or actually sponsored by Google? They are trying to push Swift for Tensorflow [1], so proper upstream cross-platform capability would probably be important to them. [1] https://www.tensorflow.org/swift

[deleted]
Post reply on HN