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. Automate your
    iOS Projects
    From project creation to delivery
    Olivier Halligon

    View full-size slide

  2. ● File > New Project
    Creating a new project…
    New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore

    View full-size slide

  3. ● 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

    View full-size slide

  4. 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

    View full-size slide

  5. 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

    View full-size slide

  6. 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

    View full-size slide

  7. 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

    View full-size slide

  8. ● 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

    View full-size slide

  9. 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

    View full-size slide

  10. 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)

    View full-size slide

  11. 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

    View full-size slide

  12. SwiftGen: Type-safe Resources
    New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore

    View full-size slide

  13. 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

    View full-size slide

  14. 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

    View full-size slide

  15. ● 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

    View full-size slide

  16. Localization & Translation
    New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
    https://poeditor.com
    https://phraseapp.com

    View full-size slide

  17. 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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  21. ● 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

    View full-size slide

  22. 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
    !

    View full-size slide

  23. 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

    View full-size slide

  24. Continuous Integration
    New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore
    ● Jenkins
    ● Bitrise
    ● CircleCI
    ● TeamCity
    ● … and many more

    View full-size slide

  25. Continuous Integration
    New Project Libs Model DB Resources Code L10n Code Quality Review Tests IPA AppStore

    View full-size slide

  26. New Project Libs Model DB
    Resources Code L10n
    Code Quality Review Tests
    IPA AppStore
    Create :
    Develop :
    Check :
    Release :
    Automate all the things!
    ✅ ✅

    View full-size slide

  27. Built the robots, don’t be one
    + ! = ❤
    #$%&

    View full-size slide

  28. Thank you
    Olivier Halligon
    @aligatr
    https://github.com/AliSoftware
    We’re hiring!
    Come see us in booth P6
    https://carrieres.niji.fr

    View full-size slide