book review

Book review: Learning MonoTouch – A Hands-On Guide to Building iOS Application with C# and .NET

Having worked with MonoTouch since the first private beta and now actively working as a part of the Xamarin documentation team, Michael Bluestein (blog, twitter, github) is in a great position of authoring this book. Michael was working on the iPhone platform before MonoTouch came around, a fact that shines-through a bit throughout the book, where he can offer us more insights into the underlying platform than previous literature I’ve read.

Starting out with a walk-through of how to get your development environment set up, Mike guides us through creating a basic MonoTouch app. He is good about pointing out what happens beneath the scenes too, giving us insight into what a .XIB file really is, how MonoTouch binds to the controls you lay out in Interface Builder (Xcode) and how to access the underlying fields, if needed be – all in the first chapter of the book!

In chapter 2 - iOS SDK via MonoTouch – Mike gives us the big picture of the iOS SDK, outlining its various components. Beyond that, he also compares the Objective-C and MonoTouch APIs, throwing the reader head-first into the deep-end, something that was left for the last chapter in the previous book I read. Now, this isn’t necessarilly a bad thing – you get hints of how to interoperate with the underlying API – but it would probably make more sense if you had an iOS background. What Mike succeeds in doing, however, is giving you a sense that Objective-C and C# isn’t that different – there are quirks, but there is still a common inheritance.

Chapter 3 walks us through the Model-View-Controller design pattern, which has heavily influenced the iOS (and OSX) SDK API design. Containing a lot of useful information, the chapter is very focused on the available tools – namely Interface Builder (Xcode) – which, unfortunately, has changed substantially since the book was released. Again, though, Mike is good about showing us what happens beneath the veneer, giving us a deeper understanding of how things really work. This chapter contains a fun code example that uses the onboard sensors – making our studies more attached to the real world – and finishes up with explaining how to create your own UIView (like a User-Drawn Control in Windows Forms) and interacting with touch events.

I really liked the book’s fourth chapter - Common iOS Classes – as Mike not only went through a bulk of the available controls (ViewControllers), but also showed how to customise a lot of them to your liking!

Following a chapter with a bulk of the available controls, chapter 5 focuses on tables and navigation – essential bits in any iOS application.

In chapter 6 - Graphics and Animation – we get introduced to Quartz2D and the fundamentals of drawing lines, figures, images and PDF files. As an added bonus, we get a gem in how to attaching a dynamically created PDF document to an outgoing e-mail. The chapter finishes up by introducing Core Animation, which you can get a glimpse of in this video:

