Mixpanel is a great service, but their iOS Integration page doesn't even mention the word swift, let alone how to get it integrated into a new project. There are a few resources on how to get Swift and Objective-C to work together, but it seems really cumbersome and annoying.
Step 1: Mixpanel.swift
Copy-paste the code from this gist and put it into a file in your project. I named mine
Step 2: Enter Your Auth Token
From your Mixpanel account, click the gear icon in the bottom-left of the screen. In the following popup you'll see your Token. Copy-paste that into your
Mixpanel.swift file (at the bottom).
Step 3: Track Events
That's it! You can now track any even in your iOS app with the following code:
mixpanel.track("Bar Visit", parameters: [ "Bar Name": bar.name, ])