Apple released Swift a couple of days ago. My new language of choice. No more boilerplate Objective-C code with ugly attached blocks. But can I use the same nice things as I was used to under Objective-C? With ’nice things‘ I mean CocoaPods. The hero which prevents me from the library hell.
The answer is yes and it is quite simple.
- Create and build your Podfile
- Open Xcode (Beta 6)
- Create a header file which works as ‚bridge‘ between the objc Pods and your Swift application. You may call it bridge.h (see appendix #1)
- Import your Pods
- Open your project settings and append the file to build setting / Objective-C Bridging Header (see appendix #2)
- That’s it. Now, you can use your Pods the same way as before just with the new Swift syntax.