I am following this tutorial for import socket.io to swift. http://socket.io/blog/socket-io-on-ios/
I did everything in the tutorial but I am getting this error:
Use of unresolved identifier 'SocketIOClient'
for this piece of code:
let socket = SocketIOClient(socketURL: "localhost:8900")
My structure:
How can I resolve this problem ?
Make sure when copying you actually are copying the files. Here's a screen shot showing what I mean.
Don't do this when copying files...
In this image the options "Copy items if needed is deselected"
But be sure to do this
Select the option "Copy items if needed"
Also be sure to build your project after importing into the Bridging Header file. Be sure if it is a framework to import like so
But if it is a stand alone .h file then import it like so
UPDATE: I would also suggest having a look here to make sure you got the steps right - How to call Objective-C code from Swift
make sure about 2 things:
In the
bridging-header.h
change this#import "SocketRocket/SRWebSocket.h"
to this:If it does not work just add:
Also rename yout bridging header to
Ribony-Bridging-Header.h
and add it your project's target settings (refer to your bridging header path not just copy "TicTacIOiOS/Bridging-Header.h" from the documentation for websockets).