I used cocoapods to install MBProgressHUB and in bridging header I cannot just do
#import "MBProgressHUD.h"
I changed to
#import "MBProgressHUD/MBProgressHUD.h"
the import is OK but I cannot use it in swift code? anything I do wrong? how can I solve this problem?
Try this:
1) Specify
use_frameworks!
in yourPodfile
to use frameworks (instead of static libraries).This is required for adding pods that are written in Swift as dependencies and a good idea in general if your app is written in Swift.
2) Do
pod install
This makes sure your project is setup to actually use the above.
3) Add
#import <MBProgressHUD/MBProgressHUD.h>
in your bridging header (notice the angle brackets- not quotes) andimport MBProgressHUD
in the Swift class that needs to use it.That is,
MyApp-Bridging-Header.h :
This exposes the Objective-C files to Swift. Angle brackets indicate this is actually importing a framework.
MyViewController.swift :
This actually imports the dependency for use by your view controller.