I am trying to use this ios-charts library in NativeScript. This library is written in Swift, not Objective-C. Can i use it? I tried to use it, but it gives me an error. I used it in the following steps:
Why I added a library to my nativescript project using
tns library add ios 'library_path'
The library is being added. Then I prepared a project for the ios platform using
tns prepare ios
To check if the library has been successfully added, I build the project in Xcode , it builds successfully, but then at runtime I get the following error.
dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Users/UserNameHere/Library/Developer/Xcode/DerivedData/Build/Products/Debug-iphonesimulator/Charts.framework/Charts Reason: image not found
I got rid of this error when I installed Embedded content contains swift code in YES . But now when I try to access the library as
var charts = new Charts();
It gives a reference error, as shown below:
ReferenceError: Can't find variable: Charts
What I already tried:
I tried to access the charts using the following methods:
1. var charts = new Charts.Swift(); 2. var charts = new Charts.Charts(); 3. var charts = new Charts-Swift(); 4. var charts = new Charts.LineChartView(); 5. var charts = require("Charts"); 6. var charts = require("../../lib/Charts.framwork"); 7. var charts = require("Charts.framework");
All of these methods give the exact same error.
References
I followed these links to develop my project.
Using-native-libraries-in-your-nativescript-apps
Using native-libs with cocoa pods: docs.nativescript.org/runtimes/ios/native-libs/CocoaPods
Even if I try this with cocoa Pods, it will still give the same error.
If someone tried this, please let me know.