tags:

views:

1605

answers:

6

Has anyone spent any time comparing the various Objective C bridges and associated Cocoa wrappers for Mono?

I want to port an existing C# application to run on OS X. Ideally I'd run the application on Mono, and build a native Cocoa UI for it.

I'm wondering which bridge would be the best choice.

In case it's useful to anyone, here are some links to bridges I've found so far:

A: 

Not going to ask why, since you have your reasons I am sure.

I would look at the Unity3D project and see if you can suss out how they did it. Looks, um, hard.

Genericrich
Thanks for the response. Actually I was interested in the bridges that already exist, as opposed to writing a new one...
Antony Perkov
+1  A: 

I think that NObjective is the best choise coz it have automatic code generation for Objective-C wrappers that can be easily configured to regenerate wrappers for further versions of Mac OS.

Any comments on what you've used it for, or problems you encountered?
Antony Perkov
+1  A: 

OK, I'll ask: why would you want to do this? Cocoa's UI archtecture, including Cocoa-std delgates and Cocoa bindngs are closely tied to Objective-C. The combination of Interface Builder and Objective-C is remarkably productive. Although you can use Interface Builder with many bridges to Objective-C (including PyObjC, MacRuby, and many of the C# bridges), you will inevitably loose productivity due to any impedance mismatch between the framework and your language of choice. With C#, this mismatch is significant. Since you're writing a native UI, thus loosing any cross-platform advantage you would gain from C#, I would use Objective-C. For a competent C/C++/C#/Java/etc. programmer, it generally takes 2-3 days to become comfortable and productive in Objective-C.

Barry Wark
Short answer: I'm not starting with a clean slate.I want to build a Cocoa UI for an existing C# application (as opposed to using GTK# or WinForms).It's not worth duplicating my current code in Objective C, then maintaining two sets of equivalent code going forward.
Antony Perkov
But you can still use Objective-C for the UI and use one of the bridges listed in your question to reuse your existing model code. This is the approach recommended for cross-platform apps on OS X.
Barry Wark
+3  A: 

I've been trying out Monobjc, NObjective and MObjc/MCocoa with F# lately and I will go with MObjc/MCocoa.

Monobjc is as you write best documented and packaged but compared to the other two very slow and does not "rethrow exceptions" from ObjC.

I believe that NObjective and MObjc/MCocoa are the only two that rethrow exceptions from ObjC and that's why I find them to be the only real alternatives.

As discussed here NObjective uses structs with inheritance which I find quite scary and made me finally choose MObjC/MCocoa.

(You might have a licence issue as well. Monobjc and NObjective is under LGPL, MObjc/MCocoa is under MIT ...)

Johan Kullbom
Johan I removed the accepted answer flag from your answer. Please don't be offended by this. Your answer is still valuable, but I feel that MonoMac is the way forward. I wanted this page to reflect that.
Antony Perkov
No offense taken... :) I also believe that the release of MacMono has changed the situation...
Johan Kullbom
+1  A: 

A fairly lengthy discussion of the various bridges has taken place on the Mono-OSX mailing list.

The discussion starts here with Miguel:

  • Announcing that Cocoa# will no longer be maintained by Novell.
  • Attempting to unify the remaining efforts in the community.

If you read the rest of the discussion, it appears that the Mono community is leaning towards either Monoobjc or MObjc / MCocoa; so if you're doing your own investigations these are probably the ones to focus on.

Antony Perkov
I have added a new answer to this question focussing on MonoMac. I left this answer untouched in case the details are useful to people interested in how MonoMac came about.
Antony Perkov
+2  A: 

The Mono team have released a new bridge called MonoMac.

It's essentially the desktop version of the MonoTouch framework they produced for the iPhone.

Miguel announced the new bridge on his blog here: http://tirania.org/blog/archive/2010/Apr-19.html

Once MonoMac matures, I suspect that it will become the bridge people use.

Antony Perkov