Using objc SDK in swift with Cocoapods
Add gem source when original sources unavailable
gem sources -a http://ruby.taobao.org/ deprecated
gem sources -a https://gems.ruby-china.com/
gem install cocoapods
Creating first Xcode project with cocoapods
- Create a normal Xcode project
- Add a
Podfilefile to the root of the project
platform :ios, '8.0'
pod 'AFNetworking', '~>2.5.4'
- Install pod
cd to the project and run
pod install - Use the
xcworkspaceinstead of thexcodeproj - Most important procedure - Add
Brigding-Headerfile- add a objective-c
.mfile to the project and accept XCode to create theproject-name-Bridging-Header.hfile for you. - then you can delete the
.mfile XCode created for you - import your target s public headers that you would like to expose to swift
#import <AFNetworking/AFNetworking.h>
- add a objective-c
- Then you can use the sdk in your project
let manager = AFHTTPRequestOperationManager()