$30 off During Our Annual Pro Sale. View Details »

Speed up iOS Development with LLDB Code Injection and Framework Live Preview

Speed up iOS Development with LLDB Code Injection and Framework Live Preview

ChienJu Lin
LINE Taiwan Engineering 7 iOS Developer
https://linedevday.linecorp.com/jp/2019/sessions/S2-8

LINE DevDay 2019

November 21, 2019
Tweet

More Decks by LINE DevDay 2019

Other Decks in Technology

Transcript

  1. 2019 DevDay
    Speed Up iOS Development With
    LLDB Code Injection and
    Framework Live Preview
    > ChienJu Lin
    > LINE Taiwan Engineering 7 iOS Developer

    View Slide

  2. General Development Flow
    Product
    Verify
    Dev
    Spec
    Build

    View Slide

  3. Pain Point - Long Build Time
    Product
    Dev
    Spec
    Build Verify

    View Slide

  4. Reduce Number of Times

    To Rebuild Whole App

    View Slide

  5. Build only the module that currently working on
    Less Compile Source Count
    Only Build the Framework
    Less Build Time

    View Slide

  6. > Not embedded/linked by others
    Clean refactoring might need lots of works
    Tips for Existing Projects
    Apply Dummy Framework First
    Easier To Apply, Refactor Afterwards

    View Slide

  7. How To Verify VIEW in Framework?

    View Slide

  8. > No need many scrolls and clicks
    > Preview with different language / device size
    Interactive
    Fast Access
    Preview Under Different Environment
    SwiftUI / Playground Live Preview
    > Preview in different view state

    View Slide

  9. How To Verify LOGIC in Framework?

    View Slide

  10. Test Driven Development in Playground
    To build faster at every iteration
    Write Failing Test
    Make It Pass
    Refactor
    Unit Tests / TDD are best to verify logic
    > Unit Test the framework in playground for
    interactive environment
    > Move to test target for CI after completion

    View Slide

  11. How To Speed Up Whole App Verification?

    View Slide

  12. LLDB Code Injection
    Modify control flow without rebuild
    Inject new code using LLDB Command

    View Slide

  13. LLDB Code Injection - Example
    Goal: Inject new view model to asynchronously download

    View Slide

  14. LLDB Code Injection - Example
    1. Insert breakpoint, enter multi-line expression mode

    View Slide

  15. LLDB Code Injection - Example
    2. Inject new view model code

    View Slide

  16. LLDB Code Injection - Example
    3. Execute the injected function

    View Slide

  17. LLDB Code Injection - Example
    4. Wait the async task to complete. Retrigger the breakpoint, check result & Done.

    View Slide

  18. Framework Code
    Injection
    Preview
    Summary

    View Slide

  19. Reduce Number of Times

    To Rebuild Whole App

    View Slide

  20. Thank You

    View Slide