Feature to allow inclusion of an image into the prompt dialog.
< In response to Issue #5 >
Hi there,
I added the ability to add in an image to the prompt. Currently the image is just added to the top of the prompt body and the prompt text is appended below it and top-aligned (as opposed to how it used to be centre-aligned in the prompt body). I think it might be a good idea to rather centre the prompt text in the remained of the prompt body under the image, but I kind of ran out of time on this one (my 11 week old daughter was beckoning :P).
I included 3 test images, I wasn't sure if you would want these included in the Demo project or not, but they are currently in there on the prompt demos.
I also did some minor refactoring in the SwiftPrompts.swift file. This was just for ease of reading and a touch of reuse.
I really like this little project, great work!
Regards, Marc
Hi Marc, Thank you very much for your contribution to this library, and I'm sorry for the late reply! I think you did a great job in the inclusion of the image within the prompt, however I was testing out all the scenarios and realised that the image doesn't resize according to the size given to the prompt. The image needs to have a dynamic size within the context of the prompt. I will work on it in the next weeks, let me know if you would like to further help out!
Once again thank you for taking time away from your family to help make this library better.
-Gabe
Hi Gabe,
Thank you for the feedback!
Regarding the dynamic size based on the size of the prompt... I only took into consideration the width of the image fitting within the bounds of the prompt. I adjust the height of the prompt in accordance with the calculated size of the image added, however, I admittedly did not do a whole lot of testing with setting the sizes using the API methods.
Could you perhaps provide specific cases that you tested which resulted in undesirable sizing? I am guessing that if you set the prompt small enough, the text will start writing onto the buttons below it (depending on the image size added, etc).
Would you be thinking of adding in logic to basically calculate the absolute minimum height required to fit in the text as well as the image and then adjusting the promptHeight property to that value if the user has set something smaller?
Cheers, Marc