
Iced, a cross-platform GUI library for Rust - pjmlp
https://github.com/hecrj/iced
======
AlbertoGP
Well, somehow I missed this one when looking for a GUI library in
[https://areweguiyet.com](https://areweguiyet.com) some time ago, and I was
_very surprised_ just now when it compiled and ran at first try:

    
    
        git clone https://github.com/hecrj/iced.git
        cd iced/
        cargo run --package tour
    

This ran the Tour example without any glitches, warnings, missing dependencies
or any other annoyance. Don’t know yet whether this has what I need for my
applications, but in any case it has left a very pleasant impression.

~~~
mwcampbell
Don't forget to also consider what your users might need. So, unless you're
developing a game or an application that does something inherently visual
(e.g. a graphics editor), the lack of accessibility support (at least in the
native version) should be a show-stopper. I'm a little surprised it's not even
on the roadmap.

~~~
voxl
Be the change you want to see in the world, open source doesn't work off magic
and candy.

~~~
mwcampbell
I appreciate that, but there are so many GUI toolkits out there, I can't
possibly do the hard work of implementing the platform accessibility APIs for
all of them. So I figure the best I can do is warn developers away from
toolkits that don't already have this functionality.

------
seanalltogether
Personally, I don't think developers should be mimicking Elm or React when
they have the opportunity to build a custom gui library from scratch.
Elm/React are helpful for overcoming the inherent problems in the html
component development, but that requires them to be more ineffecient then
typical native gui frameworks. Simple views are easy enough to handle, but
these functional style guis don't tend to deal with complex views very well.

~~~
rvz
Let alone some GUI libraries like this one are starting to require hw-
accelerated web canvases + vulkan for drawing on the screen just for the
requirement to have a cross-platform GUI on the desktop these days which is
quite frankly unnecessary in this use-case, unless you're developing a game.

In the end, constructing a GUI from that would be questionable and would end
up being even more uglier than a barebones Qt5 example. You might as well
create your own in-game GUI library or use ImGUI with Rust bindings.

~~~
littlestymaar
> Let alone some GUI libraries like this one are starting to require hw-
> accelerated web canvases + vulkan for drawing on the screen just for the
> requirement to have a cross-platform GUI on the desktop these days which is
> quite frankly unnecessary in this use-case, unless you're developing a game.

Web browser and OS UI toolkits are also GPU accelerated these days. In fact,
that's completely silly to do any kind of rendering on the CPU when you have a
GPU available! It's just way slower and much more expensive in terms of power
consumption.

~~~
jcelerier
> It's just way slower and much more expensive in terms of power consumption.

really depends on what you want to draw. there is still nothing that renders
fonts with freetype quality on the GPU and rendering paths / drawings / svg-
like stuff is still a pain as the only GPU maker who cares about 2D drawing is
NVidia.

~~~
raphlinus
That was true a few years ago, but fortunately the state of the art for 2D
rendering on GPU has been moving forward. Among others, Pathfinder 3 is quite
comparable in quality to Freetype, and there are lots of good results coming
out for performant vector drawing on GPU, including my own piet-metal work.

------
hawski
What's the accessibility story or a roadmap for one?

~~~
speps
Can accessibility APIs of the OSes be used without native controls?

~~~
Diggsey
Yes, but it requires explicit support and is very platform-specific.

------
amelius
This is one of the projects highlighted in:

[https://areweguiyet.com/](https://areweguiyet.com/)

------
satvikpendem
It looks very Flutter-like, with Column, Text, and other elements. It seems it
renders to canvas potentially, not sure though, if that's how the cross
platform compatibility works, also like Flutter.

I notice that in many of these GUI frameworks that effort is duplicated.
Flutter creates a lot of widgets for iOS and Android, but if you don't want to
use Dart, we'll, you'll have to reimplement those widgets yourself again.
Instead, what should happen is that they should compile to a standard format,
most likely WASM, and then you can use any language (that targets WASM, which
I think will be most of them in the future) to interface with those widgets or
components. They can be in the form of a canvas renderer such as Skia, which
is what Google uses for Chrome and Flutter, and also used by some other GUI
projects like Revery for ReasonML. This way, there's one common format and
people can write the functionality code in whatever language they'd like.

~~~
jffhn
>[widgets] should compile to a standard format, most likely WASM, and then you
can use any language (...) to interface with those widgets or components.

Or be based on a standard canvas-level API that would be easy to support in
most languages (à la OpenGL, but much easier to use for 2D, and more complete
(windowing, user events, text, images, etc.), or like P0267R0 but not confined
to a particular language).

~~~
satvikpendem
OpenGL would be cool. Skia is nice because it's designed for UI as opposed to
other uses. I'm not sure what other alternatives for Skia exist however.

------
ComputerGuru
Like pretty much all the other GUI attempts going on in the world of rust, it
is built on top of wgpu which does not have any OpenGL support ("yet"). The
older toolkits were built on gfx-rs which had much better support for
different gpu toolkits, but was pretty much deprecated and replaced with a
different project altogether.

------
rhn_mk1
Is the view logic running at every refresh? That would make it somewhat of an
immediate mode UI.

------
fooooobaaaaar
looks good, but i hope author doesn't abandon it.

~~~
epage
Helps that the author got picked up by a company to work on this

[https://blog.cryptowat.ch/sponsoring-rust-gui-library-
iced/](https://blog.cryptowat.ch/sponsoring-rust-gui-library-iced/)

------
coleifer
For me, it's python and tkinter.

------
Kenji
It's web-based, so worthless for any serious programs. I'll stick to GTK even
though GTK sucks.

------
amelius
I see that a rich text editor is not on the roadmap?

Also missing is mobile support.

~~~
cycloptic
And a11y support... building a full GUI library is a monumental task.

~~~
vertex-four
Iced itself appears to be largely an API definition (and project to implement
that API), there's currently two largely independent backends - iced_winit and
iced_web. They provide their own widget structs, event loops, and so on.

There's therefore enough of an abstraction which could be used to get Iced to
create Windows/Cocoa/GTK/Qt native widgets (in much the same way it currently
creates VDOM elements for the web, thus getting some level of accessibility by
default). Then Iced could provide additional a11y information to the backend
by means of properties on the virtual objects.

------
angel_j
Is Rust really where you want your GUI code? I like CSS.

~~~
adev_
Nothing blocks you to write CSS and transpile it to Rust at compile time to be
designer / style friendly.

That's anyway what the Web world does already with SCSS or the fashion to
embed your styling directly in JS ....

------
dirtydroog
Type safety won't help with user input!

~~~
ShinTakuya
What? This is one of the areas where type safety truly shines. Type safe
languages force you to confirm the nature of the input and deal with the edge
cases.

