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

Modular iOS App @ UIKonf 2014

Modular iOS App @ UIKonf 2014

Given at the UIKonf 2014 in Berlin.

48f07655aeed5ca639b37b05e52d4cb3?s=128

Piet Brauer

May 15, 2014
Tweet

More Decks by Piet Brauer

Other Decks in Programming

Transcript

  1. Modular iOS Apps Piet Brauer XING AG

  2. Architecture should be about enabling small teams to work on

    small components » Mike Hadlow
  3. Should you care about modules? YES, If you ...

  4. ... maintain multiple apps

  5. ... develop white-label apps with core code bases

  6. ... have a large code base

  7. How? Multiple approaches

  8. Facebook Uses ... » ... one large work space »

    ... static libraries and bundles » ... xcconfig files » ... FBFoundation, FBUIKit, FBDataModel, FBAppKit » ... Modules register via module manager » ... URL schemes to navigate Modules @ Facebook
  9. PSPDFKit Uses ... » ... Dependency Injection » ... a

    Plugin Infrastructure » ... Aspect oriented programming » ... URL schemes to navigate (with JLRoutes) Aspect by Steipete Slides from ITT
  10. XING (Will) Use(s) ... » ... multiple independent projects »

    ... CocoaPods to link them » ... XNGFoundation, XNGUIKit, XNGDataModel, etc. » ... domain specific modules » ... a module manager » ... URL schemes to navigate
  11. What does a Module Manager do?

  12. Current

  13. Near Future

  14. Tools

  15. CocoaPods » 2 Specs repositories » 20+ internal Pods »

    our own pod template
  16. Versioneye » ... monitors your projects » ... monitors open

    source libraries » ... notifies you if a new update was released » ... draws a beautiful dependency graph
  17. Rake tasks » Rake is to Ruby what Make is

    to C » easy to write scripts Sample rake bootstrap # Installs dependencies rake ci # Runs everything needed for the ci server rake deploy # Deploys Beta rake release # Release a new version of the Pod rake spec # Runs the specs
  18. Pull Requests work flow » each developer works on his

    own fork » when he is done he makes Pull Requests » Jenkins builds them and gives feedback » another team mate reviews the code and merges » reviewer decides what version number to pick and releases
  19. Travis || Jenkins

  20. How we use Jenkins Jenkins ... » ... is triggered

    on every git commit » ... runs the unit tests » ... sets the build status on the commit in Github
  21. Developer Sandboxes

  22. How to create a new pod? » pod lib create

    UIKonf » rake bootstrap
  23. None
  24. Generated project !"" Assets !"" CHANGELOG.md !"" Classes !"" Example

    # !"" Assets # !"" Example # !"" Example.xcodeproj # !"" Podfile # !"" Podfile.lock # $"" UnitTests !"" Gemfile !"" Gemfile.lock !"" LICENSE !"" README.md !"" Rakefile !"" UIKonf.podspec $"" UIKonf.xcworkspace
  25. Development pods pod 'UIKonf', :path => '../UIKonf.podspec' » does not

    copy source files » work as if the files are in your project » see immediately if something is not public
  26. Demo

  27. Pitfalls & Solutions

  28. Semantic Versioning Is a pain because ... » ... we

    want every team to use a latest version » ... dependent pods » ... informing other teams about updates is time consuming » ... you never know what you break exactly
  29. Semantic Versioning Why resolve the dependencies? » see which pods

    depend on one » see unnecessary dependencies
  30. Semantic Versioning Now works for us because ... » ...

    Versioneye tracks new versions and informs » ... we don't pin the version in podspecs anymore » ... Jenkins builds all projects that depend on the changed pod
  31. Data Model Is a pain because ... » ... it

    is one CoreData file » ... all pods somehow depend on it
  32. Data Model Now works for us because ... » ...

    it only contains mogenerator generated files
  33. Jenkins Was a pain because ... » ... it cannot

    build forks » ... setting it up takes time
  34. Jenkins Now works for us because ... » ... each

    pod has the same Rakefile » ... all we need to execute is rake ci
  35. Localized Strings Was a pain because ... » ... Localization

    was spread across pods » ... you couldn't track duplicates » ... changes were hard
  36. Localized Strings Now works for us because ... » one

    pod containing all translations » will be maintained by translators » People make Pull Requests with their translations
  37. Images Was a pain because ... » ... there were

    duplicates across the pods » ... changes were hard » ... 2 images with the same name could occur
  38. Images Now work for us because ... » ... resource

    bundle feature in CocoaPods » ... we load them from a bundle » .. no conflicts in naming because of bundles
  39. Thanks!! xing.to/PietBrauer && https://twitter.com/pietbrauer Like the modules idea? We are

    looking for you! https://xing.com/ios
  40. Resources » https://www.youtube.com/watch?v=OJ94KqmsxiI » https://github.com/steipete/Aspects » https://speakerdeck.com/steipete/architecting- modular-codebases » http://jenkins-ci.org/

    » https://travis-ci.org/ » https://www.versioneye.com/
  41. Images * Jenktocat, https://octodex.github.com/images/jenktocat.jpg * Johann Lafer - Rezepte aus

    meiner Heimat, https://itunes.apple.com/de/app/johann-lafer-rezepte-aus-meiner/id505874478?mt=8 * Sommerrezepte - Die besten Rezepte für die Urlaubssehnsucht, https://itunes.apple.com/de/app/sommerrezepte-die-besten-rezepte/id680597527?mt=8 * Schlank im Schlaf - Die original Rezepte, https://itunes.apple.com/de/app/schlank-im-schlaf-die-original/id584432534?mt=8 * Jenkins, http://fabiouechi.blogspot.de/2012/11/setting-up-jenkins-on-ec2-using.html * Travis CI, http://jmikola.github.io/slides/beautiful_measurable_software/img/travis-mascot-600px.png