I've been doing some renovation on one of my first MonoTouch/iOS apps and I found some great UI stuff written in Obj-C on Github. Rather than port the code to C#, I figured that learning the binding process would be worth it so I could pull updated commits as bugs get fixed and new iOS versions are released.
First off, I have an appreciation for the amount of engineering work that was put into making this stuff all play nicely. I don't want to sound whiny here.
The binding process seems like it should be much easier. MonoTouch is pretty mature at this point.
In the "Binding Objective-C Libraries" (http://docs.xamarin.com/ios/Guides/Advanced_Topics/Binding_Objective-C_Libraries) document, no mention is made that there is a tool to generate a most-of-the-way-there ApiDefinition.cs file automatically (https://github.com/stampsy/monotouch-binding-generator). Honestly though, even with writing the ApiDefinition.cs file by hand it was only a fraction of the time spent.
Most of the UI "libraries" I've found on Github are just Xcode projects with .h and .m files. They need to be compiled into Cocoa touch static libraries in Xcode (.a files) to be bound properly. There should be some mention of this process and its pitfalls in the documentation, like the non-default the behavior of generating a Universal library for ARM and x86 architectures (A "Universal" Xcode Project Template can be found at https://github.com/michaeltyson/iOS-Universal-Library-Template).
Creating a MonoTouch Binding Project is equally frustrating. When choosing "Add Files" and selecting the .a file, the libWhatever.linkwith.cs file auto-detects the supported architectures (shown in the "assembly: LinkWith" attribute). That is the first indication that my static library was built without x86 support.
Attempting to remove and re-add a recompiled .a file within the MonoTouch Binding Project has issues. The generated .dll would not work in my application some of the time. "Duplicate symbol" errors would randomly appear or disappear between builds. I had to ritually Clean and Rebuild after updating the .a references. I'd also have to close and re-open MonoDevelop because of some phantom libWhatever.linkwith.cs files appearing as missing (in red) but were not removable from the project.
So, here are some recommendations:
Why not explain to your (potentially inexperienced Obj-C / Xcode) users about creating static libraries. Including a Universal Architecture Xcode Project Template would be a good idea. Allowing the user to choose some header/method files and creating the static lib automatically would be even better.
Couldn't the automatic binding generator stuff be wrapped into MonoDevelop itself?
Basically, it would be great to reduce the number of manual steps required to create (and more importantly) update a bound library for use.
It would be a really nice selling point to future customers to show how easy it is to use Objective-C code and integrate it into their projects. Download repo / compile correct static lib / auto-generate (most) of the ApiDefinition / some manual cleanup of ApiDefinition.cs / reference in project.
Thanks for reading