Porting iOS* Apps to Windows* 8 - Overview

Download Article

Download Porting iOS* Apps to Windows* 8 - Overview [PDF 841KB]

Objective

Developers looking to port their existing iOS* apps to the new Windows* 8 platform face several challenges. In this article we will provide an overview of the differences between the two platforms and show developers how to go about porting their apps.  We will compare developer tools in both platforms and provide an overview of app framework differences.  We will discuss basic app creation, packaging, and app store differences. Fundamental app concepts like UI and input handling will be discussed. This article will serve as a foundation for other articles that delve into more advanced topics in porting iOS apps to Windows 8.

Table of Contents

  1. Introduction
  2. Development Environment and Tools
  3. iOS Apps vs. Windows 8 Apps Overview
  4. App UI and Input Handling
  5. Summary

1. Introduction

Windows 8 is a major revision for one of the predominant desktop OSs in the industry. From a developer’s point of view, it brings major changes to the way Windows applications are developed, designed, and built. It is redesigned and reimagined from the ground up to support new user experiences and to take advantage of all the capabilities of modern mobile devices like tablets and UltraBook™ devices.

With the introduction of new form factor devices like smartphones and tablets, more and more software is being targeted for these platforms. Currently there are hundreds of thousands of apps in iOS and other mobile ecosystem stores. 

Developers who already have an existing iOS app might want to consider targeting the new Windows 8 OS. These two OSs, their apps, and development environments, one might argue, are radically different. But at a higher level they also have some common features like support for touch, sensors, mobility, and other hardware features. There are lot of benefits and opportunities in developing for Windows 8. In this article, we will give an overview of differences and cover the basics of porting iOS apps to Windows 8.

We can broadly classify the porting challenges into development environment and tools, app framework differences, and the overall OS/ecosystem differences.

Below are few basic snapshots of how iOS and Windows 8 OS look and differ:



Figure 1: iOS* “Home Screen” (Photo Source: www.apple.com/iphone)



Figure 2: Windows* 8 Home Screen (captured from Simulator)

As seen in these two screen shots, the two OSs differ dramatically. The new Windows 8 UI removes all non-app related notifications from the main screen (like the notification bar at the top and other icons). You will notice new Windows 8 apps focus on content and remove the chrome of traditional app UI as much as possible. Also, while iOS features application icons, Windows 8 introduced a unique UI feature called tiles where each app on the home screen represents a box or a window resembling tiles. The content of these tiles can be dynamically updated by the owning app with app-relevant data or information, and are hence referred to as “live tiles.”

We will go into other details shortly, but these are some of the basic and important UI differences.

2. Development Environment and Tools

When considering porting an app from one platform to another, one important area developers must consider is developer tools and programming environment. The current industry trend in this area is to provide an integrated development experience as much as possible. Companies try to provide tools for all stages of development—coding, debugging, testing, building, packing the apps, and even uploading the apps to stores.

Developers coming from the iOS platform and looking to port their apps to Windows 8 will find that the programming environment and development tools in Windows 8 are comprehensive and powerful. While Apple requires a purchased developer license to deploy applications written in the XCode* IDE, this is not the case with Windows 8.  Local packages can be created in the Visual Studio* 2012 IDE for device testing. But like Apple, Microsoft requires a purchased license for deploying apps to the Windows Store.  The following screen shot from the Visual Studio IDE shows the deployment options:



Figure 3: Windows* 8 App Deployment (captured from VS IDE)

In Windows 8, developers can choose their programming language of preference. Multiple programming languages are supported: C++, C#, Visual Basic*, and JavaScript*/HTML5. All of these programming languages are first-class citizens, meaning they all have access to full system capabilities and use the same common Windows 8 API (Windows Runtime).

Another important area is the integrated development environment (IDE). While iOS developers use XCode, Windows 8 developers use Visual Studio 2012, which has been updated to support the new Windows 8 platform. Blend for Visual Studio 2012 will assist in Window 8 app UI (XAML based) interactive design and testing.  Blend also supports HTML5 apps UI design and CSS3 styling. These tools can be downloaded from the website below:

http://msdn.microsoft.com/en-us/library/windows/apps/hh974577.aspx

Use Visual Studio 2012 with Windows 8 for Windows Store app development, as the new apps depend on the Windows 8 platform and APIs.

Similar to default project templates for apps available in iOS, Visual Studio 2012 comes with templates for different kinds of Windows 8 apps and programming languages.

The screen shots below show the templates for JavaScript and C++:



Figure 4: JavaScript* Project Templates (captured from Visual Studio* 2012)



