简体   繁体   English

如何在Swift框架中使用Objective C Cocoapods

[英]How to use Objective C Cocoapods in Swift Framework

My swift framework has dependency of Objective C Framework. 我的快速框架依赖于Objective C框架。 How do I use that ? 如何使用?

When I try to use Bridging Header, I am getting error like Framework Target doesn't support Bridging Header 当我尝试使用桥接头时,出现错误,例如Framework Target不支持桥接头

After my search , I found answers for 搜索之后,我找到了答案

  1. How to use Objective C Files in Swift Framework 如何在Swift框架中使用Objective C文件
  2. How to use Objective C Framework with swift project 如何在Swift项目中使用Objective C Framework

But I need solution for 但是我需要解决方案

How to use Objective C Framework as dependency in Swift Framework ? 如何使用Objective C Framework作为Swift Framework中的依赖项?

Thanks in advance :) 提前致谢 :)

Just install the library in the project, then make a Bridging Header and import the header file of that framework in the Bridging Header. 只需将库安装在项目中,然后创建一个桥接头,然后在“桥接头”中导入该框架的头文件。

Refer this to create Bridging header Link 参照此内容创建桥接头链接

You should do some silly task and you will be able to add Objective-c Framework as well as Objective-C Files. 您应该做一些愚蠢的任务,并且能够添加Objective-c框架以及Objective-C文件。

1) Create a header file and enter headerFile. 1)创建一个头文件并输入headerFile。

在此处输入图片说明

2) Set Bridging header path like below. 2)设置桥接头路径,如下所示。

在此处输入图片说明

3) Import Objective-c Framework as well as Objective-C Files like below. 3)导入Objective-c框架以及如下所示的Objective-C文件。

#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#import <GooglePlus/GooglePlus.h>
#import <GoogleOpenSource/GoogleOpenSource.h>
#import <Google/SignIn.h>
#import "FBFetchUserManager.h"
#import "TGLStackedViewController.h"

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

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