Freigeben über


Getting started with Project Islandwood

Update: The Project Islandwood repo on GitHub (aka "Windows Bridge for iOS") has been updated to support iOS storyboards. This greatly simplifies the little tutorial in this blog post. Simply create a single view app, add some buttons and labels, and save it. Then use the vsimporter.exe tool to convert the project (storyboard and all!) into a Visual Studio solution. No need to strip out the storyboards and add ViewControllers! I told you they were making great progress :-) See this blog post on how I ported an openGL game using a Virtual Machine on my Mac!

 

If you are an iOS developer, the Windows ecosystem can appear a strange and frightening place. Writing an app for Windows requires an investment in all kinds of new things: new tools (Visual Studio), new languages (C#), new APIs and Controls (Win32, XAML), new graphics engines (DirectX) and before you know it, life seems too short and wouldn't another Flappy Birds clone be more fun anyway?

 Fear not, brave adventurer, for Project Islandwood is here.

 

 There are many different ways to make projects work in a cross-platform way. You could, for example, create some type of mimicking run-time, and run the same binary file on that. That's not easy, as although your app might still look like a native app, it would be running on a non-IOS platform and that of cognitive dissonance can be unsettling. And you don't get to take advantage of any unique Windows features. And you have to worry about code-signing, updates, subtle platform differences and so and so forth.

 Alternatively, you could write some kind of intermediate tool based on, say, JavaScript and HTML5, and provide run-time wrappers for different platforms. That would work, but JavaScript is not everyone's favorite programming language, and you need to keep the wrappers updated for every platform. And you've immediately gone to the lowest common denominator of every platform (a web browser), thus missing out on potentially cool features.

 Or, and this is kind of mind-blowing, you could do what the Project Islandwood team have done, and create a conversion tool that loads an Xcode project (complete with assets and Objective-C files), and changes it into a Visual Studio solution that can be edited, built and deployed to Windows as a proper Windows app. More amazingly, this tool doesn't try to convert your source code to C# or JavaScript: the app is in Objective-C and it WILL ALWAYS BE IN OBJECTIVE-C. Yes, you can edit and build and deploy your code from Visual Studio to Windows. Yes, Windows is compiling Objective-C.

 Project Islandwood is under active development (see this blog posting) and there is still much to be done, but you might be surprised just how much works today. Here's a walkthrough that will create an Xcode project (in Xcode 7.1), convert it, and run the same app on a PC Windows 10. The tools to do this are all free, by the way. All you need is a Windows PC (or virtual PC running on Parallels, Fusion, Bootcamp etc.). In fact, the Islandwood team have promised that they'll have Virtual Machine images available to download to simplify this process even more.

 To set some expectations, I wouldn't think of this as a way to continue major development on the PC side - there is no good way to edit the ViewControllers once they have been converted into XML for example -  think of it more as a "Ok, I need to get this Windows version of this project kicked off, and this tool will get the grunt work done for me". 

You will need.. 

 

If you want to try out Project Islandwood for yourself by following this little tutorials, you'll need these tools:

*  A Mac running the current version of Xcode.

* A PC (or a virtual PC) running Windows 10.

* A copy of Visual Studio 2015, including the Windows 10 SDK (the Community edition of Visual Studio is fine - and it's free)

* A copy of the project Islandwood tools, downloaded from GitHub. 

I recommend that you install Visual Studio and test it first. If you can create and compile an empty Blank App (Universal Windows) app, then you are good to go.

 

 Creating a suitable Xcode Project

Here's how to create a Windows app from an iOS app. It's hard to believe, but the trickiest part of this process is creating a suitable Xcode project. Why? Because the current version of Islandwood does not support storyboards, and as you know, storyboards are now such a fundamental way of writing iOS apps that Xcode doesn't even offer the option to create a new project without them. However, we can go back to the good old days of Xcode 5 and .XIB files by butchering an existing project. Here's how I did it.

1. Create a new Xcode project, based on an iOS Single View application.

2. Set the language to Objective-C. I select iPad as my target.

3. Delete the following files from your Xcode project:

* Main.Storyboard

* LaunchScreen.Storyboard

* ViewController.m

* ViewContoller.h

 

4. Open info.plist, and delete the following references:

* Launch screen interface file base name

* Main storyboard file base name

 

5. From File > New > File, create a new Cocoa Touch Class, of type UIViewController, and name it ViewController. Make sure to check the Also create XIB file option.

 

6. In the Project target settings, delete any value for MainInterface. It needs to be blank.

7. Edit the AppDelegate.h and .m files, changing them to:

 

 

 

This should be enough to get a blank app working in the Simulator. 

 You should now try adding a UILabel and some UIButton so our app actually does something (although it's probably still no Flappy Birds).

 

 Making a Visual Studio Solution 

Now that we have a working Xcode project, we can convert it to a Windows solution.

 

1. Copy the entire project folder over to your Windows PC (real or virtual).

2. Open a Command Prompt, and navigate to the folder containing your Xcode project.

3. Start the vsimporter.exe app (from inside WinObjC/bin folder you obtained from GitHub). 

For example, enter something like:

../../winobject/bin/vsimporter.exe 

4. Watch in amazement as the new Visual Studio project is created. 

It will be named <Xcode project name>-WinStore 10.sln

5. Double-click on the .sln file, to open Visual Studio and your new solution.

6. Once opened, right-click on project in the Solution Explorer view on the right, and select Set as Startup Project.

7. With Debug, Win32 and Local Machine set, click the build-and-run button (the green arrow).

8. Your app should now run as a Windows app!

 

 What's next?

 

The Project Islandwood folks have promised all sorts of improvements as the project evolves. At the moment, the number of iOS frameworks supported is limited, so only simple apps can be ported automatically. Storyboards are also an important omission. If you're using 3rd party graphics or physics engines that are mostly C++ / Objective-C you might be in luck, but I was blocked by a lack of SpriteKit and other frameworks from porting some of my more interesting apps.

 But, that said, work is progressing. The team is even looking for iOS devs to provide them some sample .IPA files so they can analyze them and help create a useful tool for provide a pre-conversion checklist. And the team would welcome your input via the GitHub site.

 

 

 

- John Kennedy, Content Developer.

Comments

  • Anonymous
    December 01, 2015
    Didnt understood much,but looks nice.

  • Anonymous
    December 01, 2015
    Please adapt this for swift!

  • Anonymous
    December 01, 2015
    Can you do this with Android apps too? Because the current project Astoria (Android emulator on Windows) is stopped.

  • Anonymous
    December 01, 2015
    Why copy Android apps when all the same apps are on ios.. One conversion is sufficient

  • Anonymous
    December 01, 2015
    Much Happy if IOS developers shows some interest.....:P

  • Anonymous
    December 01, 2015
    u doesn't just need a PC with Windows 10, you need a PC with Windows 10 Pro to develop for normal Windows 10 and thats a $200 in US & more in Outside-US. that's the reason i'm still stuck with my apps for W10 thats needs just hyper-V to test them in Emulators for different device configs., but that just a Windows 10 Pro exclusive & not even atleast available as a Standalone app that we can buy.

  • Anonymous
    December 01, 2015
    The comment has been removed

  • Anonymous
    December 02, 2015
    Sunil - you don't need Pro to develop. It's nice to have the extra features, and HyperV helps and is required for Mobile dev, but not for this project. And the upgrade to Pro is about half that price last time I checked. Clearly the don't remember the days when we had to all pay for Windows AND Visual Studio too!

  • Anonymous
    December 02, 2015
    Bob: a plug-in for Xcode would be interesting, but are there any non-Windows tools that can compile code that can run on Windows? Even the cross-platform Unity creates a Visual Studio solution, rather than trying to make and sign Windows binaries..

  • Anonymous
    December 05, 2015
    @grantm. i have already bought a VS 2013 Profesional & a developer account for WP in early days of WP8, as i owns a WP8 device and wants to develop for it as for its apps situation & for the necessary/basic things i needed in a smartphone, but it already had gine over the budget without knowing about that hyper-v thing & now i couldn't go with it. And did you want developers to develop just desktop apps, as you considered hyper-v as a extra feature. & it costs $200 for a W10 Pro license.