compnerd
(Saleem Abdulrasool)
1
Hello Win32 developers and Swift users,
The Windows port has been coming along pretty well. Although it is not yet complete, it is now at the point where you can start doing interesting things with it. As such, I put together a little Hello World^WSwift program for Windows using just Swift! As the saying goes, a picture is worth a thousand words ...
The source code for this is up on GitHub. It is still pretty raw, so expect sharp edges if you are going to start playing with that code, but, this certainly seems to be the start of bringing Windows development to Swift!
CC: @Chris_Lattner3 @pvieito @Torust
113 Likes
millenomi
(Aura Lily Vulcano)
2
That’s quite the milestone! Congrats!!!
2 Likes
3a4oT
(Petro Rovenskyy)
4
Absolutely amazing! Thanks.
lancep
(Lance Parker)
5
This is amazing! Thanks for pushing this forward.
Karl
(👑🦆)
6
Who needs JPG compression when you've got Windows font rendering?
In all seriousness, this is great! Amazing job!
2 Likes
jrose
(Jordan Rose)
7
I'm going to grumble at you for manually allocating an UMBP to store a UTF-16 string instead of using Array.
Congrats!
3 Likes
compnerd
(Saleem Abdulrasool)
8
Haha, I never said this was good code!
Cleaning up the demo eventually is a good idea, for now, more bug fixing in the compiler to get Foundation running seem to be more pressing :-)
5 Likes
This is really really awesome @compnerd, congratulations!!
3 Likes
scanon
(Steve Canon)
10
Huge congrats, this is great stuff!
armadsen
(Andrew Madsen)
12
This is amazing! Thanks for your hard work.
Bas_Broek
(Bas Broek)
13
This is awesome! Great job @compnerd 
tyko
14
Keep the good work! @compnerd 
1 Like
vreis
(Vinicius Reis)
15
Does it support exceptions yet? That's so 2016! LOL
Seriously now, this is awesome. Congrats @compnerd!
2 Likes
uliwitness
(Not a Kitteh)
17
This is amazing! Great work!
Though it now makes meI wonder if Swift's introspection/reflection facilities could be used to declare the event handlers implicitly when an object implements a certain method instead of having to subclass a WindowClass.
Also, could this be done for UWP APIs?
compnerd
(Saleem Abdulrasool)
18
The WindowClass itself is just a representation of WNDCLASS. The methods that you are thinking of are in the WindowDelegate. You simply implement the event handler that you care about. You will absolutely have to subclass the WndProc in order to handle an event, and when you sublcas, you have to handle all the events (which is done implicitly by the protocol extension). The WindowDelegate that the user defines only needs to handle the events that they care about.
This is possible to make work for the UWP cass of applications as well, the primary issue is the lack of certain APIs/Libraries (e.g. DbgHelp) that are needed for other things like Foundation. But, I've taken care to minimise the use of APIs unavailable in UWP, so it should be feesible to do that.
3 Likes
realdawei
(Dawei)
20
Congratulations this is fabulous!!