Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Latest commit

 

History

History
75 lines (51 loc) · 4.26 KB

README.md

File metadata and controls

75 lines (51 loc) · 4.26 KB

[Not supported anymore] Automatic way of binding Cocoapods for Xamarin iOS

Automatic conversion from cocoapod to nuget (saving the hierarchy). For example, the tool provides "automatic" way to bind all the pods for Firebase iOS for Xamarin. Project is in beta state, expect all nuget packages of Firebase in the Nuget feed soon in alpha channel.

This tool can help with Cocoapods written in Objective-C. At this time, objc-automatic doesn't support Swift-based pods.

Tool works as a two step process. First you generate the bindings automatically (via bind.sh ) then you compile the bindings and package then as nuget.

To some extent this tool is similar to Xamarin's Objective Sharpie. Biggest difference is that this tool works with CocoaPod hierachy and generates set of dependent packages with Xamarin.iOS bindings mimicking hierarchy of CocoaPod

How to use

Blog post explaining whole story: Easy way to create Xamarin.iOS binding from CocoaPods

Video 1. objc-automatic generating lottie-ios binding for Xamarin.iOS

https://www.useloom.com/share/e17d23d0ec3711e689c9c95ad27ead9a

Video 2. objc-automatic demo - binding Firebase/Analytics to Xamarin

https://www.useloom.com/share/7679bec0ec3911e6b8fde34d395e0c71

Video 3. objc-automatic overview and details how it works internally

https://www.useloom.com/share/f756df30ec3b11e6b8fde34d395e0c71

Prerequisites:

  • CocoaPods (Getting started guide). One might need pod try yourpodname at least once to force CocoaPods to update local specs repo.
  • run mozroots --import --sync to import SSL root certificates.
  • NuGet 3. To update NuGet, run sudo nuget update -Self
  • Xamarin iOS
  • ObjectiveSharpie latest (3.4). Download information and manual.

First stage - generate bindings

To generate bindings sh bind.sh POD=LMGaugeView or sh bind.sh POD=Firebase/Messaging or use other pod names (see here https://firebase.google.com/docs/ios/setup in Available Pods section)

Other options:

  • POD=podName
  • VERSION=version (override versions in all packages --- use with caution and for tests)
  • SINGLE=yes - do not take into consideration pod references
  • VERSION-TYPE=-beta (adds suffix to version)
  • VERBOSE - to enable verbose output
  • POD_VERSION - to bind specific version of pod (by default it's "latest")
  • ROOT_HEADER_FILE - some cocoapods include Frameworks which do not follow common guidelines for the root header file name (should be same as framework name). If so, you can override it using this option. For example, POD=YandexSpeechKit ROOT_HEADER_FILE=SpeechKit.h

Second stage - compile and package as nuget To compile bindings and package then, run sh LMGaugeView.build.sh script in the bindings folder. This script is generated automatically and will show any errors in the bindings you need to correct.

After 2nd stage you should have a set of nuget packages ready for publishing in folder bindings/packages-raw

Between 1st and 2nd stages you might need to check generated bindings and make sure they compile. With git diff this is usually quick and easy.

Building generated bindings

  1. To build all bindings use sh {pod name}.build.sh script in bindings folder.
  2. To compile single binding use msbuild -p:Configuration=Release to compile in Release in the specific binding folder (e.g. bindings/AWSCore)

Additional options

Clean bindings folder - sh bind.sh CleanBindings

Clean pods folder - sh bind.sh CleandPods

Things to fix and improve

  1. detailed nuspec packages info and support for sub-version updates
  2. support weak_frameworks linker flag
  3. way to generate multiple pods at once
  4. support for iOS flavored dependencies (see ZendeskSDK pod)
  5. video showing how to use this

Contribution

Please ping me if you want to collaborate, extend, fix or change the project. I will be happy to sort out the process and answer any questions

Extra

Please see beginning of the build.fsx file for configuration options (verbose logs, versions, etc)