[英]Can I use Objective-C library in xcode 6 using swift
我正在使用xcode 6,并且正在尝试实现swift语言,现在我想从github.com导入一些外部库,例如SDWebImage ,它使用Objectivc-C语言,因此我可以在使用swift语言的项目中使用它。
Yes it's possible. 是的,有可能。 I highly recommend using cocoapods , a dependency manager which greatly simplify usage of external libraries.
我强烈建议使用cocoapods ,它是一个依赖管理器,可以大大简化外部库的使用。
Also read Swift and Objective-C in the Same Project as it explains how to use objc from swift. 另请阅读同一项目中的Swift和Objective-C,因为它解释了如何从swift中使用objc。
Creating a bridging header under and add it under the project settings. 在项目头下创建一个桥接头并将其添加到项目设置下。
Include all the obj-c header you want to use in the bridging header and you are ready to go ! 将所有要使用的obj-c标头包含在桥接标头中,就可以开始使用!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.