Skip to content

A tool to export a Cocoapods library to a Xamarin project

License

Notifications You must be signed in to change notification settings

kikettas/Xamapod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 building, besides creating the binding files, these are normalized (thanks to SwiftClassify) with 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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published