Reputation: 2206
I'm trying to use SDWebImage in swift, the file id like to use is called UIImageView+WebCache.h
i added it to my bridging header using
#import "UIImageView+WebCache.h"
Now i am trying to load that file in swift using:
var webCah = UIImageView+WebCache()
and i get an error message reading:
Use of unresolved identifier 'WebCache'
I believe it thinks i am trying to use a uiimageview, when i am just trying to use that objective-c class
How Do i Call that class properly?
Upvotes: 5
Views: 5683
Reputation: 9042
UIImageView+WebCache
is category that extends the functionality UIImageView
with SDWebImage specific methods. You need to access the methods defined in it on a UIImageView
object.
Example code:
var imageView :UIImageView = UIImageView() // example, this will probably come from elsewhere in your app
imageView.sd_imageURL
// Or
imageView.sd_cancelCurrentImageLoad
Look at the documentation to see what methods are available, or the source https://github.com/rs/SDWebImage/blob/master/SDWebImage/UIImageView%2BWebCache.h
Upvotes: 4