BLACK FRIDAY: Save 50% on all my Swift books and bundles! >>

Tips for Android developers switching to Swift

Swift version: 5.10

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 50% in my WWDC sale.

SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

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 OUR BOOKS
Buy Pro Swift Buy Pro SwiftUI Buy Swift Design Patterns Buy Testing Swift Buy Hacking with iOS Buy Swift Coding Challenges Buy Swift on Sundays Volume One Buy Server-Side Swift Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Advanced iOS Volume Three Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with macOS 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.8/5

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.