How to import c object header file into quick project

enter image description here

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 bridge header named listingApp-Bridging-Header.h

Then I imported the header file into my Swift file; as 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

}

This gives me an error saying add ; before +How can I import the file above into my Swift project correctly?

+4
source share
2 answers

You need to specify the name of the header file when importing it into the bridge header. Like this:

#import "UIImageView+WebCache.h";

This is exactly the same syntax as importing header files into objc.

+4
source

, - Swift , :

enter image description here

( SDWebImage):

enter image description here

:

imageDownloader.downloadImageWithURL(
                        NSURL(string: urlString!),
                        options: SDWebImageDownloaderOptions.UseNSURLCache,
                        progress: nil,
                        completed: { (image, data, error, bool) -> Void in
                            if image != nil {
                                self.bannerImageView.image = image

                            }
                    })
+4

Source: https://habr.com/ru/post/1648202/


All Articles