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!

Programming/Coding

While music education was my chosen career path, computers have always been my hobby. I remember taking beginning programming classes as a child with DOS and BASIC. I spent much of my college and young-adult years tinkering with operating-system settings and exploring the growing internet.

As do-it-yourself tools have exploded, I have used these to write, edit, and publish my book series. I am currently hosting four websites which I have created. And now, I am learning to write code for iOS and Android Apps.

Here is a list of links that I find helpful in programming/coding:

https://wordpress.org
Wordpress is the program I used to build and manage websites. The great thing about WordPress is you can be up and running in minutes, and yet have complete access to personalization as you learn HTML, CSS, and Javascript. My Creative Sequence Repertoire page is an example of a truly customized program that I wrote based on the WordPress core.

To create the Repertoire page mentioned above, I also used a wonderful website called Google Code Playground, which, unfortunately, Google has taken down since. Their code is still available in documentation, but the playground was wonderful for hands-on learning.

https://scratch.mit.edu
One thing that really got me going with coding was playing on Scratch with my 8-year-old son. He started with Hour of Code on Code.org, but was quickly ready for a more open-ended experience. Both Code.org and Scratch are based around linking blocks of code together visually. Thus, all the coding logic can be learned and utilized, without learning any language syntax (where and when to put necessary symbols in the code).

https://swiftstub.com
Swift is the new language by Apple used to code iOS and Mac Apps. The nice thing about Swift is that they made it intentionally as clean as possible, avoiding many of those syntax issues I mentioned. The link above is an online compiler playground to get a feel for it, but if you want to do more, you need Xcode on a Mac.

So why do all this? Well, like I said, I enjoy computers and logic problems. But more than that, I’m hoping to come out with an App for music teachers to organize their lessons! More to come on how that project is developing…