iOS/Swift and Android/Java Conversion Chart

I am beta-testing my first Android app, and have recently completed my second iOS app. Having taught myself how to program in both Swift and Java, I spent a lot of time lamenting the inability to easily convert code between the two. Sure, there are cross-platform solutions, but as an independent developer, I couldn’t afford to invest a ton of money in a paid system. Plus, I had already learned Swift, and this wasn’t helpful for many cross-platform solutions.

Below is a list-in-progress of concepts and objects that have parallels between the two operating systems and languages. Feel free to comment and make suggestions!

iOS Android
storyboard/nib design/layout/xml
constraints layouts
UIViewController Activity/Fragment
UIView View
UITableView RecyclerView/LinearLayout
UICollectionView RecyclerView/GridLayout
UIPickerView Spinner
UITextView/UITextField EditText
UILabel TextView
UIButton Button/ImageButton
UIImageView ImageView
UISwitch Switch
viewDidLoad() onCreate()
viewWillAppear() onResume()
viewWillDisappear() onSuspend()
NSNotification.postNotification() sendBroadcast()
NSNotification.addObserver() BroadcastReceiver.onReceive()
dispatch_async() AsyncTask()
 Swift Java
Class Class
String String
Int int/Integer
Bool boolean/Boolean
Array ArrayList/[] — example: String[]
Dictionary HashMap
for i in i..<count { } for (int i=0; i<count; i++) { }
for item in array { } for (String item : array) { }
if x == 5 if (x == 5)
switch object switch (object)
case:
x = 4;
break;
case:
x = 4

I hope this is helpful to some other beginning programmers! Reinventing the wheel for each device is hard enough…not even knowing what the wheel is called is even worse!

5 thoughts on “iOS/Swift and Android/Java Conversion Chart

  1. Thanks

    I have recently written and published an iPhone app on the iPhone store for my restaurant SiamCottage and now I am learning how to use the Android IDE to write the equivalent app.

    And so your list of terms will be really useful to keep next to me while going through the online course.

    Thanks

    1. Thanks, James! I’m glad the list was useful for you. I followed a similar path, and I wished someone had created such a list…

Leave a Reply

Your email address will not be published. Required fields are marked *