How can I add an image?

Hi!

Here is the piece of code where I would like to add an image:

            Image("fruit") 

But the image does not load...
Could someone send me a link where I can read more about the Image stuff, please?
(I am new to swift)

I guess you're trying to use SwiftUI's Image. If this is the case, you won't be able to use it on Ubuntu (which I assume is the system you're using, because this topic is tagged "ubuntu"), because SwiftUI is a proprietary framework from Apple and is only available on recent Darwin systems. It's not part of the Swift open-source project. If you need something similar, I suggest checking out Tokamak.

Hello wowbagger!

I've never heard about Tokamak, this is new to me. Thank you very much for telling me about that.
But my question is related to webdesign, an not to an app for iphone or ipad.

I downloaded swift for Linux, and then I downloaded a command line program called "Publish". It generates a static website for you (this software is writen in swift).
You can find Publish in this address:

https://github.com/johnsundell/publish

The default theme that comes inside Publish is very simple... but sometimes I find a website with pictures on the header or in the footer (generated using Publish), like this one:

https://chemy.app

The themes for Publish are not build using HTML, it uses the Swift Language, and I am an absolute begginer in swift... I don't know how to add a picture to the website, and can't find a online resource to learn more about this...

Hi again, wowbagger!

I found out the solution to my question, and I wanna share it with you and the others.

This code worked to me:

Image(url: "http://www.path-to-your-image.TopLevelDoamin/theimage.svg", description: "A description")

This is the source where I found the help I needed:

https://github.com/JohnSundell/Plot

Thank you again!

1 Like
Terms of Service

Privacy Policy

Cookie Policy