I am using both Swift and Objective-C in my code. I have already used Objective-C libraries in Swift and few Swift libraries in Objective-C classes. I need to use SwiftyJSON in Objective-C. Can anyone help?
Asked
Active
Viewed 656 times
-4
-
https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html (see "Importing Swift into Objective-C") – shim Apr 18 '18 at 20:04
-
1Possible duplicate of [Call Swift function from Objective C class](https://stackoverflow.com/questions/24078043/call-swift-function-from-objective-c-class) – shim Apr 18 '18 at 20:05
-
You can't. SwiftyJSON is designed for Swift. Use https://github.com/bernikowich/NSTEasyJSON instead. – matt Apr 18 '18 at 20:06
-
@matt I have checked NSTEasyJSON. – Umar Afzal Apr 20 '18 at 16:30
1 Answers
4
You can consume Swift frameworks/libraries from Objective-C if they are designed to conform to the interfaces that Objective-C understands. Swift has lots of constructs that don't have an equivalent in Objective-C, so a library that is not written to support Objective-C won't work.
As Matt says, SwiftyJSON is a Swift-only library.
Duncan

Duncan C
- 128,072
- 22
- 173
- 272
-
Yes you are right. Because I have used a bunch of swift libraries for Objective C. But SwiftyJSON is only meant for Swift – Umar Afzal Apr 20 '18 at 16:31