AparokshaUI / adwaita-swift

A framework for creating user interfaces for GNOME with an API similar to SwiftUI
https://aparokshaui.github.io/adwaita-swift/
MIT License
749 stars 16 forks source link

How to display images from memory data in Adwaita-Swift? #23

Closed lesclaz closed 2 months ago

lesclaz commented 2 months ago

Is your feature request related to a problem? Please describe.

I am developing an application with Adwaita-Swift and have encountered the need to display images from memory data (Data). I have searched through the available documentation and examples, but have not found clear guidance or a specific widget in Adwaita-Swift that allows me to do this.

Describe the solution you'd like

Could you please provide me with some examples or guidance on how to implement the loading and display of images? Any code examples or recommendations on best practices for handling these cases would be very helpful and appreciated.

Describe alternatives you've considered

.

Additional context

.

david-swift commented 2 months ago

Since b7aabb0, it's possible to use the following syntax:

Picture()
    .data(data)

Find the documentation for the data modifier here.

I added the following example to the Demo app: Screencast from 2024-04-21 11-49-50.webm

The code for the example is available here

If you miss a certain option to customize the appearance of the image or similar, feel free to open another issue. I'm very happy about those requests, thank you so much!