On November 17, Xamarin unveiled a huge set of new features collectively known as Xamarin 4. These features pretty much touched the entire Xamarin product lineup – big and small. Some highlights include:

  • Xamarin Forms 2.0 This is a big time release, Forms is now a 2.0 product! I have used 1.x Forms in a couple of “production” apps and have been quite happy with it. I’m definitely looking forward to using it as a 2.0 product. Looking forward so much, I even “found” Xamarin Forms 2.0 before it was announced!
  • Xamarin Mac Agent In my normal day to day development, I work on a Mac and when I am using Visual Studio – it’s through a virtual machine. The pairing process to get to the previous Mac Build Host was mostly painless – but it still was a process, sometimes hanging, sometimes having to enter a PIN. No more! The new Xamarin Mac Agent is slick and easy, with the pairing done through some SSH magic. (But beware there are some file path length limitations, at least for now, so you may need to move where your solution resides).
  • UI Test Recorder Yes and heck yes! I always thought the main reason more people didn’t write unit tests was because … well, they had to write them! (At least that line of thinking makes me feel better for my … ahem … unit tests)! With this product though – that excuse goes out the window for UI unit tests. This product does all of the work for you.
  • Xamarin Inspector Technically not part of Xamarin 4 … but holy smokes, check this thing out!

It’s pretty much a UI REPL engine … truth be told, I haven’t played with it much yet, but I’m pretty sure it’s going to change the way I design apps!

Those are all great features that are part of Xamarin 4 – and there are more – but the best one, the one I want to talk about today, might get lost in the shuffle. It’s a tiny little feature that has already made my life MUCH less painful … but doesn’t get the attention it deserves … the feature?

THE ABILITY TO EDIT XIBs IN XAMARIN STUDIO!

You’re rolling your eyes now, right? Such a little, seemingly added-on as an after-thought feature … and compared with everything else, how can it be my favorite? Well, let me explain why …

As I mentioned above, my day to day work is developing Xamarin apps on a Mac, thus I live in Xamarin Studio. When developing iOS applications I use XIB files to design the user interface of iOS apps (more on that below). Developers, by nature, are a lazy bunch (heck, we learn keyboard shortcuts so we don’t have to reach for the mouse!), and switching from one IDE to another just to edit a file is … well … not good.

Not having to switch to XCode makes life much, much easier and more enjoyable – I may be exaggerating a bit, but it’s definitely a more pleasant development experience! Previously when switching to XCode there was always the chance that Xamarin Studio wouldn’t sync and pick up the change (although it has gotten much better at that lately). And let’s face it, Apple may make great hardware – but working with their software always leaves something to be desired.

What’s so great about XIBs anyway?

Glad you asked! I could just use storyboards or write the UI with C# … but I’m a fan of XIBs. My reasons for using XIBs are below, and of course, whether to use them on a project or not is all a matter of context …

  • XIBs are just containers of other things … not necessarily just for view controllers, but also for views. This means that if we have the need to reuse the same layout in multiple places throughout the app – XIBs are the way to go. But XIBs are versatile and can model an entire view controller if you’d like too!
  • XIBs decouple navigation logic from the view. We can make a XIB dumb – it just displays stuff. With a storyboard, there’s inherent navigation logic that goes along with the UI layout.
  • In my experience, XIBs work better with my MVVM framework of choice MVVMCross. I’m sure MVVMCross can work with storyboards – but I’m happy to just keep using it with XIBs (see the point about about developers being lazy).

Xamarin Studio XIB Editor Impressions

The XIB editor works just about the same as the storyboard editor within Xamarin Studio. You can drag controls, set their properties, everything you would expect. And in that respect it works perfectly!

I have noticed that it has issues opening up a couple of existing XIB files where you get an error like the one below. According to this forum post, it appears to have something to do with the formatting of the XIB file itself (although the XIB file this error appeared on didn’t apply to the forum post).

However, those parsing errors are few and far between, and building the UI with the XIB editor works as you’d expect, and it really is nice not having to go to XCode just to drop some controls onto a UI.Where I do prefer XCode however is in adding auto layout and constraints to a view. The way Xamarin Studio performs that task is a bit different than XCode, and it works just fine. My preference probably stems from the fact that I’m used to the way XCode does things. I will be giving the Xamarin Studio more of a go however in this respect to see what it all can do. (Plus there’s a Xamarin University course that partially covers how to apply auto-layout and constraints within Xamarin Studio … I’ll have to re-watch that for tips).

Summary

Xamarin has unleashed a lot of great, huge even, features upon their development community with Xamarin 4. One though that shouldn’t be overlooked is the ability to edit XIB files within Xamarin Studio itself. It simplifies the workflow when developing iOS applications that use XIB files, and despite some issues parsing existing XIB files – I will definitely be using XCode less and less now!