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

PlayerView question #3

Closed iDevelopper closed 3 years ago

iDevelopper commented 3 years ago

Hi @LeoNatan ,

I am trying to replace this:

     .popupImage(Image(song.imageName).resizable())

by:

     let image = Image(song.imageName).resizable()
     .popupImage(image)

to use the same image reference elsewhere.

I get the following error:

Variable used within its own initial value

What am i doing wrong, please?

Thanks,

LeoNatan commented 3 years ago

Hello,

Not sure what you are attempting to do? From the code you posted, you are indeed using image while initialing it. I think you are misunderstanding what .popupImage() actually does. It's a modifier over the View protocol, setting a preference.

https://github.com/LeoNatan/LNPopupUI/blob/04c5e925a6cd263667ccd3211f0a2362257b24e8/Sources/LNPopupUI/LNPopupUI.swift#L134

iDevelopper commented 3 years ago

Pfff, it is an error, I made a mistake.

What I'm trying to do is get the frame of the player image (the popup content) to provide it to the popup controller which would use it while opening the popup ...

LeoNatan commented 3 years ago

You can provide a frame, but the image on the popup bar is constant size.