How to use fast library in NativeScript?

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.

+8
ios swift nativescript
source share
1 answer

You can check for example my plugin: https://github.com/enchev/nativescript-dialog

I use the Swift SDCAlertView library and you can find additional information on how to configure it in the pod and xconfig files: https://github.com/enchev/nativescript-dialog/tree/master/platforms/ios

All classes are most likely available in a global context. For example:

 var chart = new BarChartView(); 
+7
source share

All Articles