Share via


Porting iOS Apps to Windows 8 (1) : Introducing Windows 8 Platform to iOS App Developers

Author: Rafe Wu

 

Channel 9 https://channel9.msdn.com/Blogs/OneCode/How-to-Port-iOS-apps-to-Windows-Store-apps

About this Development Guide

If you are iOS developer and interested in building your first applications for Windows 8, this guide is designed for you.

The guide covers what you need to know to add Windows 8 development to your skill set, while leveraging what you have already learned building iOS apps. After learning this guide, you will know the same and the difference between these two platforms and the best replacement when you port certain features to Windows Store applications.

Target Audience

This document is for iOS app developers who are looking for opportunities to develop or port their apps for Windows 8.

Conventions Used in this Document

Term

Abbreviation

Windows 8

Win8

Application Programming Interface

API

Integrated Development Environment 

IDE

Visual Studio 2012

VS2012

Windows Runtime

WinRT

 

1. Introducing Windows 8 Platform to iOS App Developers

Windows 8 introduces a new type of application: the Windows Store app. Windows Store applications have a brand new look and feel, run on a variety of devices, and you sell them on the Windows Store.

Microsoft provides powerful development tools, detailed documents and comprehensive samples to help designers and developers to develop Windows Store applications more quickly and easily. In this guide, we focus on how to leverage the skillset of the iOS apps development to build the Windows Store application. 

To learn more about the business opportunity of Windows 8, see Selling apps. For more info about the features used to build Windows Store applications, see the Windows 8 Product Guide for Developers.

 

The Developer Tools

Microsoft has released a great set of tools for Windows Store application development. The toolset includes:

  • ·         An IDE (for developers): Visual Studio 2012 (VS2012)
  • ·         A user interface design tool (for designers): Blend for Visual Studio 2012
  • ·         Libraries: Windows Runtime (WinRT), DirectX
  • ·         Simulator for tablet to test and debug applications

The tools are designed to let you develop Windows Store consumer applications and games.

Programming architecture 

Windows Store programing model utilizes a layered architecture as shown below.

 

The bottom layer is the windows core that provides the driver level support. The upper layer is the Windows Runtime core that is an extensive library that supersedes much of the Win32 APIs. It provides new object-oriented API sets and new features that Win32 APIs do not provide. We can divide the WinRT APIs into multiple namespaces, for example, UI, Storage, Network, Media and etc.

A WinRT component provides a full set of metadata to expose the namespaces of the WinRT. The metadata format is pretty much the same as a .NET reference assembly (Ecma-335). The metadata describes the code written for the WinRT platform. It defines a programming model that makes it possible to write object-oriented code that can be shared across programming languages.

Language projection is a way that exposes native APIs to three different types of language: Native language (C/C++), managed language ( C#/VB.NET), as well as Html5 and JavaScript.

Besides WinRT APIs, Windows Store app also supports a subset of Win32 APIs. You can check which Win32 APIs are supported by Windows Store app from Win32 and COM for Windows Store applications. If the application is written by managed code, a subset of .Net Framework is also supported. .NET for Windows Store applications provides the supported .Net APIs from Windows Store application.

Comparing the Programming Stack of Windows 8 with iOS

This table gives an overview of the Windows Store UI frameworks that provide features comparable to the iOS programming layers.

 

iOS Frameworks

Functionality

Windows Store UI Frameworks

Cocoa Touch

Expose required APIs for applications

Windows Runtime (WinRT) projection

Media

.Net for Windows Store App

Core Services

Provide reusable system level functionalities and resources.

Windows Runtime Library

DirectX(2D, 3D) engine

 

Language execution engine

Common Language Runtime (Managed code only)

Core OS

Operating System

Windows NT Kernel

iOS and Windows 8 are built on different Operating System kernels. They are different but totally transparent to the developer.

Some of managed languages like C# and VB.NET used by Windows 8 developers requires a language execution engine. In Windows 8, it is Common Language Runtime which is a Just-In-time compilation engine. Unlike C# and VB.NET, programming language, Objective-C, doesn’t require an execution engine. It can be executed directly on the device.

Core Services layer in iOS provides the fundamental system services that all applications use. In windows 8 platform, Windows runtime library plays the same role. It’s also native and reusable. If you want to develop games, DirectX engine is the replacement of OpenGL ES library.

Cocoa Touch and Media layers are key frameworks for building iOS apps.For Windows Store applications, APIs are exposed by Windows Runtime library. We just use WinRT projection to bind them into the different languages. If you are writing code in managed language, you can also use a subset of .Net libraries for Windows Store app.

Comparing the Programming Language of Windows 8 with iOS

This table compares the programming languages of iOS and Windows 8.

iOS Apps

Windows Store Application

Objective-C

C#/VB, C++/CX, HTML5+JavaScript

In iOS, you have to use Object-C to create apps.

However, you have 3 different languages available to create Windows Store applications. They are C# or VB.NET, C++/CX, HTML5/JavaScript. There isn’t an convienient way to convert Objective-C source code into any of the languages that are supported by Windows 8.

 

Please note, in Win8 platform, C++ becomes the first class language. We can write UI and business logic in C++. But in practice, we just use it to write custom WinRT components instead of applications.

Summary

In this chapter, we look into the Windows Store UI and the iOS programming stacks. Now that you understand the high-level programming architectures for these two platforms, we are now going to go one level deeper. In the next section, we will look into the user interface guidelines of Windows Store applications.

 

See also: Porting iOS Apps to Windows 8 (2) : User Interface

Comments

  • Anonymous
    February 06, 2013
    States above that "In iOS, you have to use Object-C to create apps".  This is false.  Objective-C is the popular choice, but you can actually use other languages to build iOS apps.