ios - Cannot invoke call from SDWebImage -
i have read couple similar questions, none of them working me. well, trying show different images on list , save images in cache. getting error on iconview.sd call.
import uikit import sdwebimage class tableviewcell: uitableviewcell { var item: itemrealm? { didset { if item == nil { iconview.image = nil itemtitlelabel.text = "test" itemdesclabel.text = "some description" } else { // todo: implement item sets iconview.sd_setimage(with: nsurl(string: (item?.icon)!), placeholderimage: uiimage(named: "placeholder.png"), completed: { (image: uiimage!, error: nserror!, cachetype: sdimagecachetype, imageurl: nsurl!) in }) itemtitlelabel.text = item?.name itemdesclabel.text = item?.desc } } } @iboutlet weak var iconview: uiimageview! @iboutlet weak var itemtitlelabel: uilabel! @iboutlet weak var itemdesclabel: uilabel! override func awakefromnib() { super.awakefromnib() iconview.layer.cornerradius = 4 } override func prepareforreuse() { super.prepareforreuse() self.item = nil } }
error : tableviewcell.swift:22:26: cannot invoke 'sd_setimagewithurl' argument list of type '(nsurl?, placeholderimage: uiimage?, completed: (uiimage!, nserror!, sdimagecachetype, nsurl!) -> ())'
icons list(log):
; icon: optional("http://192.168.1.101:8080/api/items/0/icon.png") ; icon: optional("http://192.168.1.101:8080/api/items/1/icon.png")...
the problem may because of use of old ns-types, got replaced in swift3 , getting mapped new datatypes swift3 automatically now.
iconview.sd_setimage(with: url(string: item!.icon), placeholderimage: uiimage(named: "placeholder.png"), options: .highpriority) { image, error, cachetype, imageurl in }
Comments
Post a Comment