Windows Bridge for iOS and Universal Windows Platform

Well over a year ago Microsoft announced that they were developing a tool to enable iOS developers to use their Objective-C code inside a Windows 10 Universal Windows Platform application (originally dubbed Islandwood). In August of 2015 Microsoft initially released their open-source project to GitHub as the Windows Bridge for iOS. I tried this tool out many months back as I was curious about what the project structure looked like and how well the whole process works. It’s been about 6 months since I initially took a look at the tool, and I was curious to to see if there had been any major changes. islandwood

Requirements for Using the Windows Bridge for iOS

There are a few requirements that you need to meet before you can test out the bridge (which haven’t changed since last time I used it). On the PC side you'll need Windows 10, Visual Studio 2015, the Windows 10 SDK, and 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 will create a Visual Studio solution called -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

I tried simply converting one of our Xuni projects (our native iOS control suite) to see if I had any luck with the importer. This didn’t work last time I attempted to use the tool, and, perhaps not surprisingly, it still doesn’t work. It seems as though projects using any third party frameworks will generally have difficulty with the tool. 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 instead importing a project that only relies on these already converted frameworks should work. My old custom checkbox example still works which is only dependent on UIKit. These sorts of more basic apps (and those that only use Apple’s most common APIs) will generally work without too much trouble. CheckboxSuccess Debugging and editing the Objective-C files was easy to in Visual Studio (though definitely strange), 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 "winobjc\include\Platform\Universal Windows\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];  


iOS App Analyzer Tool

Microsoft has added a new tool to help you determine how much work it will take you to port your iOS app to UWP using the Windows Bridge. The tool is available via their website, and it should remove some of the guess work in determining how easily your app can be ported. This a nice time saver for those new to the tool, and it will likely encourage new users to give the Windows Bridge a try (especially when their apps aren’t difficult to port).

The future of the Windows Bridge

Microsoft promises to continue to add new features to the Windows Bridge for iOS so that it's more compatible and feature complete. It’s still lacking support for Swift, and in some ways it feels like a work in progress though it remains impressive piece of technology. Perusing their GitHub page shows you that the control has undergone many revisions and is being updated quite regularly. Microsoft appears to be very committed to growing the project and listening to developer feedback so it should continue to steadily evolve.

Read more about C1Studio UWP Edition


GrapeCity Developer Tools
comments powered by Disqus