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

Automate your mobile projects from A to Z

Automate your mobile projects from A to Z

This is a conference I gave at DevFest Nantes to present an overview of all the tools available to automate all phases of an iOS project, from creation to delivery, and sharing generated assets and resources and code with Android along the way.

---

During the life of a project, there are a LOT of tasks quite repetitive and time-consuming. But not all people know how much those steps can all be automated!

With this session you'll have an overview of which tools and techniques can be useful to automate various steps of the lifetime of your project, including:

- the creation and configuration of your Xcode project, its build settings and build phases
- its initial structure to be ready for the architecture of your choice
- the configuration of Fabric & Crashlytics & 3rd party libraries
- internationalising & localising your strings and sharing them with the counterpart Android project
- maintaining constants for all your resources
- generating your database model, and sharing with the counterpart Android project
- generating repetitive code
- doing Code Reviews & commenting on common mistakes on Pull Requests
- running your tests
- automating AppStore submission (binary & metadata automation)

AliSoftware

October 18, 2018
Tweet

More Decks by AliSoftware

Other Decks in Programming

Transcript

  1. • File > New Project Creating a new project… New

    Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
  2. • File > New Project • Configure Build Settings, warnings

    • Structure folders & files (Views, Models, ViewModels, Services…) and base files (Coordinators, AppDelegate, …) • Install useful libraries / pods • Configure tools & SDKs (Fabric, Firebase, …) • Configure CI Creating a new project… New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
  3. Creating a new project… automatically $ liftoff Project name? MyAwesomeApp

    Company identifier? com.niji Generating the ‘swift’ project template… Running pod install … Setting warnings at project level Adding shell script build phase « SwiftGen » Adding shell script build phase « SwiftLint » Adding shell script build phase « Fabric/Crashlytics » New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore Interactive prompt ! https://github.com/liftoffcli/liftoff
  4. Creating a new project… automatically New Project Libs Model DB

    Resources Code L10n Code Quality Review Tests IPA AppStore Fastfile swiftgen.yml .swiftlint.yml Podfile … README.md
  5. Creating a new project… automatically $ genesis generate mytemplate.yml Project

    name? MyAwesomeApp Company identifier? com.niji Generated files: MyAwesomeApp.pbxproj README.md … New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore Interactive prompt ! https://github.com/yonaskolb/Genesis
  6. Library dependencies platform :ios, '9.0’ use_frameworks! target ‘DemoApp’ do pod

    'Alamofire’ pod 'Google/Analytics’ pod 'Firebase/Core’ pod 'Fabric’ pod 'Crashlytics’ end New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore $ pod install $ pod update $ carthage bootstrap $ carthage update
  7. • Cross-Platform vs PF-specific • Visual editor vs write model

    code manually Building the Database Model New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
  8. Building the Database Model New Project Libs Model DB Resources

    Code L10n Code Quality Review Tests IPA AppStore RLMUser.swift RLMFidelityCard.swift RLMUser.kt RLMFidelityCard.kt RLMType.swift RLMType.kt https://github.com/NijiDigital/gyro
  9. Resources, Code & Localization UIImage(named: "home.weclome.banner") New Project Libs Model

    DB Resources Code L10n Code Quality Review Tests IPA AppStore let s = UIStoryboard(named: "Main") let vc = s.instantiateViewController(identifier: "scene") as! FooViewController String(format: NSLocalizedString(”home.welcome.massage"), "John”, 3)
  10. https://github.com/SwiftGen/SwiftGen Generate constants for: • Images, Colors • Fonts •

    Storyboards Scenes & Segues • Strings • … SwiftGen: Type-safe Resources New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore swiftgen.yml
  11. Sourcery: Code Generation class Model: AutoEquatable { let id: Int

    let foo: String let bar: [String: Int] let baz: SubModel // sourcery: skipEquality let comment: String } New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
  12. Sourcery: Code Generation {% for type in types.implementing.AutoEquatable %} extension

    {{ type.name }}: Equatable { static func ==(lhs: {{type.name}}, rhs: {{type.name}}) -> Bool { {% for prop in type.storedVariables %} {% if not prop.annotation.skipEquality %} guard lhs.{{ prop.name }} == rhs.{{ prop.name }} else { return false } {% endif %} {% endfor %} return true } } {% endfor %} New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
  13. • Lots of “.strings” files to maintain • Keys consistency

    between locales • Share translations with Android • Editable by non-devs Localization & Translation New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
  14. Localization & Translation New Project Libs Model DB Resources Code

    L10n Code Quality Review Tests IPA AppStore https://poeditor.com https://phraseapp.com
  15. Localization & Translation $ poesie --lang fr --ios MyProject/Resources/Base.lproj $

    poesie --lang en --ios MyProject/Resources/en.lproj $ poesie --lang fr --android app/src/main/res/values/strings.xml $ poesie --lang en --android app/src/main/res/values-en/strings.xml New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore • https://github.com/NijiDigital/poesie
  16. Code Quality New Project Libs Model DB Resources Code L10n

    Code Quality Review Tests IPA AppStore • SwiftLint (https://github.com/Realm/SwiftLint)
  17. Code Review New Project Libs Model DB Resources Code L10n

    Code Quality Review Tests IPA AppStore
  18. Code Review New Project Libs Model DB Resources Code L10n

    Code Quality Review Tests IPA AppStore
  19. • Choose a nice Testing Framework ◦ XCTests ? Quick/Nimble

    ? ◦ Cucumber / Gherkin (“.feature” files + HipTest or Cucumberish) Automate Tests & Coverage New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore Feature: Shopping cart As a user I want to add and remove items from my cart Scenario: Check shopping cart item removal Given I have 3 items in my cart When I remove item 2 Then I have 2 items in my cart
  20. tests Automate… everything! New Project Libs Model DB Resources Code

    L10n Code Quality Review Tests IPA AppStore scan slather sonar slack match gym fabric pilot match gym capture_screenshots deliver ota store « Serveur d’integration mobile Gitlab-CI avec Fastlane » Quickie — 17h50 — Belem !
  21. Works for Android too! • For just builds, doesn’t add

    much to gradle • But adds other abilities: ◦ take screenshots ◦ upload to the store… • And allows a single tool for both platforms Automate… everything! New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
  22. Continuous Integration New Project Libs Model DB Resources Code L10n

    Code Quality Review Tests IPA AppStore • Jenkins • Bitrise • CircleCI • TeamCity • … and many more
  23. New Project Libs Model DB Resources Code L10n Code Quality

    Review Tests IPA AppStore Create : Develop : Check : Release : Automate all the things! ✅ ✅