NEW! Master Swift design patterns with my latest book! >>

Tips for Android developers switching to Swift

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!

Available from iOS 9.0

Did this solution work for you? Please pass it on!

Other people are reading…

About the Swift Knowledge Base

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

Need to know Objective-C fast?

I wrote a book dedicated to teaching Objective-C to developers who already know Swift – it's the fastest way to get up to speed!

MASTER SWIFT NOW
Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Practical iOS 11 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 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 me know!

Click here to visit the Hacking with Swift store >>