Reputation: 2730
Trying to install SDWebImage into my Swift project. I am using the following instructions (https://github.com/rs/SDWebImage):
So I git clone --recursive
the project from GitHub, I drag the .xcodeproj file into my project (since there is no SDWebImage.framework file as far as I can tell, and this has always worked for other frameworks), I complete the rest of the instructions:
And then I add #import <SDWebImage/UIImageView+WebCache.h>
in my bridging header. I build the project and I get: "SDWebImage/UIImageView+WebCache.h" not found. I've tried some variations on these steps and nothing seems to work. What am I doing wrong?
Pretty sure this is happening because I'm not pulling in an SDWebImage.framework file, rather the .xcodeproj file. But I've downloaded from zip and cloned the repo, and there doesn't seem to be a .framework file in there...
So apparently I'm just supposed to download the compiled framework, which I found in another answer: https://stackoverflow.com/a/30545367/918065. Maybe? I have no clue. When I imported the .framework file my bridging header worked and recognized #import <SDWebImage/UIImageView+WebCache.h>
, but it didn't recognize imageView.sd_...
. So still workin on it.
Last compiled framework is 3.7.0 and you can find it in: https://github.com/rs/SDWebImage/releases
For easier access, the direct link to the framework is below: https://github.com/rs/SDWebImage/releases/download/3.6/SDWebImage-3.6.framework.zip
Upvotes: 0
Views: 8396
Reputation: 983
This worked in my case:
#import <SDWebImage/UIImageView+WebCache.h>
in your bridging headerMy Project/BridgingHeader.h
Upvotes: 0
Reputation: 14092
For me it helped when I remove SDWebImage from import. So I have this in my project-Bridging-Header.h
:
#import "UIImageView+WebCache.h"
more information about iOS bridging header: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
Upvotes: 4
Reputation: 2730
So nothing was working for me until I finally realized that you're supposed to use not the main SDWebImage folder, but the SDWebImage folder inside of that into the project. Dragging in the .xcodeproj file, the folder as a whole, or the .framework file didn't work. Importing that sub SDWebImage folder, and then utilizing Libor Zapletal's answer: #import "UIImageView+WebCache.h"
is what finally got this thing working for me.
Upvotes: 1
Reputation: 331
I recommend using CocoaPods for dealing with dependencies. CocoaPods is a dependency manager that is designed to solve problems like these.
Follow the installation guide on their website: https://cocoapods.org
Upvotes: 2