-
Hello! I have a Widget/Component in mind that i would use a lot, it's supposed to be an extension of the ImageViewer, that asynchronously loads normal and RAW images, then displays them in a pannable way. However, even after somehow understanding how Components work, from the example... I noticed that Components don't offer async support, so i can't really use the commands etc. so: like do i just add all messages for all of these components etc into one big, maybe nested enum? because all my efforts to abstract have done so far, is cause me suffering. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Ok i get it Widgets are always synchronous |
Beta Was this translation helpful? Give feedback.
-
Iced is based on the Elm architecture. Like Raph Levien mentioned in his article: "the Elm architecture does not support cleanly factored components." And the Elm documentation says: "Actively trying to make components is a recipe for disaster in Elm." I encourage you to read on the Elm documentation if you want to know more about the architecture: https://guide.elm-lang.org/architecture/ |
Beta Was this translation helpful? Give feedback.
-
Ok so i dug through and i think i discovered the way to decouple logic in ELM arcitecture. Key ist the .map method on Command and Element Types... Then i implemented following Traits (hopefully they weren't hidden in iced already, it's hard to know): Intending to streamline the process of making smaller submodules. It does force you to take all the control in the higher classes i might try to make a method update_children:: that is implemented for all Applications whose messages that implement MessageBridge (but that seems kinda difficult to achieve, so maybe i'll leave it alone for now) |
Beta Was this translation helpful? Give feedback.
Ok so i dug through and i think i discovered the way to decouple logic in ELM arcitecture.
Key ist the .map method on Command and Element Types...
https://docs.iced.rs/iced_native/struct.Element.html#method.map
The documentation is actually super helpful and explains decoupling!
It's just that by the point you know to search for Element.map, you must've already figured out the approach on your own...
If just the iced book had a short chapter referring to it, i think the doc situation would be in much better shape already
So i might contribute to it, if i find the time, but i at this point have a really poor understanding, so idk.
Then i implemented following Traits (hopefully they weren't…