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

SHIPPING A MOBILE MULTIPLATFORM PROJECT ON IOS ...

Alec Strong
December 05, 2019

SHIPPING A MOBILE MULTIPLATFORM PROJECT ON IOS & ANDROID

Given by Ben Asher (@benasher44) and Alec Strong (@strongolopolis).
Video: https://youtu.be/je8aqW48JiA

Getting a multiplatform project started within an active engineering team across multiple platforms is challenging. You have to pitch the project to your colleagues, wrestle with reconciling platform-specific technical issues, and actually ship it for each supported platform.

We have spent the last year doing just that for PlanGrid and CashApp. Come learn how to get your multiplatform project started and what kinds of problems you can expect to solve along the way. We'll approach the problems from both the Android and iOS perspectives and arm you with the tools to make multiplatform not a multiproblem.

Alec Strong

December 05, 2019
Tweet

More Decks by Alec Strong

Other Decks in Programming

Transcript

  1. Championed on iOS ~15 across Android and iOS Construction Championed

    on Android ~30 across Android and iOS Financial Services
  2. MPP

  3. Common Questions Kotlin/Native relies on Obj-C? What about Swift? Obj-C

    header is well-annotated for Swift This is the status quo for Apple’s own frameworks
  4. Common Questions What libraries can we use for mpp? JVM

    Distributions are incomplete Special multiplatform distributions K/N ABI instability (klib)
  5. commonMain iosMain androidMain iOS - .framework Android - .aar Library

    Outputs Library Source Sets Code expect class Lock actual class Lock actual class Lock
  6. expect class Lock actual class Lock actual class Lock commonMain

    iosMain androidMain iOS - .framework Android - .aar Library Outputs Library Source Sets
  7. commonMain iosMain androidMain iOS - .framework Android - .aar Library

    Outputs Library Source Sets windowsMain Windows - .dll
  8. Make an API request Receive an async response Interface can

    be re-implemented later MPP Life Hack: Interface Network
  9. interface Network { /** * Makes an API request */

    fun makeRequest( host: APIHost, request: Request, completion: (Request.Response) -> Unit ): NetworkDisposable }
  10. interface Network { /** * Makes an API request */

    fun makeRequest( host: APIHost, request: Request, completion: (Request.Response) -> Unit ): NetworkDisposable } host: APIHost Plain enum of names of the hosts– no URL handling required
  11. interface Network { /** * Makes an API request */

    fun makeRequest( host: APIHost, request: Request, completion: (Request.Response) -> Unit ): NetworkDisposable } request: Request data class: - String path and body, - query params dict - enum method (GET, POST, etc.)
  12. interface Network { /** * Makes an API request */

    fun makeRequest( host: APIHost, request: Request, completion: (Request.Response) -> Unit ): NetworkDisposable } completion: (Request.Response) -> Unit sealed class w/ different response types:
  13. interface Network { /** * Makes an API request */

    fun makeRequest( host: APIHost, request: Request, completion: (Request.Response) -> Unit ): NetworkDisposable } NetworkDisposable Interface with a cancel() method
  14. Concurrency in commonMain commonMain iosMain androidMain expect fun <T> T.freeze():

    T actual fun <T> T.freeze(): T = this actual fun <T> T.freeze(): T = freeze()
  15. Pros Cons Minimal change for android Seamless local development Single

    source of truth Host dependencies Two build environments for iOS CI Nightmare
  16. Pros Cons Minimal change for android Seamless local development Host

    dependencies Two build environments for iOS CI Nightmare for iOS Out of sync code
  17. Pros Cons CI is fast Encourages unit test coverage Single

    source of truth Breaking changes are painful Need good CD setup Debugging decoupled repos
  18. Define your project’s goals Be thoughtful growing your codebase Avoid

    solving general muliplatform problems Get your CI and dev setup working early Join us in Kotlin slack Review