[youtube=http://www.youtube.com/watch?v=6JePwHjVj6U&feature=plcp]

 

Chapter 7 introduces us to Core Location, but also gives us valuable insight into the Significant Location Changes API and the Region Monitoring API, making it highly valuable chapter, even if you’ve read about Core Location before.

After we have learned all about location monitoring, chapter 8 tells us about MapKit, including how to draw annotations (like drop pins) and custom overlays.

Connecting to Web Services is what chapter 9 is all about, doing a good job highlighting the different options available and also containing a nice discussion of when to use the .NET networking APIs contra the CocoaTouch HTTP classes. In the examples, the REST-based API calls are executed against Bing’s search API, making it feel like we are building something real. There are examples of having Bing return both XML (which is parsed with XmlDocument and LINQ-to-XML) and JSON (using System.Json). After walking through REST (being the preferred method whenever possible), we learn about Consuming SOAP-based Web Services using .NET 2.0 client proxies, followed by a section on WCF.

Chapter 10 was another great chapter, offering insights into the Bonjour networking services available on the iOS devices, including GameKit.

In chapter 11, we learn about the various storage APIs we have to our disposal, including SQLite, .NET serialisation against the file system and the application settings APIs.

As the final chapter, iPad Development tells us how to port our iPhone application to the iPad and which extra controls we have available on the bigger screen.

Summary

In summary, I found this book to be slightly harder to penetrate than the previous one I read, but on the flip side, I felt that this book contained more information. The book contains some highly valuable gems (ch 4, 7, 9, 10), which alone makes it worthwhile. As such, I can highly recommend it!

Book review: Professional iPhone Programming with MonoTouch and .NET/C#

The Professional iPhone Programming with MonoTouch and .NET/C# book, which was first released in 2010, is an excellent starting point for .NET developers wanting to wrap their head around the iOS-stack and really getting started with MonoTouch development.

To quote its introduction,

This book is for .NET developers that are interested in creating native iPhone applications written in .NET/C# … [and] is designed to help you get up to speed with the iPhone, not to really teach you about the .NET Framework or C# language, which we assume you already know.

Since the book presumes that you already know your .NET and C#, it quickly gets you where you want to be, starting you off with a brief product comparison (.NET Framework, Mono and MonoTouch), followed by a walk-through of MonoTouch’s major components and its top-level namespaces.

Chapter 2 introduces you to your prerequisites to start developing, i.e. which SDK:s you need to install in what order, an introduction to MonoDevelop and to Xcode. Now, seeing as the book is a couple of years old by now, you wouldn’t recognise yourself in Xcode (Interface Builder) after reading the introductory chapter. The concepts are the same, though, and the book does a very good job staying on such an altitude that I still feel that its a good read. After you’ve read the introductory chapter, you can supplement your newly acquired knowledge by reading my blog post on XCode and MonoDevelop from a Visual Studio developer’s point of view to get up to speed.

The succeeding two chapters deal with the iOS interfaces, patterns and controls in a digestible manner, showing a lot of code and its result. That goes to say for the entire book, really – it contains a near perfect mix of imagery and code, letting you enjoy the book even when you are far away from your computer. I read this book whilst away on vacation and felt that I learnt a lot without coding a single example during the length of the book.

Chapters 5 and 6 walks us through working with, and displaying, data, teaching us how to access the SQLite database system on the iPhone, connecting to various types of web services and then displaying this data in iPhone’s ubiquitous tables. Here, the author also brings up various strategies for upgrading your data storage during upgrades of your application.

After learning to work with data, chapter 7 introduces us to both iOS’ location and mapping libraries, followed by chapters on application settings, working with the device hardware and its multimedia capabilities.

Chapter 11 teaches us how to integrate with the existing software – such as initiating Skype calls – on the device and also how to integrate with third-party Objective-C libraries (yeah, MonoTouch allows you to do that too!).

Localizing for an International Audience (chapter 11), I found extra interesting as I had recently implemented localization into a Windows Phone 7 application framework and because localization is something often brought up in Sweden, where I live. Not only just showing off the available APIs, this chapter discusses the localization files’ format, various presentation concerns when internationalizing an application and how to utilize .NET’s excellent globalization features to format dates, times, numbers and currencies. After reading this chapter, I got inspired to create a translation community where developers everywhere to help each other localize their apps, simply by crowd-sourcing their localization files. The community is available at localizable.org.

In chapter 13, the book brings up device concerns and which extra controls are available when you are targeting the iPad. It also details how to interpret gestures and how to build an app that works on both the iPhone and the iPad (an universal app).

By this point, the authors hope that you are so comfortable with them, that you will not instantly push the book away on the thought of talking about Objective-C. Thus, chapter 14 attempts to give you just enough knowledge about the native programming APIs to be able to digest code examples found on the internet.

As you have fought your way through chapter 14, the final chapter of the book teaches you all about how the App Store works, and how you submit your apps to it. As a bonus feature, it also brings up how to promote your app, leaving your with a sense completeness.

Summary

I found the book very approachable and a good start for any .NET developer wanting to learn iOS development. It’s almost-perfect balance of descriptive text, code-examples and imagery explaining the concepts, makes it ideal to read away from your computer – for example when you commute, or on your vacation!

 Scroll to top