Figure 5: Visual C++* Project Templates (captured from Visual Studio* 2012)

Visual C#* and Visual Basic have similar project templates too.

iOS developers wanting to fully rewrite their apps for Windows 8 might want to consider using one of the above project templates as a baseline for their apps.

Windows 8 has a powerful UI design tool—Blend for Visual Studio 2012. It is fully integrated into the Visual Studio IDE and makes the development life cycle as simple as possible. Blend can be directly invoked from inside the VS 2012 IDE. Blend has support for both XAML-based UI design as well as the HTML5/CSS3 apps.

Below is a screen shot of Blend showing the "Split App (XAML)" template choice for Visual C#:



Figure 6: XAML-based UI editing (captured from Blend for Visual Studio*)

Blend is a very powerful and comprehensive UI design tool. It supports interactive UI editing/design and quick testing. For example, in Blend for HTML5/CSS3 apps, we can edit the HTML DOM and CSS3 styling live and immediately see the result. This is very powerful for trying out different styling properties, layouts, or themes.

Below is a screen shot of Blend used in designing a HTML5/CSS3 app:



Figure 7: HTML5/CSS3 UI editing (captured from Blend for Visual Studio*)

Blend for Visual Studio 2012 has powerful testing tools for different display sizes and views.

The next screen shot illustrates how developers can test their Windows 8 apps for different views and screen sizes supported by the Windows 8 platform:



Figure 8: Different Device Views and Display Target Settings (captured from Blend for Visual Studio*)

Another developer tool that is common in modern app development is the emulator or simulator. iOS has the iOS device emulator with support for different configurations through XCode, such as whether an app supports both iPad* and iPhone* or just one. Windows 8 has a powerful simulator that is fully integrated with Visual Studio 2012 IDE and an app development life cycle. It simulates several of the common platform features like touch, geo-location, camera, device orientation, and different form factors and screen sizes.

Windows 8 simulator can be invoked directly from VS 2012 IDE. The screen shot below shows simulator capabilities and features:



Figure 9: Windows* 8 Simulator buttons and display options (captured from Windows 8 Simulator)

We also need a way to test our app on a real device. In XCode we can select "iOS Device" from the appropriate IDE dropdown menu. Windows 8 apps can be tested on remote devices using the Remote Debugging Tools for Visual Studio. We will need to install the remote tools on the target device and configure them before we can use it with Visual Studio remote debugging. This web site provides a comprehensive guide to running Windows Store apps on a remote machine:

http://msdn.microsoft.com/en-us/library/hh441469.aspx

In Visual Studio, we can choose our target of choice for debugging: Simulator, Local Machine, or Remote Machine. The next screen shot shows these Debug options in Visual Studio 2012:



Figure 10: Debug Target options (captured from Visual Studio* 2012)

Another important development environment topic is that of app building, packaging, and app stores. In iOS, XCode integrates and automates the process of building, signing, and packaging the apps by using the developer's trusted key certificate. Similarly, Windows 8 provides comprehensive support for the entire app development life cycle from developing, building, signing/certificates, packaging, and direct integration with the Windows Store.

The table below provides a summary of the different topics we discussed in this section (please note it is not comprehensive so it may not have all of the details).

Feature iOS* Windows* 8

IDE

XCode*

Visual Studio* 2012, Blend for VS 2012

Programming Environment

Objective C*, Cocoa* Application, Cocoa-AppleScript* Application, C/C++ Library, STL C++, OpenGL ES*, Quartz 2D*

C++, C#, Visual Basic*, XAML, JavaScript*/HTML5, DirectX*

SDK

iPhone*/iPad* SDK, Cocoa* Touch APIs, Quartz*, OpenAL*, Core Animation*, etc.

Windows 8 Runtime APIs, Windows Services APIs such as Bing SDK, etc.

Debugger

GDB, LLDB*

Visual Studio Debugging Tools. Depends on programming language and APIs – JavaScript debugging, Managed Code debugging, DirectX debugging, etc.

Device Emulator

iOS Simulator

Windows 8 Simulator

Device Access & remote debug

GDB Debugging via XCode, Remote Debug currently not supported as of XCode 4

Visual Studio Remote Debugger Tools

Testing

Use different emulator / device configurations with XCode GDB, design, software unit testing

Windows 8 Simulator, Expression Blend* for quick interactive UI design and testing, software unit testing

App Packaging

XCode archive file with the app, property list file, resources, and other files

APPX archive file with the app, package manifest, resources, and other files

Store

Apple Store

Windows Store

3. iOS Apps vs. Windows 8 Apps Overview

