Swift and AFNetworking integration

Anurag Kabra picture Anurag Kabra · Jun 9, 2014 · Viewed 19.3k times · Source

Now as swift is the new language to develop iOS apps.

How can we integrate with the AFNetworking or using NSURLSession will be a better option ???

Please help me out..

Answer

Alexey Sidorov picture Alexey Sidorov · Jun 9, 2014

You have to add AFNetworking to your swift project

In Build Settings -> Defines Module set to Yes

In Build Settings -> Swift compiler -> Objective-C bridging file set the name of bridging file 'ProjectName-Bridging-Header.h' for example

In ProjectName-Bridging-Header.h write:

#import "AFNetworking.h"