Skip to end of metadata
Go to start of metadata

Prior to creating iOS apps with Crosslight, it’s recommended that you get familiar with the iOS application development fundamentals such as the design patterns and the tools used to design the interface.

Crosslight 5 introduced full support for iOS 9. For more information, please see iOS 9 Support.

On this page:

Design Pattern

A design pattern is a tool of abstraction used in object-oriented software development as well as other fields. It is a template for a design that solves a general, recurring problem in a particular context. The iOS apps are typically built with the Model-View-Controller design pattern (commonly known as MVC).

The MVC pattern assigns objects in an app one of three roles: model, view, or controller. The pattern defines not only the roles objects play in the app, it defines the way objects communicate with each other. Each of the three types of objects is separated from the others by abstract boundaries and communicates with objects of the other types across those boundaries. The collection of objects of a certain MVC type in an app is sometimes referred to as a layer—for example, a model layer.

With Crosslight, the MVC design pattern is improved in many ways that allow both MVC and MVVM to work together in a perfect harmony. With the marriage of MVC and MVVM, you no longer write user interaction logic in the controller which tie your code to a vendor-specific technology such as iOS. Instead, you write user interaction logic in the ViewModel that allows your code to be reused in other mobile technologies that support MVVM such as Windows Phone and Windows Store Apps. More importantly, since ViewModel is platform-neutral in nature, it’s possible to reuse the ViewModel to other non-MVVM platforms – such as Android which was made possible through Crosslight for Android – as well as on other mobile platforms that may be supported in the future.

The following illustration shows the blend of MVC and MVVM design pattern in Crosslight.

To learn more about MVC, see MVC Overview in iOS Development. To learn more about MVVM, see Understanding Data Binding and MVVM Design Pattern.

Interface Builder

Building iOS apps with Crosslight is generally similar to building native iOS apps. You can build iOS interface through a number of supported development tools such as Apple's Xcode. In addition, starting with Crosslight 4 release, you can now build iOS interface directly within the Xamarin Studio designer, in both Mac and Windows, as well as in the Visual Studio 2013 or later through the Xamarin's extension.

Using Apple Xcode

If you come from the native iOS development background, you will be most likely design the iOS interface using Xcode, the software development tool from Apple which you can download free from the Mac App Store. The following screenshot shows the Xcode interface builder with the editor assistant and property inspector window opened.

Building iOS apps with Crosslight is fairly simpler and easier because you don’t write user interaction logic in the iOS controller. This means that most tasks you need to do with the interface builder is simply designing how you want the view elements to be laid out, configure their behaviors and appearance, and finally identify each view with a unique identifier. The unique identifier is the contract that Crosslight depends on to establish the binding between the ViewModel with the particular view element.

Creating a unique identifier for a view element is also known as the process of creating an outlet. You can easily create an outlet by dragging (and pressing CTRL key at the same time) from the view element onto the editor window, then type the desired identifier of the particular view.

To learn more about the basic concept of data binding, see Crosslight and MVVM at a Glance.

Using Xamarin iOS Storyboard Designer

In addition to Xcode, you can also design iOS interface from within Xamarin Studio, in both Mac and Windows version, as well as in Visual Studio 2013 or later through Xamarin's extension. However, Xamarin Studio only supports designing iOS interface for storyboards, not the individual interface file (.xib).

Starting with version 4, Crosslight supports iOS development using modern storyboards. As the result, you can now leverage Xamarin iOS Designer to build user interface for Crosslight iOS application.
The following illustration shows the Crosslight iOS development using Xamarin iOS Designer.

Building interface with Xamarin iOS Designer gives you a number of advantages:

  • More convenience and simple way to design iOS interface. Instead of working with different IDE, you simply open the storyboard and work from within a single IDE, Xamarin Studio.
  • Leverage iOS modern auto layout and universal design. Since iOS 8, Apple encourages developers to design interfaces that are optimized for different orientation and size, also known as universal design. This type of design is only supported in storyboard format.
  • Rich design-time experience. You can now find Crosslight iOS components in the toolbox and easily drop them to the designer surface. Then, you can easily set the properties and set the control name in the Name textbox – all within the property window.
  • Streamlined workflow. You will find that auto-generated code from Xamarin iOS Designer is faster and more reliable as the designer is built into Xamarin's own development environment. This allows you to rapidly edit the interface and run the application to see the result.
  • Design multiple interface. You can design multiple interfaces in a single storyboard, allowing you to easily overview the related interfaces, preview and edit them simultaneously in different size and orientation. Thanks to the loosely-coupled integration to Crosslight navigation framework, each view controller will be automatically mapped to the respective named interface in the storyboard.

To learn more about building Crosslight iOS storyboard interface using Xamarin iOS Designer, please see Working with iOS Universal Storyboards.

Supported IDE

Crosslight supports iOS development in both Mac and Windows through a number of supported development environments. Since Crosslight is building on Xamarin technologies, you use Xamarin Studio to build iOS apps on the Mac and Windows. In addition, Xamarin also ships with Visual Studio 2012 support which means that you can use Visual Studio 2012 on Windows to build iOS apps. However, you still need a Mac to run and test iOS apps. For more information, see Preparing Your Development Environment.

Note that Xamarin platforms are licensed separately from Crosslight. Please see the Licensing section for more information.

In general, the iOS projects created in Visual Studio are fully compatible with Xamarin Studio and vice versa. This allows you to work with iOS projects from the preferred development environments or switching between Mac and Windows without losing the changes made in the project. Since the same iOS project file is accessed directly in these IDEs, the changes are synchronized in real-time. This avoids the complexity to create multiple projects that were linked through external tools.

Crosslight ships with shim assemblies that fix the missing .NET classes from the Xamarin runtime on the Mac. This makes it possible to unify the project references that allow iOS projects to be shared across different IDEs and operating system.

To streamline the build process for iOS apps in Xamarin Studio on the Mac, copy the System.Windows assembly from the Crosslight iOS library to the Mono framework folder typically located in the /Developer/MonoTouch/usr/lib/mono/2.1 folder. Note that this process is not required in Xamarin Studio on Windows.

Update: This process is no longer required starting with Xamarin Studio 4.2 release since Portable Class Library (PCL) has been officially supported in Xamarin platforms.

The choice of IDE is vary depending on your cross-platform projects. For examples, if your apps are targeting only iOS and Android platforms, then it makes sense to centralize all your development processes with Xamarin Studio on the Mac. However, if your apps include Windows mobile platforms, or if you have been accustomed to Visual Studio, you might opt to use Visual Studio as your main development environment.

Again, keep in mind that even though you can compile iOS apps in Visual Studio, you will still need to use Xcode on the Mac to design the interface for iOS apps. In addition, testing iOS apps in Visual Studio will also require a tethering to a Mac which can be easily configured through Xamarin Studio’s Build Agent setup. For more information, see Introduction to Xamarin.iOS for Visual Studio.

The screenshot below shows the iOS development using Xamarin Studio on the Mac.

The screenshot below shows the iOS development using Visual Studio 2012 on Windows.

Visit Xamarin Studio and Visual Studio website to learn more about the features available in both IDEs respectively.