如何将模块导入 xcode
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44361827/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to import module into xcode
提问by AlexAdagio
I am trying to use socket.io
in my swift app.
我正在尝试socket.io
在我的 swift 应用程序中使用。
I am new in swift.
我是 swift 的新手。
I'm following the instructions from https://github.com/socketio/socket.io-client-swift
我正在按照https://github.com/socketio/socket.io-client-swift的说明进行操作
but here is the problem, I don't understand how to do the following step.
但这是问题所在,我不明白如何执行以下步骤。
(Install Manually) "Copy the Source folder into your Xcode project. (Make sure you add the files to your target(s))"
(手动安装)“将源文件夹复制到您的 Xcode 项目中。(确保将文件添加到目标中)”
I don't understand how to achieve this, I have "Added the SocketIO.h and the entire folder into the project, but no matter what, the module is not found.
我不明白如何实现这一点,我已经“将SocketIO.h和整个文件夹添加到项目中,但无论如何都找不到模块。
Am i supposed to add some binaries, if so what are the binaries? What are the extension? How can I identify it?
我是否应该添加一些二进制文件,如果是这样,二进制文件是什么?扩展名是什么?我怎样才能识别它?
Here is the image of my xcode project....image of my screen in xcode
回答by BigHeadCreations
When you clone or or download the socket io project you get a directory with multiple subdirectories. One of the subdirectories is named Source
. Simply drag that folder into Xcode (into the Project Navigator in the left sidebar).
当您克隆或下载 socket io 项目时,您将获得一个包含多个子目录的目录。其中一个子目录名为Source
. 只需将该文件夹拖入 Xcode(拖入左侧边栏中的 Project Navigator)。
You will then be presented with a screen like this:
Make sure the box for your app is ticked in the "Add to targets" list. This is what the instructions mean by "Make sure you add the files to your target(s)"
确保在“添加到目标”列表中勾选了您的应用程序框。这就是“确保将文件添加到目标”的说明的含义
回答by Salman Ghumsani
If you tried with cocoa pod
then you have to import this module, else you have to add only two group like this screen shot, Now you can work without importing the module because of all the swift file by default imported into the whole project.
如果你尝试过,cocoa pod
那么你必须导入这个模块,否则你只需要像这个屏幕截图一样添加两个组,现在你可以在不导入模块的情况下工作,因为默认情况下所有的 swift 文件都导入到整个项目中。