DEV Community

Khoa Pham
Khoa Pham

Posted on

Integrating library via custom podspec

Original post https://github.com/onmyway133/blog/issues/81

Today I am about to integrate a library that does not support Cocoapods yet. It would be cumbersome to do it manually, because you have to configure xcconfig, framework search path, assets, and these steps are not well documented.

You can do this with custom podspec. In my case, I need to install PinchSDK. First, declare a PinchSDK.podspec in your project folder.

Pod::Spec.new do |s|
  s.name             = "PinchSDK"
  s.version          = "1.9.14"
  s.summary          = "Pinch samler dessuten inn data hver gang en mobilapplikasjon oppdager en Pinch-beacon."
  s.homepage         = "https://bitbucket.org/fluxloop/pinch.installpackage"
  s.source           = { :http => "https://bitbucket.org/fluxloop/pinch.installpackage/raw/master/iOS/PinchSDK.zip" }
  s.authors = 'Fluxloop'
  s.license = { type: 'MIT' }
  s.platform     = :ios, '8.0'
  s.requires_arc = true
  s.resource = 'PinchSDK/Pinch.bundle'
  s.vendored_frameworks = 'PinchSDK/PinchLibrary.framework'
  s.xcconfig = { 'OTHER_LDFLAGS': '-ObjC' }
  s.public_header_files = 'PinchSDK/PinchLibrary.framework/Headers/PinchLibrary.h'
  s.source_files = 'PinchSDK/PinchLibrary.framework/Headers/PinchLibrary.h'
end
Enter fullscreen mode Exit fullscreen mode

Then, in your Podfile, you can point to this podspec

pod 'PinchSDK', podspec: 'PinchSDK.podspec'
Enter fullscreen mode Exit fullscreen mode

Finally, since this PinchSDK uses objc, you need to declare it in your bridging header

#import <PinchLibrary/PinchLibrary.h>
Enter fullscreen mode Exit fullscreen mode

Now, just pod install and you're done 🎉

Top comments (0)