There are lots of question about how to use swift code in objective c
. I had swift based project. there is Objectice C file where i need to use swift code.
Xcode did not create ProjectName-Swift.h
automatically. So i created manually and check the following things.
Generated interface header name :
ProjectName-Swift.h
Product Module Name :
myproject
Defines Module :
YES
Embedded Content Contains Swift :
YES
Install Objective-C Compatibility Header :
YES
Add
@objc
in swift class
import UIKit import SwiftyJSON
@objc class User: NSObject, NSCoding { }
Then Import ProjectName-Swift.h
in objective c file. But gives error Unknown Type name User
I had tried with add @class User
It gives error forward reference using @class
How can I fix this erros