JamesDon
JamesDon

Reputation: 75

Restkit in Swift Project

I have imported the RestKit to my swift project. But I'am not able to import the Restkit.h file in my swift file. Can anyone please tell me the steps to follow so that I can import the Restkit.h file to my swift file? Is RestKit available in swift language?

Upvotes: 0

Views: 1845

Answers (2)

Nurdin
Nurdin

Reputation: 23883

Sure you can use.

Create bridging header file inside your project. Name it as [your-project-name]-Bridging-Header.h.

enter image description here

Import RestKit.h header into your bridging header file that you created previous one to integrate with this file. https://github.com/RestKit/RestKit/blob/development/Code/RestKit.h

[your-project-name]-Bridging-Header.h

#import "RestKit.h"

Don't forget to copy RestKit project folder into your project folder.

Reference:

http://blog.revivalx.com/2014/12/30/bridging-between-swift-and-objective-c-in-the-same-project/

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

Upvotes: 1

fyell
fyell

Reputation: 221

You will need to add the RestKit framework to your Bridging Header file so that your Swift file can use it. If you don't have a Bridging Header file, you can create one and name it {Your_Product_Module_Name}-Bridging-Header.h. The Product Module Name is in your target's Build Settings. Check this link out for more details on using Swift and Objective-C in the same App Target (https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-XID_79)

Upvotes: 0

Related Questions