Preview of Xcode 4 Support for MonoTouch

In their recent update of the iOS and Mac developer tools, Apple removed the standalone Interface Builder application and integrated the GUI designer functionality directly into Xcode 4. This was a very significant change and removed several features that were necessary for MonoTouch and MonoMac to integrate with the designer. As soon as Xcode 4 went final, we started working on MonoDevelop support for integrating MonoTouch with Xcode 4's GUI designer, but it's a complex project and will take some time to complete.

For now we recommend using Xcode 3's Interface Builder, which can easily be done even while having Xcode 4 installed. However, I understand that many people are concerned how Xcode 4 will be better supported going forward for MonoTouch and MonoMac, so I've made a screencast to introduce MonoDevelop's upcoming Xcode 4 integration and demonstrate how it works.

MonoTouch integration with Xcode 4

Although XIB files can be opened standalone in Xcode 4, this isn't very useful, as it's no longer possible to define custom types, outlets and actions within the interface designer. Instead the designer is aware of the Objective-C types defined in the Xcode project that contains the XIB file. This means that we have to generate an Xcode project file and synchronize it with the MonoDevelop project. Since Apple doesn't support writing third-party Xcode plugins, we can't make the Xcode designer directly aware of types defined in C# source, so the generated Xcode project also has to contain Objective-C stubs for all the types defined in C#. The Xcode designer now modifies the Objective-C source files when adding outlets or actions, so those changes need to be synchronized back the the MonoDevelop project.

The new model of Xcode integration resolves several outstanding issues in the previous Interface Builder integration. Because the generated project contains all bundle resources (Content and Page files) from the project, they will now be accessible directly from the GUI designer. In addition, all user-defined types are accessible from the designer, not just those defined for the current xib file.

Obviously, synchronizing files and types between two projects in separate applications is complex, and if anything goes wrong it's possible to lose data, so we want to make sure it's as reliable as possible before we release it. We hope to be able to offer a beta of this functionality within the next few weeks.

Comments

What is the recommended setup right now to use the latest and greatest MonoTouch?

I tried with MonoDevelop 2.4.2, Mono 2.6.7/2.10 and XCode 4, and that didn't work, a new project would not be able to run

So, I tried MonoDevelop 2.6 beta 2, Mono 2.10, XCode 4 and I was able to run a new project, with no changes

So, what is the most up to date, stable version of all components that I can use today?

This isn't a place to report bugs - if something's broken, please email support or file bugs in the bug tracker - however here are a few points that may answer your questions:

  • MD 2.4.2 is still the recommended/supported MD, but you need the hotfixed version from the built-in updater. Basically, Help->Check for Updates should show no available updates. It's shown by default when updates are available unless you've disabled it.
  • Make sure you have the latest MonoTouch (currently 4.0.1) from the MD updater.
  • With MT 4+, you need Mono 2.10.x, or XIB CodeBehind will not generate correctly. That might not be a problem if you don't use it.
  • Either Xcode 3.x or Xcode 4 is fine, but in each case make sure you have the latest version from Apple, or you're unlikely to be able to deploy to the app store. Also, if you want both Interface Builder and Xcode 4, you should install Xcode 3.x first in an alternative directory, as explained in the link in the main post.

Thanks, this has been really helpful, and clearly explains the time it needs to getting it released.

I imagine the amount of work this needs, but I am starting to think that maybe a MonoDevelop XIB designer add-in would be a good idea. On my TODO list for the future...

Is it possible to release this for testing for now? This way we can test it and give you guys feedback. Wondering if compiling the latest MonoDevelop from GitHub is going to work.

The code is in git master right now, so you could figure out how to build and enable it, but there are still a few issues I want to resolve before I officially release it for testing.

Michael, are you still planning on releasing this in light of the recent Attachmate/Novell/Mono/firing of everyone devlopments?

How to enable php with mono

Hi all

I have a problem, in the video you have clicked on the (.XIB) file and the whole project opened. but for me it doesn't work and just the designer section of the XCode 4 opened and lets me to edit the design and outlet and...

so please help me to discover why it happens for you and did not happen for me?

Best Regards,
Peyman Mortazavi

This is only a preview, and hasn't been released yet.

Have been more than 2 months now. Any update on when will this be available.

Hi

It seems that by this update coming to us we can just convert these codes to native Objective-C and then build and publish using XCode so there is no need to buy Professional package, is it true? if so should i wait for this update? when this update will come?

thanks,

This doesn't generate real Objective-C code, it only generates the stubs necessary to make Xcode aware of the classes.

I don't have an exact ETA but hopefully it will be soon.

I hope its very soon indeed. I installed Mac OS X Lion and now I can't revert back to ver 3. The above video does look very exciting though!

I have the same problem i upgraded to Lion and then I then uninstalled XCode4 but when i installed XCode3 it did not install correctly. So i removed XCode3 and went back to XCode4. The only solution i could come up with is i create my actions and outlets in code in a seperate partical class file but this is really hokey. So again all i can say is I cant wait for the first Alpha, since I am kinda dead in the water till then.

Hi Michael,

Just wondering if there had been any more progress on this? Really looking forward to it!

Thanks,
Tim