Restkit in Swift Project

本小妞迷上赌 提交于 2019-12-12 06:02:53

问题


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?


回答1:


Sure you can use.

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

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




回答2:


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)



来源:https://stackoverflow.com/questions/28165763/restkit-in-swift-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!