I am trying to use SDWebImage in a Swift project. I dragged and dropped the SDWebImage library folder into my Swift project and created a bridging header by name listingApp-Bridging-Header.h
Then I imported the header file into my Swift file; like so imported
import UIImageView+WebCache.h
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell : TableViewCell = self.tableView.dequeueReusableCellWithIdentifier("Cell") as! TableViewCell
let strTitle : NSString = arrDict[indexPath.row].valueForKey("clip_name") as! NSString
cell.clipName.text = strTitle as String
cell.videoImage sd_setImageWithURL=NSURL URLWithString,[NSString stringWithFormat:@"%@%@",K_Server_imageurl,[record valueForKey:@"clip_image_path"]];
return cell
}
It's giving me an error saying add ; before +
How would I import the file above into my Swift project correctly?
It's not enough, you must add this bridge header filename also in your Build Settings - Swift Compiler Code Generation like in this picture:
Don't forget also this (required by SDWebImage
):
About the next step:
imageDownloader.downloadImageWithURL(
NSURL(string: urlString!),
options: SDWebImageDownloaderOptions.UseNSURLCache,
progress: nil,
completed: { (image, data, error, bool) -> Void in
if image != nil {
self.bannerImageView.image = image
}
})