zoukankan      html  css  js  c++  java
  • How to use cocoa pod in your iOS project

    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

    1. In your Objective-C bridging header file, import every Objective-C header you want to expose to Swift. For example:

      1. #import "XYZCustomCell.h"
      2. #import "XYZCustomView.h"
      3. #import "XYZCustomViewController.h"
    2. 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.

     

     

     

     

     

     

     

      

  • 相关阅读:
    关于application/x-www-form-urlencoded编码
    socket 状态
    TCP/IP三次握手详解
    一步步优化JVM四:决定Java堆的大小以及内存占用
    编码问题
    git 应用
    父与子继承
    python try except
    python 编码问题
    requests 库使用方法
  • 原文地址:https://www.cnblogs.com/iwangzheng/p/5138056.html
Copyright © 2011-2022 走看看