Many months ago Microsoft announced their intention to enable iOS developers to use their Objective-C code inside a Windows 10 application using a tool dubbed Project Islandwood. News of the tool's progress was quiet for a few months, but back in August, Microsoft released the opensource project to GitHub as the Windows Bridge for iOS. I was curious to try out this tool to see how well it worked, what the projects looked like, and experience the novelty of looking at Objective-C code in Visual Studio. I spent some time playing with it, here are my experiences working with it.



islandwood

Requirements for Using Project Islandwood



There are a few requirements that you need to meet before you can test out the bridge. On the PC side, you'll need:
  • Windows 10

  • Visual Studio 2015

  • Windows 10 SDK

  • A copy of the Windows Bridge for iOS project (available here on GitHub).

  • In Visual Studio, make sure that Visual C++ and the Universal Windows App development Tools components are installed.

  • You'll need a Mac with the most recent version of Xcode to create an initial project in Objective-C or have a preexisting Xcode project to import.

Once all of those requirements are met, you can start importing Xcode projects into Visual Studio.

Testing Out the Windows Bridge for iOS



Once I had installed everything, I tried to migrate a few different projects that I had previously created in Xcode. The steps for this process were as follows:


  1. Copy the entire project folder over to your PC

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

  3. Run the vsimporter.exe app (which should be in the winobc\bin folder inside the GitHub Download)

  4. This creates a Visual Studio solution called <Xcode project name>-WinStore 10.sln

  5. Open the .sln file to open your solution in Visual Studio

  6. From here, you should be able to build and run your imported project.



First, I tried simply converting one of the Xuni 101 projects to see if I had any luck with the importer. Perhaps not surprisingly, since Xuni is separate framework, this didn't work.

XuniFrameworksMissing

The case for most third-party frameworks indicates that they'd each need their own specific conversion to work with Project Islandwood. Many of Apple's built-in frameworks (such as UIKit) have already been provided by Microsoft, so importing a project that only relies on these already-converted frameworks should work. To this end, I imported my recent custom checkbox example which is only dependent on UIKit. I had some more luck getting a primitive version of this to run.

CheckboxSuccess

Debugging and editing the Objective-C files was easy in Visual Studio (if a little strange-feeling), and I was able to set breakpoints and view the call stack. The project structure was still familiar enough that I was able to navigate inside the project without too much issue.

Microsoft also allows you to use its XAML controls in Objective-C provided you import "UWP/WindowsUIXamlControls.h" in your viewController. I tried adding a slider control to my viewController, and I found it to be a relatively painless process. Essentially you're able to create the XAML control in Objective-C (WXCSlider for my example), configure and style it (including creating a callback for any events you might want to capture), create a UIView where you want your control to be placed, and then call the setNativeElement method to add your XAML control to your UIView.


WXCSlider *slider = [WXCSlider create];
slider.requestedTheme = WXApplicationThemeDark;
slider.minimum = 0.0;
slider.maximum = 100.0;
slider.value = 25.0;
slider.smallChange = 5.0;
slider.largeChange = 20.0;
[slider addValueChangedEvent:^ (RTObject *sender, WUXCPRangeBaseValueChangedEventArgs * e){
sliderLabel.text = [NSString stringWithFormat:@"Slider value %.0f", e.newValue];
}];
UIView *sliderView = [[UIView alloc]initWithFrame:CGRectMake(10, 200, 250, 50)];
[sliderView setNativeElement:slider];


SliderAdded

The tool does seem somewhat limited at the moment, and looks most useful for converting projects that are relatively simple and don't have many dependencies on other frameworks. Also, there's no support for converting Swift code at the moment which may put a damper on the tool for many.

The Future of Project Islandwood



Microsoft promises to continue to add new features to the Windows Bridge for iOS so that it's more compatible and feature complete. It does present an interesting opportunity for developers to quickly bring their iOS applications to UWP, but only time will tell how popular the tool becomes. As for Xuni, it's more likely that we'll explore a different path using Xamarin to create UWP applications in the future. It's an impressive piece of technology if nothing else, and it will be interesting to see how it develops.