DotNetNorth – January 2017 – Crossing The Windows Bridge for iOS

A lesser-spotted CodebunTes caught emerging into the light…

With Christmas falling between it seems like forever since the last Dot Net North event, but on Tuesday this week it kicked off once more with a talk from Mike Irving entitled ‘Crossing the Windows Bridge for iOS’. I’d not read any spoilers on what to expect, so I won’t lie I went in with a total air of mystery on what this could be about. It turned out all the clues were actually there in the title – it involved using the Windows Bridge for iOS to bring Objective C applications over to Universal Windows Platform applications.

Mike started by giving a brief overview of the iOS bridge, going into detail of where the project could be found on GitHub for people who’d never seen it before, very useful for someone like myself, as well as giving an overview of the libraries it would support. Also included were some warnings to make sure you put aside a good bit of time if playing with all this, as the downloads needed (particularly the SDK libraries) could mount up.

Once all the initial groundwork was in place, he moved on to go through a ‘real world’ example. Taking a old iOS released app, and going through the steps to port this over to Windows 10. The app itself was quite simple in its concept – A timer for pool games with 3 buttons in it for starting/stopping time and swapping players. After showing this running under the Apple iOS emulator, the work began. A quick hop into the command prompt in Windows, one command from the bridge project issued, and the app was ported into a Visual Studio solution. Wow, that was quick! I was worried we were going to be over unusually quick this evening. However as soon became clear, although the bridge is designed to take huge amounts of legwork out of migrating an app, there is still some manual work needed on top.

The first open of the app in Visual Studio failed to build. The reason? A reference to a native Apple Store rating function. Simple enough to understand that one. Although the bridge is designed to allow a lot to be ported, there are always going to be limits around something which ties into a deeply ingrained part of iOS. For the purposes of this demo this was removed, although it was shown how it could have been possible to use some conditional statements in order to swap in a Windows equivalent. I won’t lie, the thought of having blocks of code in an iOS project that only Windows would pay attention to just screamed out horrific memories of conditional comments from the darker days of HTML under Internet Explorer 6/7. After taking that out, it still failed to build, this time due to a dependency on an analytics library which again was very iOS dependent, so was removed. And after that… it compiled! And ran on both Windows 10 directly, and the Windows Phone Emulator.

There were a few graphical glitches involved with it, and the subject for the remainder of the talk was the bits of tidying up for these, but essentially the app now worked as a Windows Platform App within a half hour or so of work from the original iOS base.

I don’t think it’s something I’d ever use myself. Mainly because as was communicated the real value of the bridge is to speed up porting an existing iOS app over to the struggling Windows App market and as someone without any iOS apps currently built, there’s nothing I could actually port. However it did show something which could prove very useful for those looking to take their apps to a wider reach, and I much appreciate Mike taking the time to share it with everyone.

Read more on the DotNetNorth Meetups:-
https://www.meetup.com/DotNetNorth
https://twitter.com/DotNetNorth