How to import module into xcode

2019-07-29 06:04发布

问题:

I am trying to use socket.io in my swift app.

I am new in swift.

I'm following the instructions from 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))"

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.

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

回答1:

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).

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)"



回答2:

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.