LeoNatan / LNPopupUI

A SwiftUI library for presenting views as popups, much like the Apple Music and Podcasts apps.
MIT License
320 stars 29 forks source link

popupImage(image: from Image #2

Closed olirice closed 4 years ago

olirice commented 4 years ago

There are 2 call signatures for .popupImage

popupImage(systemName: String) -> some View

and

func popupImage(_ name: String, bundle: Bundle? = nil) -> some View

Which work great when the image is loaded from the file system.

Could another signature be added that directly accepts an Image to more easily support e.g. images loaded from URLs?

LeoNatan commented 4 years ago

I'd love to have this option, but unfortunately I found no way to get a UIImage/CGImage/CIImage from that Image, which is what I need to display on the popup bar.

What API are you using to load images from URLs?

olirice commented 4 years ago

I’ve been using Kingfisher https://github.com/onevcat/Kingfisher But could switch if there’s another approach that still supports caching and would interop better

olirice commented 4 years ago

Ah, I misunderstood. Image in swiftui is a view on top of the image asset and that asset can’t be recovered.

In that case, a signature for accepting a UIImage instead would probably be the easiest option as most of the image libs can produce one and it looks like that’s what it’s LNPopupController needs under the hood. That sound right to you?

LeoNatan commented 4 years ago

Yes, that's very easy to add. I'll add it now, and then in the future, I can think how to allow Image directly.

LeoNatan commented 4 years ago

v1.0.5 out with new API. Cheers

LeoNatan commented 4 years ago

Alright, implemented support for Image as well. 1.0.6