ncruz
ncruz

Reputation: 93

converting/porting Xamarin.Android project to Xamarin.iOS

I'm in the process of converting/porting over a Xamarin.Android project to Xamarin.iOS and basically have run into a wall with the entirely different architecture of iOS - from how the UIs are designed (AXML layouts in Android to storyboards in iOS) to how the backend code works with the UI (Activity in Android to ViewControllers in iOS). Even the event names are different - OnClick in Android is TouchUpInside in iOS. Controls are called subviews and control properties are 'Outlets' - there's definitely a learning curve here.

Does anyone here have any success - or at least experience - in porting a Xamarin.Android project to Xamarin.iOS? Are there any tools out there that could be used to convert from Android AXML layouts to iOS storyboards or from Android Activity to iOS ViewControllers? How about a book or online resource/website of someone who has done this?

I have about 20-25 Android AXML layouts and Activities in my project and thought about writing some code to build a tool that can automate the translation of these to their iOS equivalents. I've checked out some storyboard code and see that a TextView is a 'label' while an EditText is a 'textField'. Is there a list that maps Android controls to their storyboard equivalents?

Regards

NC

Upvotes: 0

Views: 687

Answers (2)

ncruz
ncruz

Reputation: 93

I was able to successfully port it over to iOS but it was certainly not a copy & paste. I had to manually do it by creating a new Xamarin.iOS project in Xamarin Studio for Mac, then copying over the utility library files and creating a whole new UI architecture with the UI classes in iOS. The differences between the UI architecture of Android and iOS ranged from minor things such as no support in iOS for TextView boxes in dialog screens to major ones such as the use of view controllers and a parent/root navigation controller.

Upvotes: 0

manishKungwani
manishKungwani

Reputation: 925

There is no such book, tool or library which can do that. There architectural differences in the way things work on iOS and Android. On android, an instance of the context is needed to do system/ui operations, whereas on iOS, you can do those independently.

The best way to start would have been to create a PCL with the logic part of the code and create the UI and bindings in native projects.

Hope this helps.

Upvotes: 2

Related Questions