简体   繁体   English

安装没有cocoapods的库

[英]Install a Library without cocoapods

I am trying to install this library without using Pods. 我试图在不使用Pods的情况下安装该 In their git , they explain that it's possible to do it by dragging the .xcodeproj file on the user project: 他们在git中解释说,可以通过在用户项目上拖动.xcodeproj文件来做到这一点:

Yes you can copy it the classes like before. 是的,您可以像以前一样复制它的类。 However it's more comfortable to drag the xcodeproj to the project. 但是,将xcodeproj拖到项目中比较舒服。 It's not recommended to drag the sources themselves, as this will make updating Chrats in your project more difficult. 不建议自己拖动源,因为这会使更新项目中的Chrats更加困难。

By dragging the project I get an error When I try to import the module: 通过拖动项目,当我尝试导入模块时出现错误:

No such module 'Charts' 没有这样的模块“图表”

I also selected my project -> Build Phases -> Link Binary With Libraries and added the Charts.framework . 我还选择了my project -> Build Phases -> Link Binary With Libraries Charts.framework my project -> Build Phases -> Link Binary With Libraries并添加了Charts.framework That didn't solved the problem. 那没有解决问题。

I think to use any of the cocoa pods you have to build a header file as maybe the code that you are going to use might be in objective C and you might be using swift. 我认为使用任何可可豆荚都必须构建头文件,因为要使用的代码可能位于目标C中,而您可能正在使用swift。

  1. Simply create briding header file with named "projectname-bridging-header.h" at root of your project. 只需在项目的根目录下创建名为“ projectname-bridging-header.h”的桥接头文件。
  2. Now got to build setting of project and in that do below changes: 现在要建立项目的设置,并在其中进行以下更改:

    Install objective-c compatibility header : YES 安装objective-c兼容性标头:是

  3. objective-C briding header : set path of your bridging header like "projectname/briding header file name.h" Objective-C桥接头:设置桥接头的路径,例如“ projectname / bride头文件名.h”
  4. once its done import all your objective c file of pods which u want use in swift app. 一旦完成,导入您要在swift应用程序中使用的Pod的所有目标c文件。

Note : if required then set the path as a recursive in the resource headers and Swift compiler search section. 注意:如果需要,请在资源头和Swift编译器搜索部分中将路径设置为递归。

let me know if any issues :) 让我知道是否有任何问题:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM