C# for the iPhone: Monotouch is here to stay

Today I’m going to submit my second Monotouch app to the Appstore. Time to write down some reflections and try to further raise enthusiasm for Monotouch by providing some links.

  • Apple does accept Monotouch apps in the store, look here for a catalog and showcase .
  • The default tool for building iOs app is Apple’s Xcode. Most resources on iOS devlopment are in xCode’s objective C. The Monotouch architecture closely mirrors Xcode, read the Rosetta stone to translate member names.

But Monotouch is more than just another dialect. IMHO and experience the C# language and the .net class library do have unique things to offer. To name some:

  • Generics
  • Lists. Unlike C# for Windows.net Lists are a wrapper for arrays. Using (typed) lists does lead to far clearer code.
  • Lambda’s and linq. Objective C (Xcode) does have delegate’s but misses the elegance of lambda’s.
  • XML. Both XmlDocument and Xpath work very well (and fast) in Monotouch. The way to go when doing interop.

These are my favorite Monotouch sites

  • Shrinkrays. Formerly known as sloppycode.net. A huge variety of articles and snippets. My favorite ones are on a code based approach to views and controllers on the iPhone. Most articles on the web guide you through the MonoDevelop wizards to start an app. Which leads to the world of interface builder and xib’s. The approach presented here focuses on the plain C# code behind and a surprisingly easy way to build a complete app from plain C#. I am working on a more elaborate post which builds on these ideas.
  • Conceptdev (Craig Dunn’s blog) More than just MonoTouch stuff. Craig has also worked on the DeepEarth project and in his most recent posts he is covering Windows Phone 7. Great source to put things in perspective.
  • Infoq. These are more traditional basic articles. The quality is great, I keep using the one on tables again and again.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://www.zeta-uploader.com UK

    I just finished my very first iPhone app this weekend with MonoTouch. I’m really excited about the fact that I copied a lot of code over from an existing WinForms application and could use it nearly unchanged in MonoTouch.

  • Anonymous

    C# s not C. You cannot switch back from Objective C to C#, you can to C.
    Both objective C and C# are (partly) based on C. It depends on what you are used to what you like best. C# does have very good things to offer and support, also on SO and BBs is good.
    In case you are familiar with C# Monotouch is a very good entry to iOS. Or, using MonoDroid, to Android. Or using C# to WP7. In case you are familiar with Objective C it’s OK to work on iOS but for every other platform you have to use a new language right from start. That is a steep curve.

  • http://www.facebook.com/profile.php?id=100000796442967 Aurélien Ammeloot

    Monotouch is a good idea, but it’s flawed.
    As an old school Objective-C developer, switching back to C# can be a pain in the b…
    Objective-C has a verbose syntax close to natural language, which makes sense if you’re used to it. Using Monotouch when you’re experienced in Objective-C is like being fluent in French, but having to talk to a French person in German that you don’t know that well :-)
    And also Monotouch is not so widespread when compared to Objective-C, and if you need advice from the community of developers on StackOverflow or bulletin boards… good luck!

  • Anonymous

    IMHO the power of MT is that it welcomes iOS in the ever expanding world of C#. Just looking at iOs MT is just another language.
    Besides that building software is (should be) expressing a model in code. I greatly prefer C# doing that :)

  • http://profiles.yahoo.com/u/6BKSFCTQBEUGFPGCJORKT4UBVY Andrew

    I my opinion, MT is better suited for C# software houses that don’t have any Objective C developers. A good example of what I feel a MT product would be is an enterprise type app that isn’t even sold on the App Store. Apple doesn’t care about these types of apps, so there’s also no risk of them getting shut down either since they don’t go through the approval process or sold on the App Store.

    Once you start getting into games, especially if you’re going to use unmanaged code, why not go with Objective C at that point? The world is full of C# devs who build business software, for them to build business software in MT isn’t much of a stretch, but once you start getting into unmanaged graphics code, that’s a whole new ball game that the lion’s share of C# developers know nothing about, which means you completely lose the advantage MT gives you.

    I’m not saying not to develop games in MT, in my opinion, it’s just not a good idea.

  • Anonymous

    What’s the problem with game development with MT? The showcase does list games. And in one of my previous posts I have shown how to do real hard-code graphics in (unmanaged) MT

  • http://profiles.yahoo.com/u/6BKSFCTQBEUGFPGCJORKT4UBVY Andrew

    Yes, but most standard iPhone apps are about 2mb and 10mb would be considered “huge”. I’m aware that the app store actually supports much, much larger than 10mb (1 gb I think), but in reality you will rarely see an app much larger than 10mb.

    If MT automatically adds 4mb to your app size, even if it’s just a Hello World type that is significant when you are talking about relative size. That also doesn’t take into consideration that it’s mostly games that are big, which aren’t going to build in MT anyways, I imagine that most business type apps are under 1mb in size.

  • http://twitter.com/sichy Pavel Sich

    Also checkout blog.touch4apps.com, some nice Monotouch info there as well.

  • Anonymous

    A MT app can be as small as 4mb. An Xcode app with a lot of embedded media can be far larger than that. There could be other ways of finding out.
    I know I am taking somewhat of a gamble. A big reason for staying with C# is cross platform. On the longer term I want to port my app to Android (MonoDroid) and W7 (in case it does take off).
    Objective C ? Nah.. I really have had my share of refcounting in COM and unmanaged code. To old to want to go back :) In case I had no choice starting iOS in MT has been a great way to learn the platform.

  • http://profiles.yahoo.com/u/6BKSFCTQBEUGFPGCJORKT4UBVY Andrew


    I am by no means an expert on this, but I do think Apple could sniff out Monotouch apps if they chose to since the package size of a MT app is much larger than a standard Obj C app.

    My feelings based off working on a single iPhone app are this. Monotouch is great, and if my department ended up doing more work related, enterprise iPhone apps (these are not installed via the AppStore), I would definitely use it for those. We’re a C# shop and I have a hard enough time finding decent .NET developers, I’d rather pay a few grand in licensing fees than have to staff Objective C devs.

    That beings said, the one app I have worked with really isn’t all that hard, so if I was building an app on my own (to get a piece of the App Store pie), I’d do it in Objective C. It’d take me longer, but I’d be learning a new technology that is 100% safe to use. Building an app that will be sold via the App Store using any third party wrapper doesn’t seem like a good idea to me.

  • http://profiles.yahoo.com/u/6BKSFCTQBEUGFPGCJORKT4UBVY Andrew

    I don’t see it this way. Apple merely provides the mechanism to get your software in front of million of eyes, it is your choice whether to use it or not.

  • Anonymous

    Do we relinquish? I see no choice, except ignoring the platform ?

  • Daniel

    Exactly Andrew, I was going to write something similar.

    I still can’t believe how easily we as software developers relinquished our right to freely distribute software. Apple is getting away with it, so now Microsoft is also doing the same, and soon we’ll be wishing for the days when we could write an “hello world” application on our own machine without submitting it for corporate censorship.

  • Anonymous

    I don’t think they care, I don’t think they even know it’s monotouch. When scanning the app all they see is normal ios calls. Made by the monotouch libs.

  • http://profiles.yahoo.com/u/6BKSFCTQBEUGFPGCJORKT4UBVY Andrew

    Unless you have a signed letter from Steve Jobs stating that Monotouch built apps are forever safe, you shouldn’t state it as fact. At the moment, Apple doesn’t seem to care about Monotouch apps being on the app store, but that could change at any time.

    Its a great product and a great tool, but when you play with Apple, they own the sandbox, so they can take their ball and go home at any time with zero warning.

  • Pingback: Tweets that mention C# for the iPhone: Monotouch is here to stay | Peter van Ooijen -- Topsy.com