danielsaidi / Sheeeeeeeeet

Sheeeeeeeeet is a Swift library for creating menus, custom action sheets, context menus etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

load image from url

ahmedsafadii opened this issue · comments

it's possible to load images from URL for the item menu?

using king fisher ?

It's possible for you to create your own item and cell types that use async images, but it's not built into the library.

@danielsaidi thanks for your fast response, where I can find the document for creating custom cell.

i did something like that

let item = SingleSelectItem(title: server.name, isSelected: true, value: server, image: UIImageView().setImageUrl(url: server.image, placeHolder: "noCountry"), tapBehavior: .dismiss)

but it just show up next time i open the sheet :3

This advanced example illustrates how to subclass things. You can also have a look at the demo code.

Yeah, the problem with using an async image is that it won't be loaded the first time users open the menu. But it will (most probably) be in the Kingfisher cache the second time. You can write extensions to trigger a refresh of the image view once the image is created...perhaps Kingfisher even has it built-in?

I wish you luck in getting it to work, it shouldn't be too hard to get it to work. If you find a solution that you think is clean and wouldn't bloat the library, feel free to send a PR :)

Thank you, I will do my best <3