I am working in an Objective-C, iOS project, I used danielgindi Charts library which is a Swift library. I downloaded it using Cocoapods.
I am trying to import the library files into my Objective-C files using 'projectName-Swift.h'
as mentioned in this question but I faced an error:
'projectName-Swift.h' file not found
You can use it in any way you would use a UIViewController. Takeaway: By depending on UIHostingController and the interoperability of Swift and Objective-C programming languages, you can use SwiftUI framework from within your Objective-C legacy code.
Swift has its own runtime, but it also has access to Objective-C runtime, and also access to C . Having access to those runtimes makes the interoperability between Swift and Objective-C easier to bridge.
Objective-C has a superior runtime compared to Swift. It's probably going to be several years before Swift can catch up. If you're using powerful SDKs, Objective-C is also your best option here as well. I'd still recommend that new developers start off learning Swift.
If you have installed Swift library using cocoapods
To import Library in Objective C Code Use in Objective C
@import frameworkname;
In Swift
@import frameworkname
If your using cocoa pods try to make sure you have use_frameworks! in your cocoa pods pod file, otherwise the Swift Framework wont work. Also look at this for any other issues that may pop up: link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With