Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Adventures of an Android Developer in iOS Land

D0d6ca87219f5e6f39ed2cc7cdb366e7?s=47 Yun Cheng
November 06, 2018

Adventures of an Android Developer in iOS Land

What happens when a seasoned Android developer finds herself having to learn iOS from the beginning over the course of a few months? This survival guide will discuss lessons learned, differences in developing in the two platforms, and tips and resources to help you transition from Android to iOS development.


Yun Cheng

November 06, 2018

More Decks by Yun Cheng

Other Decks in Programming


  1. Adventures of an Android Developer in iOS Land An OS

    Survival Guide Yun Cheng
  2. None
  3. Guide to the guide Protip! Helpful links! Just me ranting...

  4. XCode

  5. Getting XCode Don’t download from App Store: Prevent accidental upgrades

    that you’re not ready for Install any version side-by-side you want Download from https://developer.apple.com/downloads/. Rename additional downloads.
  6. Opening your project Open the .xcworkspace, not the .xcodeproj

  7. A workspace is a collection of projects <- Open workspace

    Open project -> No pods Opening your project
  8. XCode vs Android Studio Can’t navigate from Activity to layout

    Refactoring No safe delete feature Autocomplete Find matching brace Double click on brace to find its match. Be prepared to search in path (cmd+shift+F) a lot
  9. Stuff you already know

  10. Swift Optionals Know when to use • optional chaining •

    if let • guard let https://docs.swift.org/swift-book/LanguageGuide/TheBasic s.html#ID330 https://thatthinginswift.com/guard-statement-swift/
  11. Lifecycle Methods onCreate onStart/onResume onPause onStop onDestroy viewDidLoad viewWillAppear viewWillDisappear

  12. Protocols (i.e. interfaces) UIKit classes use delegates (e.g. UITableViewDelegate, UIPickerViewDelegate,

    UICollectionViewDelegate, etc) class MyViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { //Override methods for UIPickerViewDelegate } class MyActivity : AppCompatActivity(), NumberPicker.OnValueChangeListener { //Override methods for NumberPicker.OnValueChangeListener }
  13. Protocols (i.e. interfaces) cont. VC1 The delegate pattern in iOS

    is just using interfaces! VC1 : VC2Delegate { override func doTheThing(s: String) {} } v2Delegate.doTheThing(“MyValue”) Intent data = new Intent(); data.putExtra("myKey","myValue"); setResult(RESULT_OK,data); finish(); VC2
  14. Layouts

  15. Android Studio - visual layout editor vs xml Layout editor

  16. Interface Builder Drag and drop xib files Storyboards - Can

    cover multiple screens - Navigation
  17. None
  18. Interface Builder 1) Hides information 2) Merge conflicts 3) Hard

    to review PRs Limit the scope of your storyboards!
  19. Coding

  20. Use Swift Cleaner syntax Type inference No need to create

    header files http://goshdarnblocksyntax.com http://goshdarnclosuresyntax.com
  21. Swift Objective C interoperability Access ObjC in Swift: RunkeeperPro-Bridging-Header.h

  22. Swift Objective C interoperability Access Swift in ObjC: Add @objc

    annotation to Swift method or class Add #import "Runkeeper-Swift.h" to top of ObjC file https://medium.com/@JoyceMatos/mix-and-match-objecti ve-c-and-swift-c6bceb7f81f3
  23. Swift Objective C interoperability @objc static func launchAppOrStore(schemeString: String, appStore

    storeAppString: String) { ... } #import "Runkeeper-Swift.h" [[UrlOpener init] launchAppOrStoreWithSchemeString:(NSString * _Nonnull)kAsicsStudioScheme appStore:(NSString * _Nonnull)kAsicsStudioAppStoreUrl]; UrlOpener.swift : Invoke in ObjC:
  24. Swift Objective C interoperability @objc static func launchAppOrStore(schemeString: String, appStore

    storeAppString: String) { ... } #import "Runkeeper-Swift.h" [[UrlOpener init] launchAppOrStoreWithSchemeString:(NSString * _Nonnull)kAsicsStudioScheme appStore:(NSString * _Nonnull)kAsicsStudioAppStoreUrl]; cmd+click on Runkeeper-Swift.h import statement to see renamed methods UrlOpener.swift: Invoke in ObjC:
  25. Debugging Don’t use the variables view: -Not good with optional

    binding: if let nonOptionalThing = optionalThing {...} -Any thing derived from parent class doesn’t have those properties Use the lldb console to debug: po <object to inspect>
  26. Libraries

  27. CocoaPods Gradle equivalent Podfile Pods folder https://guides.cocoapods.org/using/pod-install-vs-update.ht ml

  28. Mocking Reflection is not allowed in Swift No Mockito equivalent

    in Swift class MockRunningPacksManager: RunningPacksManager {} https://github.com/Brightify/Cuckoo https://www.swiftbysundell.com/posts/mocking-in-swift
  29. After you’ve finished coding

  30. Provisioning profiles Adds specific device IDs to a list of

    ones allowed to developer test your app TestFlight Don’t press fix it button for provisioning “Seek help ” - Jamie Hagemeister
  31. Regression testing Test on a fewer devices and fewer OS

    High adoption rate of new versions of the OS
  32. Submitting to App Store Must get Apple approval Takes about

    a day
  33. You survived! @yuncheng13