NEW: Nominations are now open for the 2019 Swift Community Awards! >>

Tips for Android developers switching to Swift

Swift version: 5.1

Paul Hudson    @twostraws   

Here are my top ten tips to help you switch from coding Java on Android to coding Swift on iOS:

  1. Find a good tutorial and follow it. Obviously I suggest my own Hacking with Swift and Pro Swift books!
  2. Don't bother with iOS 8 and earlier; 80% of people are already on iOS 9, and by the time you're shipping apps that will be higher.
  3. You're used to debugging on devices because the Android Emulator is poor. The iOS Simulator is excellent, and you should use it. Be warned, though: the iOS Simulator runs at the full speed of your Mac, so you should always do performance testing on devices.
  4. If you're looking for LinearLayout, use UIStackView. If you're looking for Fragments, use UIViewController. If you're looking for Volley, use Alamofire. If you're looking for Java, you should head back to Android.
  5. Don't skimp on learning Auto Layout. It is hard, and it is a bit like black magic at first, but once you understand it your life becomes much easier.
  6. Forget about DPs, SPs, etc. iOS works in virtual points, and the system handles the rest.
  7. If you want to support the widest range of devices, you should learn about Size Classes. They let one app look and work great on everything from iPhone 4s through to iPad Pro, including going between Slide Over, Split View and full screen.
  8. You have a lot more memory to play with, and your code will execute substantially faster. Garbage collection does not happen, so you'll find far fewer cases where your code stutters before optimization.
  9. The Instruments tool that is built into Xcode is a dream come true if you're coming from Android Studio. Same applies to XCTest for unit testing and UI testing. Downside: iOS has nothing like the Application Exerciser Monkey.
  10. Most important of all, use an iPhone or iPad for a while so you start to get a feel for the platform's design principles. Google has a terrible habit of making their iOS apps look like Android apps, which is just confusing for users. iOS design is simple and clear, but it's extremely consistent. Except for Google. Sigh….

iOS is a really fun platform to code for, and Apple's devices have a huge amount of power available to you. Have fun!

SAVE 20% ON iOS CONF SG The largest iOS conference in Southeast Asia is back in Singapore for the 5th time in January 2020, now with two days of workshops plus two days of talks on SwiftUI, Combine, GraphQL, and more! Save a massive 20% on your tickets by clicking on this link.

Available from iOS 9.0

Similar solutions…

About the Swift Knowledge Base

This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.

Buy Testing Swift Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Swift Coding Challenges Buy Server-Side Swift (Vapor Edition) Buy Server-Side Swift (Kitura Edition) Buy Hacking with macOS Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with Swift Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let us know!

Average rating: 3.2/5