Closed markiv closed 2 years ago
¡Buena idea! I'll update my PR.
Hey @markiv,
I already merged asset catalog images support in the release-1.0
branch, together with other breaking changes I am making for the upcoming 1.0 release, which is still a work in progress. I came up with an API that it's more flexible and allows the library user to choose the bundle and URL scheme for asset catalog images. Here is an example:
Markdown(
#"""
![Puppy](asset:///puppy)
Photo by André Spieker.
"""#
)
.setImageHandler(.assetImage(in: .module), forURLScheme: "asset")
Thanks for proposing this change; it truly makes the library better.
Using the
asset
scheme, you can now load images from your bundled asset catalog. This lets you use vector formats (PDF and SVG), specify appearance, scale and device variants, etc.To load all images from an assset catalog by default, set the base URL like this: