Cocoapods is not ready for Swift yet. When I implemented Mixpanel into my iOS project that uses Swift, I got several errors.
How to fix this issue and make mixpanel to work?
Add this line of code to every file that is giving an error
#import <UIKit/UIKit.h>
Also need to add these in your linked frameworks and libraries:
libicucore.dylib
CFNetwork.framework
Security.framework
Then add this to your Bridging-Header.h file:
#import "Mixpanel.h"
Then add this piece of code in your appdelegate:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//other stuff here
Mixpanel.sharedInstanceWithToken("yourtokennumbergoeshere")
var mixPanel = Mixpanel.sharedInstance()
mixPanel.track("Finished Launching", properties: ["name1":"property1","name2":"property2"])
return true
}