Search code examples
objective-crubyrubymotion

how do I include native library in rubymotion


I want to include some native project in my rubymotion project. Anyone faces this problem before because the vendor do not provide cocoapod yet.

Thanks


Solution

  • You'll just need to copy the required files in to the vendor folder and require them in your Rakefile.

    For example. With these two libraries https://github.com/samvermette/SVPullToRefresh and https://github.com/rs/SDWebImage the following in your Rakefile will work.

    app.vendor_project("vendor/SDWebImage.framework", :static, products: ["SDWebImage"], headers_dir: "Headers")
    
    app.vendor_project("vendor/SVPullToRefresh", :static, cflags: "-fobjc-arc")
    

    The first library was .framework bundle whereas the second was just .h and .m files in a folder.

    You can find some more information on requiring 3rd party libraries here:

    http://www.rubymotion.com/developer-center/guides/project-management/#_vendoring_3rd_party_libraries