dasautoooo / Parma

A SwiftUI view for displaying Markdown with customizable appearances.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to render image?

metrue opened this issue · comments

Thanks for building this great lib, but I could not find a example how to render a image, just tried with

![](https://picsum.photos/200/300.jpg)

but not working.

Hi @metrue ,
Parma doesn't include any image rendering logic or related dependencies. You can use Kingfisher or SDWebImage to render an image whose link is provided by Parma.

For example:

func imageView(with urlString: String, altTextView: AnyView?) -> AnyView {
    AnyView(
        KFImage(URL(string: urlString))
            .resizable()
            .scaledToFit()
            .clipShape(RoundedRectangle(cornerRadius: 12, style: .continuous))
    )
}