Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building Cocoa UIs for OS X with C# and Mono

Tags:

c#

macos

cocoa

mono

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:

  • CocoSharp - distributed with Mono on OS X - www.cocoa-sharp.com

  • Monobjc - better documentation than the others (in my opinion) - www.mono-project.com/CocoaSharp and www.monobjc.net

  • NObjective - (apparently) faster than the others - code.google.com/p/nobjective

  • MObjc / MCocoa - code.google.com/p/mobjc and code.google.com/p/mcocoa

  • ObjC# - www.mono-project.com/ObjCSharp

like image 869
Antony Perkov Avatar asked Apr 05 '09 23:04

Antony Perkov


2 Answers

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.

like image 181
Antony Perkov Avatar answered Oct 24 '22 12:10

Antony Perkov


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 ...)

like image 27
Johan Kullbom Avatar answered Oct 24 '22 12:10

Johan Kullbom