How to use cocoa pod in your iOS project
来源:互联网 发布:access开发小软件 编辑:程序博客网 时间:2024/06/07 19:34
https://cocoapods.org/
(1)sudo gem install cocoapods
(2)新建一个xcode应用
(3)从终端进入应用目录,pod init
(4) 修改生成的profile文件
platform :ios, '8.0'
use_frameworks!
target 'MyApp' do
pod 'AFNetworking', '~> 2.6'
pod 'ORStackView', '~> 3.0'
pod 'SwiftyJSON', '~> 2.3’
end
(5)$ pod install
(6)open App.xcworkspace
(7)Now you can import your dependencies e.g.:
#import <Reachability/Reachability.h>
如果在swift项目中使用ios的控件,不要忘记写转换文件,Create Bridge Header,
之后需要在Build setting下的Swift Compiler-Code Generation里配置下bridge header路径。
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
To import Objective-C code into Swift from the same target
In your Objective-C bridging header file, import every Objective-C header you want to expose to Swift. For example:
#import "XYZCustomCell.h"
#import "XYZCustomView.h"
#import "XYZCustomViewController.h"
In Build Settings, in Swift Compiler - Code Generation, make sure the Objective-C Bridging Header build setting under has a path to the bridging header file.
The path should be relative to your project, similar to the way your Info.plist path is specified in Build Settings. In most cases, you should not need to modify this setting.
- How to use cocoa pod in your iOS project
- How to use Log4net in your project
- learn PCL 02 How to use pcl in your own project.
- How to use NSNotification in iOS?
- How to consume your time in your developing and how to use a efficient way?
- How to use AspnetUpload™ in your web application
- [Bootstrap] How to use bootstrap in your application?
- How to Reference and Use JSTL in your Web Application
- UE4 Material - How To Use Fresnel in your Materials
- How to use user’s location in your app?
- how to use MongoDB Java driver in your env
- How to use another indicator in your code?
- How to add QuartzCore.framework for your project in xcode?
- How to use an external dll file in VisualStudio project
- How to use your GemFile
- How to use Automake and Autoconf to manage your project? ( 1 )
- Instruments on Leopard: How to debug those random crashes in your Cocoa app
- How to Use Cocoa Bindings and Core Data in a Mac App
- MVC
- 解决openlayers调用mapserver发布的地图出现乱图问题
- LinkedHashSet集合的介绍
- redis 3.0的集群部署
- 浮点数比较大小的问题
- How to use cocoa pod in your iOS project
- Android 开发系列(2) - native代码调用java代码 - 获取硬件 IMEI 和硬件序列号
- How to use user’s location in your app?
- 面向GC的Java编程
- 从Spark Streaming 收集应用程序日志到Flume agent的配置方法
- maven使用命令行新建项目
- ssh-key Permission denied (publickey)
- Android酷炫实用的开源框架(UI框架)
- 经典算法学习——直接插入排序