News for hackers. Stuff that matters.
Re:Rust 2020: GUI and Community by Razengan on Saturday November 09, 2019 @10:34PM (#21496231)
The state of cross-platform GUI systems really is a bizarre mess in this day and age, and probably can only be solved with a concentrated joint effort by Apple, Google and Microsoft.

Personally I'd love to have something like

    import SwiftUI         // For controls that are common to all OSes
    import SwiftUI.Windows // For OS specific features
Re:Rust 2020: GUI and Community by skohan on Sunday November 10, 2019 @03:10AM (#21497027)
> probably can only be solved with a concentrated joint effort by Apple, Google and Microsoft.

It's hard to imagine that happening. None of these companies have an interest in making it easier to port code away from their platform.

Re:Rust 2020: GUI and Community by Razengan on Sunday November 10, 2019 @06:51AM (#21497622)
Maybe one day when they are populated by employees who grew up with dismay over the state of xplat GUI. :)

I mean even now Apple has an increased focus on services that must be accessible from everywhere: Music, TV, iCloud Drive. Surely there must be someone there who wishes they had to write most code only once for all OSes without making their app a hog.

I'd settle for just a convention; i.e. let C# remain the primary language on Windows, but introduce SwiftUI-like primitives like Text, HStack, ForEach etc.

Re:Rust 2020: GUI and Community by pjmlp on Sunday November 10, 2019 @12:11PM (#21498888)
Basically XAML/WPF/UWP code first.
Re:Rust 2020: GUI and Community by Razengan on Sunday November 10, 2019 @01:07PM (#21499227)
Which one is their latest tech? Where does "WinUI" fit in? Is there a good, single starting point like SwiftUI's tutorial?

The first hit brought me to "Host a custom UWP control in a WPF app using XAML Islands" so there seems to be a distinction (and it implies WPF isn't the star anymore?)

[0] [1] that I could find after a couple searches look way more complex than what the equivalent SwiftUI would be.

    <Button x:Name="button" Content="Hello, world!" HorizontalAlignment="Left" Margin = "152,293,0,0" VerticalAlignment="Top"/>
vs.

    Button(action: play) {
        Text("Hello, world!") // Don't need alignment etc. to produce identical output.
    }
and ugh [2]:

> If you need to embed any Unicode characters into the text, you can use the standard XML syntax. For example, to put the greeting in smart quotes, use: <Label Text="&#x201C;Hello, XAML!&#x201D;" />

I suggested emulating SwiftUI's syntax because it seems to be the most succinct.

[0] https://github.com/microsoft/Windows-appsample-photo-lab/blo...

[1] https://docs.microsoft.com/en-us/windows/uwp/get-started/cre...

[2] https://docs.microsoft.com/en-us/xamarin/xamarin-forms/xaml/...

Re:Rust 2020: GUI and Community by pjmlp on Sunday November 10, 2019 @02:22PM (#21499641)
You are looking at XAML, which underlines WPF, Silverlight, UWP/WinUI as the layout description language.

You can also do it in pure .NET code without XML, hence why I specifically mentioned code first.

So to pick on your example,

    var btn = new Button
    {
        Name = "Button",
        Content = "Hello, world!",
        HorizontalAlignment = HorizontalAlignment.Left,
    };
    btn.Click += (s, e) =>
    {
       // handle click event
    };
Slightly more verbose, but one can still wrap those calls, or just pick Fabulous, https://github.com/fsprojects/Fabulous

WinUI is the latest tech, just UWP as usual, still the future of Windows UI, now re-architected not to depend on a specific Windows 10 release, going back all the way to Falls Creator.

Re:Rust 2020: GUI and Community by Razengan on Sunday November 10, 2019 @02:52PM (#21499797)
Thanks. Couldn't find a "code first" example before my irrational impatience with Microsoft kicked in :P

I haven't touched C# in ages but that definitely looks odd compared to what I remember of it (like SwiftUI looks a little odd compared to Swift but not by this much.) My immediate thought: why capitalize the property names?

Fabulous is comparatively verbose too but probably more idiomatic with F# (which I have no experience with.)

Re:Rust 2020: GUI and Community by setr on Sunday November 10, 2019 @07:53AM (#21497779)
However, they do have an interest in making it easier to port code to their platform.