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

Plug-in architecture pattern with Swift

Plug-in architecture pattern with Swift

Talk at 11° CocoaHeads Fortaleza

Bruno Macabeus

May 26, 2017
Tweet

More Decks by Bruno Macabeus

Other Decks in Technology

Transcript

  1. I sent a e-mail for Apple Engineer support: I want

    to compile a dynamic library to use in my apple tv's application. My dylib is wrote with Swift. I tried (see "Steps to Reproduce" section), but I can't load my dylib neither at simulator nor at physical device. Then I received: Thank you for contacting Apple Developer Technical Support (DTS). Our engineers have reviewed your request and have concluded that there is no supported way to achieve the desired functionality given the currently shipping system configurations.
  2. Ohh! I found a Apple’s documentation with a suggestive name

    and, this documentation explain about “Bundle”… but… what is it?
  3. Bundles provide a interface to encapsulate executable (dylib, for example)

    and the resources (xib, for example). Source: https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFBundles/AboutBundles/AboutBundles.html
  4. Somebody make this things to iOS? Or with Swift? Yes!

    Somebody make it work in iOS! So so… Somebody make it work with Swift + Objc-C
  5. Then… I created a Proof of Concept purely in Swift

    with a app to iOS, to send a AppStore
  6. For some reasons, I can’t send it to AppStore -

    problem in certificate in bundle - size of app - and others random problems
  7. Maybe another strategy is using not compiled code, but yes

    a script to download and execute in run time!
  8. What is LLVM? Well… LLVM is “Low Level Virtual Machine”,

    and it’s not only one virtual machine Source: http://aosabook.org/en/llvm.html
  9. Example of C code to LLVM IR C LLVM IR

    Source: http://aosabook.org/en/llvm.html
  10. Well… We can use a simple workaround… We could make

    the app 100% open source and, if the user wants create a plugin, he will need create a new file in the project. Some tools, like Fastlane, can help
  11. Like Apple kill the dlopen in NSUserDefault, him can kill

    others solutions that appear. Apple has been closing any way to create a app can execute arbitrary code, even with respondsToSelector and performSelector
  12. ABI