jeden / Xamapod

A tool to export a Cocoapods library to a Xamarin project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xamapod

A tool to generate all the binding files needed in a Xamarin binding library from a Cocoapods library. The generated binding files are both the fat libraries and definitions files (ApiDefinitions.cs and Structs.cs/StructAndEnums.cs) used later by the Binding library.

πŸ”— Works with

  • Swift libraries βœ…
  • ObjectiveC libraries βœ…
  • Pods with dependencies βœ…
  • Pods from external sources βœ…

πŸ“‹ Requirements

πŸ›  Installation

Simply clone this repository.

πŸš€ Building a binding library from a pod

To start using the tool, go to the repo folder and run this command:

sh build -p YOUR_POD_NAME

Optionally, you can specify both -s (subspecs, separated by commas) and -l (links to external sources, separated by commas) option.

Since Swift libraries are not officialy supported by Xamarin, the process of bulding these binding files for Swift Pods is slightly different. First, you have to mark all the classes/structs/enums that you want to expose to the binding library with the @objc attribute. After doing so, you can start using the tool.

ObjectiveC pod

Once it finishes, you will get this output:

β–Έ Installing Pods... βœ…
β–Έ Building libraries... βœ…
β–Έ Creating fat libraries... βœ…
β–Έ Creating binding files... βœ…

 SUCCESSFULLY COMPLETED πŸš€

Swift pod

The output is similar but during the build, besides creating the binding files, these are normalized (thanks to SwiftClassify) by using the correct names. Finally all the Swift libraries required by the binding library are listed.

β–Έ Installing Pods... βœ…
β–Έ Building libraries... βœ…
β–Έ Creating fat libraries... βœ…
β–Έ Creating binding files... βœ…
β–Έ Normalizing binding files... βœ…

β–Έ Add these Swift libraries to your Xamarin App with NuGet:

AVFoundation
 Core
 CoreAudio
 CoreFoundation
 CoreGraphics
 CoreImage
 CoreLocation
 CoreMedia
 Darwin
 Dispatch
 Foundation
 Metal
 ObjectiveC
 Photos
 QuartzCore
 UIKit
 os
 simd

SUCCESSFULLY COMPLETED πŸš€

When the building process finishes, all the generated binding files are available in the Generated folder.

About

A tool to export a Cocoapods library to a Xamarin project

License:Other


Languages

Language:Shell 68.1%Language:Swift 31.9%