Save 37% off PRO during our Black Friday Sale! »

💥 Custom Playgrounds 🎯

💥 Custom Playgrounds 🎯

Talk on using your own frameworks inside Xcode Playgrounds, given at NSLondon, June 2014.

9d2ea021919ff81e02d48530aae191bd?s=128

Boris Bügling

June 26, 2014
Tweet

Transcript

  1. ! CUSTOM PLAYGROUNDS " NSLONDON, JUNE 2014 BORIS BÜGLING -

    @NEONACHO
  2. None
  3. COCOAPODS - CONTENTFUL

  4. SWIFT?

  5. SWIFT!

  6. REPL

  7. $ swift Welcome to Swift! Type :help for assistance. 1>

    import ContentfulDeliveryAPI <REPL>:1:8: error: no such module 'ContentfulDeliveryAPI' import ContentfulDeliveryAPI ^
  8. Copy your framework over to /Applications/Xcode6-Beta2.app/ Contents/Developer/Platforms/MacOSX.platform/Developer/ SDKs/MacOSX10.10.sdk/System/Library/Frameworks

  9. 1> import ContentfulDeliveryAPI 2> var client = CDAClient() client: CDAClient

    = <extracting data from value failed> error: Couldn't lookup symbols: _OBJC_CLASS_$_CDAClient
  10. LOAD THE DYNAMIC LIBRARY FROM YOUR FRAMEWORK USING dlopen()

  11. 3> var handle = dlopen("/Applications/.../Versions/A/ContentfulDeliveryAPI", 2) handle: COpaquePointer = Builtin.RawPointer

    = 0x0000000102e2b6e0 -> 0x00007fff5fc37e50 vtable for ImageLoaderMachOCompressed + 16 4> var client = CDAClient() client: CDAClient = {}
  12. SUCCESS

  13. // Playground - noun: a place where people can play

  14. None
  15. None
  16. 24/06/14 01:00:00,780 Xcode[84816]: IDEPlaygroundExecutionSessionThread(pid=85188) IDEPlaygroundExecution: [PlaygroundSession <0x7fff12750c70>] Received error from

    expr: error: error: Couldn't lookup symbols: _OBJC_CLASS_$_CDAClient
  17. None
  18. SAM MARSHALL

  19. None
  20. XCODE PLUGIN?

  21. None
  22. #import <IDELanguageSupportUI/IDEPlaygroundExecutionDeviceService.h> @interface IDELocalComputerPlaygroundExecutionDeviceService : IDEPlaygroundExecutionDeviceService + (id)capability; - (id)sessionForExecutingPlaygroundWithParameters:(id)arg1;

    - (id)defaultStubPathForSDK:(id)arg1; @end
  23. DVTPLAYGROUNDCOMMUNICATION.FRAMEWORK @interface DVTPlaygroundCommunicationListener @interface DVTPlaygroundCommunicationSender Uses TCP/IP on the local

    machine to communicate between Xcode and Stub
  24. None
  25. None
  26. None
  27. None
  28. None
  29. DEMO

  30. None
  31. XCODE PLUGIN!

  32. RELEVANT WWDC 2014 SESSIONS ▸ Session 408: Swift Playgrounds ▸

    Session 409: Introduction to LLDB and the Swift REPL
  33. LINKS ▸ http://samdmarshall.com/blog/ custom_frameworks_and_swift.html ▸ https://github.com/jas/swift-playground-builder ▸ http://stackoverflow.com/questions/24058336/how-do-i-run- asynchronous-callbacks-in-playground

  34. THANK YOU!

  35. HTTP://VU0.ORG/PLAYGROUNDS