UPDATE: As of version 0.36, Swift support has officially been added to CocoaPods.
This is what we all have been waiting for! CocoaPods, our beloved dependancy manager for iOS and Mac projects finally supports Swift in their latest release 0.36. But hold your horses because 0.36 is still in beta. In this very short tutorial I'll show you how to give it a go. Mind you this is not a beginner's guide to CocoaPods. I assume you have have prior experience with using CocoaPods.
To use SwiftPods (I like the sound of that), first you need to install the latest version which is 0.36 beta of CocoaPods. Open up the terminal and type this.
This will install CocoaPods 0.36 beta. To confirm run the below command,
sudo gem install cocoapods --pre
It will output something like this 0.36.0.beta.1.
That's actually pretty much it. There are third party Swift libraries already supporting SwiftPods out there like EVCloudKitDao. You can include them in the Podfile and run pod install just like you would do in the good old days.
However when I first tried to use it, I hit a few bumps. Here I'm going to include the issues I came across and how I resolved them.
1. Even after successfully installing the 0.36 beta version, when you run pod --version you might see it outputs an old version (like 0.35). To resolve that I completely uninstalled CocoaPods using sudo gem uninstall cocoapods and reinstalled it again as I have shown you above.
2. If you're using third party libraries only written in Objective-C in a Swift project, when you install them using CocoaPods, you'll see them as static libraries instead of frameworks as it should. Otherwise you won't be able to use them in Swift.
To resolve this you need to include the line use_frameworks! in your Podfile. Like so,
Now run pod install again and voilà!
source 'https://github.com/CocoaPods/Specs.git' use_frameworks! platform :ios, '8.0' pod 'MagicalRecord/Shorthand'