0

I created an objective-C project for socket programming and its working fine now i want to import it into my Swift project where i am using JSQmessageViewController for chating. I copied "AsyncSocket.h" and "AsyncSocket.m" into my swift proejct and imported them in bridging header as well but when i try to use them in my "ViewController.swift" it gives me error My bridging Header is working fine because i can use JSQmessageViewController in my "ViewController.swift" without any issues. This is my bridging header

enter image description here

Build Settings seems fine to me

enter image description here

But still getting this error

enter image description here

Umair Afzal
  • 4,947
  • 5
  • 25
  • 50
  • 1
    Once you have added the .h file to the bridging header there is no need to add an `import` statement to your swift file; the objective c class will be available automatically. – Paulw11 May 17 '16 at 12:19
  • refer this link,It may help you http://stackoverflow.com/questions/29500227/xcode-no-such-module-error-but-the-framework-is-there and http://stackoverflow.com/questions/31106411/no-such-module-on-xcode-7-beta-2 – Shangari C May 17 '16 at 12:22

1 Answers1

1

No. You don't import your Objective-C file directly to your swift file. Write something like

let asyncSocketInstance:AsyncSocket = AsyncSocket()

. Make sure AsyncSocket appears under Compile Sources of Build Phases and its header file is imported in the bridging header file.

El Tomato
  • 6,479
  • 6
  • 46
  • 75
  • ohh i understand that now thak you soo much it worked. Other wise i was thinking to conver my JSQmessageViewController project into objective-C because i was not able to find any tutorial of JSQmessageViewController in Objective-C – Umair Afzal May 17 '16 at 12:29