iOS and Android - Bridge One

May 28, 2019
ios android comparison


I am looking for a way to construct a bridge for Android developer to walk into iOS and an iOS developer to walk into Android by not using Cross-platform frameworks.

In these adventures, I am going to study the similarities that will make the transition quick and some differences that one needs to be careful. I am not against Cross-platform development, I love it, but in some instances, it requires a developer to jump into the native platform to achieve certain things, it might help a Cross-platform developer as well in such cases.

View Controllers

Binding of view to the view controller is explicit(we specify the layout the view controller has to be bound to) in case of Android while it is implicit in case of iOS.

override fun onCreate(savedInstanceState: Bundle?) {



Layout Design

Android’s Constraint Layout and iOS Auto Layout are quite similar. Once you have an understanding of one, you can quickly work your way in the other. While the IDE associated with Android gives the flexibility to use visual design tool to place components in the screen as well as edit the raw XML file, the iOS on the other hand, as far as I have tinkered, doesn’t offer the freedom to edit the layout file manually.

Dependency Management

The dependency management for Android is inbuilt with the default build system(Gradle), so it is straightforward to add the necessary dependencies to the project without any manual bootstrap process. While in case of iOS developers have to go through a bootstrap process to set up a dependency manager to add the required dependencies to the project. There are a few options available for iOS developers to choose from like CocoaPods, Swift Package Manager and Carthage. In this example, I have used CocoaPods.

//dependencies for unit testing
testImplementation 'junit:junit:4.12'

//dependencies for ui testing
androidTestImplementation ''
androidTestImplementation ''


dependencies for GeoQuiz

pod ‘Toast-Swift’, ‘~> 5.0.0’

#dependencies for unit testing target ‘GeoQuizTests’ do inherit! :search_paths end

#dependencies for ui testing target ‘GeoQuizUITests’ do inherit! :search_paths end


View Listeners

For Android, I attach the click listeners on the call of the onCreate() method, while in iOS I have to make the attachments from the layout editor in Xcode(Quiz.storyboard, Hold Control and Drag to the appropriate ViewController to bind a view to a method tagged inside the ViewController). In Android case, something similar to iOS can be achieved using DataBinding.

override fun onCreate(savedInstanceState: Bundle?) {
    true_button.setOnClickListener {
        Toast.makeText(this, R.string.correct_toast, Toast.LENGTH_SHORT).show()

    false_button.setOnClickListener {
        Toast.makeText(this, R.string.incorrect_toast, Toast.LENGTH_SHORT).show()


@IBAction func trueButtonListener(sender: UIButton){
    self.view.makeToast(getString(key: "correct"))

@IBAction func falseButtonListener(sender: UIButton){
    self.view.makeToast(getString(key: "incorrect"))

private func getString(key: String) -> String {
    return NSLocalizedString(key,comment: "Read localized value")


Managing Strings

Almost all developers are not a fan of encoding text within the code unless they have no other option. In this aspect, both iOS and Android offer a way to separate strings into individual files which will come in handy when the App needs to be localized for a specific target audience. Android text used in the App can be separated into individual XML files. While in iOS at least as far as I have used there are two levels of separation, where one set is statically bound to the UI elements as seen in Quiz.strings with some bizarre key-value pair. The other relates to text that needs to be shown dynamically in the UI based on user action as seen in Localizable.strings.

I also to bring to readers notice that I don’t claim to know everything before I ventured in this adventure, In case If I am not correct about certain things kindly bring it to my notice and I’ll correct it, and it will benefit other readers as well. As we learn, we make mistakes; we fix them, and we grow.

I am modifying the code samples from this book for illustrative purposes. I would also recommend this book for those of you who are new to the Android world.

comments powered by Disqus