To port apps from iOS to Windows 8, we need to study the differences between these two platforms. These two platforms have totally different application stacks—from the low level app interactions with the OS, to the highest abstractions like the UI.

Before we delve into the details, we need to note one important caveat—Windows 8 supports two types of applications: the new Windows 8 apps (called “Windows Store apps”) and the traditional Windows applications (“Desktop apps”).

Existing desktop applications continue to work and behave the same on Windows 8. However, existing desktop applications can now take advantage of new features like touch, sensors, and other new Windows 8 features. But some of the new Windows 8 features, like live tiles, the new app life cycle, security sandbox, etc., might not be available in desktop apps.

The web page below provides an overview of the new Windows Store apps:

http://msdn.microsoft.com/en-us/library/windows/apps/hh974576.aspx

At a higher level, iOS apps can be composed of three important pieces:

  • Application components (Views, Services, Content Providers)
  • Property list file (defines bundle configuration, XML structures, identifiers, etc.)
  • Application resources (images, media, language strings, locale support, resources for different device types, etc.)

Windows Store apps also have similar pieces, though they may not map exactly to iOS pieces:

  • Different application components like the main app component, app contracts, extensions, background tasks, notifications/tiles, etc.
  • Package manifest for the app (defines package identity, properties, capabilities/permissions, extensions, visual elements, etc.)
  • App resources and localization (Package Resource Index PRI file, all app resources are indexed and associated) 

The screen shot below shows the capabilities and available declarations in the Windows 8 Package Manifest of a sample app:



Figure 11: Package Manifest – capabilities (left) and declarations (right) (captured from Visual Studio* 2012)

Both Apple and Windows Store apps have a well-defined app life cycle, or different states the app goes through from start to end. The link below provides an overview of the app life cycle of Windows Store apps:

http://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx

Similar to iOS, Windows 8 supports different views for the app—portrait mode, landscape mode, different screen sizes, etc. In addition to these, Windows 8 supports two more views not available on iOS: “Snap View” and “Filled View.”

The screen shot below shows a Windows 8 app in four different views: landscape, portrait, snapped view (bottom left, Windows Store app is in filled view), filled view (bottom right, Windows Store app is in snapped view).



Figure 12: Sample Windows* 8 App in different views (captured from Windows 8 Simulator)

For guidelines on how to design for snapped and fill views, please refer to:

http://msdn.microsoft.com/en-us/library/windows/apps/hh465371.aspx

Another important difference is the common app controls and UI surfaces. iOS has various bars for completing various tasks, including navigation bar, search bar, and so on.  For Windows 8, the app bar is the primary command interface for Windows Store apps. Similar to the “Navigation Bar” in iOS, we can use it for navigation and other app actions. By default the app bar is hidden in Windows 8 apps; it can be invoked by a Windows 8 swipe gesture. Its behavior can be customized as needed (e.g., always stay active, dismiss on touch, etc.). The next screen shot shows an app bar in action in a Windows 8 Internet Explorer* app:



Figure 13: App bar in Internet Explorer* 10 (captured from Windows* 8 Internet Explorer)

The app bar can be at the bottom, the top, or both. It can be invoked by a swipe gesture either from the top or bottom of the screen. With keyboard-mouse input, it can be invoked by right clicking inside the app.

Charms are a unique feature in Windows 8 apps. They are a specific, common set of buttons always shown in every app when charms are invoked (again, by the swipe gesture). The buttons are: Search, Share, Start button, Connect to Devices, and Settings.

The next screen shot shows the Charms bar, invoked inside a Windows Store app:



Figure 14: Charms bar in Store App (captured from Windows* 8 Store)

The Charms bar is usually positioned on the right-hand side of the screen and invoked by a swipe gesture from the right side of the device.

Another area of difference is obviously the programming languages and platform APIs. Since iOS apps utilize the Objective C programming language, porting apps to Windows 8 requires rewriting the app code using one of the Windows 8 programming languages.  Depending on the app features, requirements, and capabilities, Windows 8 may have equivalent platform APIs available that developers can use. For example, the touch and sensor functionality can be ported by using the equivalent Windows 8 APIs. Please visit this site for a comprehensive API reference for Windows Store apps:

http://msdn.microsoft.com/en-us/library/windows/apps/br211369

