Basic iOS Cheat Sheet for Android developers

Basic iOS Cheat Sheet for Android Developers

This is a short cheat sheet that I created to improve communication in mobile development. As Android reference I used Kotlin but it should be easy to understand for Java developers too.

Language differences

Objective C is the Java of iOS whereas Swift is very similar to Kotlin. Like Kotlin in Android, Swift is a preferred language for new projects. Swift is a newer, modern language developed by Apple to make life easier for developers. Despite that Objective C is still popular and according to data from JetBrains in 2019, almost 50% of iOS developers still know Objective C.

Kotlin vs Swift

Here I covered Kotlin equivalents in Swift. Note that these equivalents are not identical, usually have small differences. 

Note that both Garbage Collection and ARC manage memory but work in completely different ways.

AndroidiOS
nullnil
vallet
varvar
letif let
thisself
funfunc
whenswitch
MapDictionary
NullableOptional
Pair, Triple, etc.Tuple
listenerdelegate
interfaceprotocol
SQLite/RoomCore Data
Garbage CollectionAutomatic Reference Counting

Framework differences

Lifecycle

Both Android and iOS Frameworks have a lifecycle. But in iOS, there are 2 important functions that don’t exist. 

onSaveInstanceState/onRestoreInstanceState -> doesn’t exist

onActivityResult -> doesn’t exist. You have to use Navigation Controller with delegates (listeners).

Also, note that it’s tough to compare lifecycles from Android and iOS. I think that more detailed comparison deserves a separate article.

AndroidiOS
onCreateloadView (loading view manually)
onStart and onResumeviewDidLoad
app runningviewWillAppear
app runningviewDidAppear
onPause and onStopviewWillDisappear
onDestroyviewDidUnload

Creating layouts

iOS is nothing like Android when it comes to layouts. In iOS, most of the layout oriented work is done using a mouse (like in the ‘Design’ mode in Android Studio) and Swift. For layouts you can use:

1. XIB (XML Interface Builder) files. An older way to create layouts but it’s not outdated. This way every view layout has own XIB file.

2. Storyboards (one file with many views and navigation). Introduced in iOS 5. Manage many views and their navigation in one file.

Build tools and libraries

Gradle’s equivalent is Cocoapods. The former one is a build tool used (not only) for Android apps also used in IDEs other than Android Studio. The latter one is a tightly coupled to XCode IDE.

AndroidiOS
Android SDKCocoa Touch
GradleXCode Tools + Cocoapods
OkHttpAFNetworking/Alamofire/URLSession
Picasso/GlideSDWebImage/KingFisher
TimberCocoaLumberjack
RxJava/RxKotlinRxSwift/Bond
RetrofitMoya
GSON/MoshiSwiftyJSON/Codable
SpekQuick

View differences

Note that iOS doesn’t have ViewGroups because they are regular Views. 

AndroidiOS
TextViewLabel
single-line EditTextTextField
multi-line scrollable EditTextTextView
simple RecyclerViewTableView
customizable RecyclerViewCollectionView
Popup menuContext menu
Bottom sheetAction menu
ViewPagerPageViewController
Seek barSlider
View.VISIBLE/View.INVISIBLEisHidden
View.GONEStackView or constraints
enableduserInteractionEnabled
SpinnerPickerView
ProgressViewProgressView (also Spinner)

Summary

It’s good to know Android equivalents in iOS. Usually, it’s better to communicate using names well known in programming, not only in your framework. But it’s not always possible or just doesn’t happen.

Download this free cheat sheet in PDF HERE.

Update: Check out r/androiddev Reddit discussion about this article which supplements it and brings many good ideas.

If you want to be notified about more articles like this one, subscribe below.

* indicates required

Jakub Chmiel

I’m Jakub Chmiel. In the Android world, I’m in the process of developing 2 project management mobile applications for construction teams. In these projects, I add business value fast trying to minimize technical debt.

7 thoughts on “Basic iOS Cheat Sheet for Android developers

  • July 25, 2019 at 11:43 pm
    Permalink

    Great and very useful article, thanks!

    I’d just like to point out that the equivalent to Android’s “multi-line scrollable EditText” would really be UITextView, not EditText.

    Reply
  • July 26, 2019 at 9:50 am
    Permalink

    Great article, minor correction on Libraries you mistyped Gradle instead of Glide.

    Reply
    • July 26, 2019 at 10:13 am
      Permalink

      Thanks Lucas. I think that I fixed it yesterday. Maybe it wasn’t updated properly. I will recheck it.

      Reply
  • July 30, 2019 at 4:56 am
    Permalink

    Have to point out, creating layouts can be done programatically (constrains / anchors / stacks), which is much more advance than any interface builder by achieving reusability and scalability. (Plus real developer/engineer don’t program by mouse.)

    Reply
    • July 30, 2019 at 6:39 am
      Permalink

      Thanks, Eisen. Right, I thought that it was covered by ‘and Swift’ but I should probably add a clarifying note.

      Reply

Leave a Reply

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