[英]How to import a Cocoa Touch Framework written in Swift to a .pch file?
I created a Swift framework which I want to import in every class I make in my Swift project. 我创建了一个Swift框架,我想在我在Swift项目中创建的每个类中导入它。 I don't want to have to type the
import
statement manually, and everywhere. 我不想手动和任何地方
import
语句。 How can I do this? 我怎样才能做到这一点?
In Objective-C this would be the same as putting one #import
statement in the pre-compiled header (.pch file). 在Objective-C中,这与在预编译头(.pch文件)中放入一个
#import
语句相同。
What I tried 我尝试了什么
public
keyword. public
关键字。 .xcodeproj
to my app's Xcode project. .xcodeproj
添加到我的应用程序的Xcode项目中。 .framework
in Target Dependencies. .framework
。 <FrameworkName/FrameworkName.h>
in the .pch file. <FrameworkName/FrameworkName.h>
。 This doesn't solve the problem, and kinda doesn't make sense, because I don't really import anything in the FrameworkName.h
inside the framework project. FrameworkName.h
真正导入任何东西。 You can add .pch file manually and then you can import your common files in your .pch file. 您可以手动添加.pch文件,然后可以在.pch文件中导入公共文件。 for more info see below link
有关更多信息,请参阅以下链接
see in this image 看到这张图片
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.