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

Extending Xcode 8 - try! Swift NYC 2016

Daniel Jalkut
September 01, 2016

Extending Xcode 8 - try! Swift NYC 2016

Daniel Jalkut's talk about the new extension support in Xcode 8.

Daniel Jalkut

September 01, 2016
Tweet

Other Decks in Programming

Transcript

  1. daniel jalkut
    @danielpunkass
    Extending Xcode 8

    View Slide

  2. A Good Developer…

    View Slide

  3. Source Editor Extensions

    View Slide

  4. Source Editor Extensions
    ⊕ Debuting with Xcode 8
    ⊕ Extend Xcode’s source text editor only
    ⊕ Only Apple-supported mechanism

    View Slide

  5. Bad News
    ⊕ Alcatraz is dead
    ⊕ Scope of extension impact is limited
    ⊕ Delivery is by host-application only

    View Slide

  6. Good News
    ⊕ Apple approved
    ⊕ Designed for security and stability
    ⊕ Signal of things to come?

    View Slide

  7. World of Possibilities…

    View Slide

  8. World of Possibilities…
    ⊕ Transform text and selection
    ⊕ Access web resources
    ⊕ Display rudimentary UI
    ⊕ Anything the host app can do…

    View Slide

  9. … and Impossibilities
    ⊕ Anything outside the text editor
    ○ Project manipulation
    ○ Leveraging Xcode’s compiler state
    ⊕ Dynamic responses to user actions
    ○ Only menu and keyboard shortcut

    View Slide

  10. Build & Run

    View Slide

  11. Build & Run
    ⊕ Built upon App Extensions
    ⊕ Delivered by host application
    ⊕ Debuggable within Xcode itself

    View Slide

  12. New Project
    ⊕ Create a new Mac application
    ⊕ Add a new extension target
    ⊕ Build & Run
    ⊕ Select Xcode as the target

    View Slide

  13. View Slide

  14. View Slide

  15. View Slide

  16. View Slide

  17. View Slide

  18. View Slide

  19. View Slide

  20. View Slide

  21. View Slide

  22. View Slide

  23. Caveats
    ⊕ Additional setup for 10.11
    ⊕ You must sign your app and extension!
    ⊕ Run app to nudge extension registration
    ⊕ Wait a few moments after launching

    View Slide

  24. Hot Tips

    View Slide

  25. Hot Tips
    ⊕ Select Xcode as the debug target

    View Slide

  26. View Slide

  27. Hot Tips
    ⊕ Select Xcode as the debug target
    ⊕ Pass a source file path to Xcode

    View Slide

  28. View Slide

  29. View Slide

  30. Hot Tips
    ⊕ Select Xcode as the debug target
    ⊕ Pass a source file path to Xcode
    ⊕ Give your command a keyboard shortcut

    View Slide

  31. View Slide

  32. Hot Tips
    ⊕ Select Xcode as the debug target
    ⊕ Pass a source file path to Xcode
    ⊕ Give your command a keyboard shortcut
    ⊕ Keep an eye on Apple’s own extensions

    View Slide

  33. Try! Harder

    View Slide

  34. Try! Harder
    ⊕ github.com/danielpunkass/tryharder
    ⊕ Standalone project with example extensions

    View Slide

  35. Try! Harder
    ⊕ Manipulate text efficiently
    ⊕ Open a web page
    ⊕ Display rudimentary UI
    ⊕ Insert placeholder text
    ⊕ More?

    View Slide

  36. As Good As Your Tools

    View Slide

  37. View Slide