In this section, we provided an overview of different areas of porting challenges that iOS developers face when converting their apps to the Windows 8 platform. As we have seen, many high level app concepts overlap. Developers can map their app design and logic to corresponding or equivalent patterns in Windows 8. Sometimes the conversion might not exactly map because that feature is not available or it is implemented in a totally different pattern. For example, the iOS Storyboard allows developers to drag in a "DatePicker" (calendar) object into the app design.  While developers can drag in a similar object when developing Java apps for Windows 8, this isn’t the case for C# apps; developers would need to create a custom date picker.

 You can find a nice method for building a date picker for C# by referring to this blog: http://software.intel.com/en-us/blogs/2012/12/14/how-to-make-a-date-picker-calendar-for-c-sharp-in-windows-8

In these cases, a rewrite of that particular feature/component needs to be considered. Further, the apps can be enhanced to take advantage of the unique features of Windows 8 like live tiles, new kinds of app views, etc. This will help provide the best user experience for your app on Windows 8.

4. App UI and Input Handling

The previous section provided overall conceptual differences between iOS apps and Windows 8 apps. In this section, we will build on that and cover how to port one of the first and basic pieces of any app: UI and Input Handling.

In Windows 8, an app’s UI can be built in a few different ways:

  • Using XAML with C++/C#/VB
  • Using HTML5/CSS3 with JavaScript
  • Direct graphics interface using DirectX/C++ (some XAML can be mixed here)
  • Desktop apps UI

Developers should carefully consider different aspects of the target app when picking one of these choices. It depends on app requirements and planning for future extensibility and reuse. For example, if the existing app uses a lot of web-based UI content or already has significant HTML code, developers should probably use JavaScript/HTML5. On the other hand, if the app requires heavy graphics and full GPU control, consider DirectX/C++. As noted previously, all programming languages have the same access to all the system capabilities (via common Windows 8 Runtime API).

Apps that require desktop features, with several UI controls and chrome, may be more suitable for a Desktop app model.

Once we pick our programming environment of choice, we can proceed to look at other UI aspects like window management, views handling, event handling, styling, UI controls, animations, etc. These differ quite a bit depending on the underlying environment. For example, HTML5 apps have their own event handling patterns (as defined by HTML DOM standards and web practices) and styling capabilities (CSS3).

In iOS apps, the UI of a typical app consists of multiple "View" components, with "Segues" in between that host “View” and “GroupView” objects that implement the UI elements like buttons and layouts. The UI life cycle, back stack, input, and event handling all are taken care of by this framework. Windows 8 has a very powerful UI framework and programming mode that has common system-wide UI concepts:

  • Common design style – typography, layouts, navigation, animations
  • Touch interaction – well-defined, system-wide touch gestures, with new features like semantic zoom
  • Snapping and scaling – support for new views and different screen layouts and sizes
  • Common UI controls – e.g., buttons, list view, app bar, charms, settings, etc.
  • Tiles and notifications

A comprehensive discussion about UI for Windows Store apps can be found at the link below:

http://msdn.microsoft.com/en-us/library/windows/apps/hh779072.aspx

It is strongly recommended for developers to take advantage of Blend for Visual Studio 2012 to design UI for Windows 8 apps. Blend supports both XAML-based UI design, as well as HTML5/CSS3 UI design. It has comprehensive tooling and design support and allows for interactive and quick UI verification/testing.

Developers will also need to make design choices for how to best take advantage of all the UI features and capabilities offered by Windows 8. The article below titled “Design case study: iPad* to Windows Store app” covers some of the UI design choices we need to consider when porting apps from other platforms:

http://msdn.microsoft.com/en-us/library/windows/apps/hh868262

For a full step-by-step dive into the details of Windows 8 touch code (C#), take a look at this article titled "Enabling Touch in Windows 8* Style UI Apps with C#":

http://software.intel.com/en-us/articles/enabling-touch-in-windows-8-metro-style-apps-with-c

The article starts with touch basics and also covers more complex touch scenarios (such as custom manipulations).  The article is suitable for all levels of platform porting.

5. Summary

Porting apps from iOS to Windows 8 takes a lot of planning and effort. The porting process can be simplified and more efficient, if we fully understand how iOS platform’s features and capabilities compare to the ones available in Windows 8. If developers conceptually map their app logic and design to equivalent features in Windows 8, they will be able to achieve the best possible port.

In this article we provided an overview of differences between the two platforms and discussed how iOS platform features compare or translate to Windows 8. We covered the basics like development tools, programming environment, platform and framework differences, and UI concepts.  We hope this article will serve as a foundation for future articles that delve into more advanced and in-depth topics.

*Other names and brands may be claimed as the property of others.

Copyright © 2012 Intel Corporation. All rights reserved.

OpenGL is a registered trademark and the OpenGL ES logo is a trademark of Silicon Graphics Inc. used by permission by Khronos.

Etiquetas:
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.