iOS混合动态框架-使用私有模块桥接objc标头 [英] iOS mixed dynamic framework - bridge objc headers with private module

查看:86
本文介绍了iOS混合动态框架-使用私有模块桥接objc标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于动态框架"目标,我需要将内部(专用)objective-c标头桥接到我的swift对应标头.

In regards to a "dynamic framework" target, I need to bridge internal (private) objective-c headers to my swift counterparts.

据我了解,我需要使用一个私有模块.

From my understanding I need to use a private module.

使用@objc class TheClass语法将其中一些快速对应对象桥接回Objective-c.

Some of these swift counterparts are bridged back to objective-c using the @objc class TheClass syntax.

我已经在$SRCROOT下的目录中创建了module.modulemapmodule.private.modulemap文件,并在构建设置中添加了必要"标志.

I've gone ahead and created a module.modulemap and a module.private.modulemap file in a directory under $SRCROOT and added the "necessary" flags to the build settings.

SWIFT_INCLUDE_PATHS =>$(SRCROOT)/...

我还尝试过在构建设置中添加私有模块映射文件"

I've also tried adding a "Private module map file" to the build settings

我的模块映射文件是:

module InnerModule {
    export *
}

,私有模块文件为:

explicit module InnerModule.Private {
    header "../Classes/Header1.h"
    header "../Classes/Header2.h"
    ...
    export * // and have tried without it
}

在我添加的所有相关Swift文件中

In all of the relevant Swift files I've added

import InnerModule.Private

现在,在构建项目时,我的快速桥头出现错误

Now when building the project I get an error in my swift bridge header

#import <MyFramework/MyFramework-Swift.h> // getting an error here

MyFramework-Swift.h // generated header file
@import UIKit;
@import ObjectiveC;
@import InnerModule.Private; Module InnerModule not found

如何解决?

推荐答案

事实证明,编译框架后,您可以转到框架头,删除所有您不想公开的私有"头.

Turns out that after you compile the framework you can go to the framework header, delete all the "private" headers you don't want to expose.

之后,您可以从标头"目录中删除所有不想显示的标头文件.

After that you can delete all of the header files you don't want to expose from the "Headers" directory.

按预期工作

这篇关于iOS混合动态框架-使用私有模块桥接objc标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