BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

MonoMac Offers .NET Style APIs for Cocoa Development

| by Jonathan Allen Follow 131 Followers on Mar 29, 2011. Estimated reading time: 1 minute |

MonoMac, the newest attempt at creating a GUI toolkit for C# on OS X, has hit its 1.0 release. MonoMac is designed to be much more consistent with other .NET/Mono libraries. This is done by offering a thicker wrapper around the Cocoa APIs that obeys the .NET Framework Design Guidelines.

The earlier libraries such as MonObjc and the deprecated CocoaSharp used a thin, often mechanically generated interop layer on top of the Cocoa APIs. These require the use of selectors, which are a form of message passing OOP used by Objective-C . Rather than mapping selectors to C#’s method-based OOP, these libraries simple expose a series of objc_msgSend functions. The version of objc_msgSend needed depends on the parameters, the return type, and occasionally the CPU architecture.

The alternative to using a library over native code is to use a cross-platform toolkit. The options here are familiar. Gtk# and the deprecated Windows.Forms are easy to use, but don’t offer native-looking applications. And of course there is Silverlight, which encourages you to heavily style the application in lieu of attempting to mimic native applications.

As mentioned before, MonoMac was designed to expose most of Cocoa using .NET conventions. This means you can safely subclass Object-C classes with normal overriding and base-class constructor calls. Client code can hook into event notification via both Objective-C style delegates and .NET style events. Delegates, lambdas, and closures in .NET can be mapped to Objective-C blocks.

MonoMac includes support for publishing to the Mac App Store. Applications are assembled for the store using the Mono bundler, which includes a copy of the Mono runtime so that users don’t need to download it separately.

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT