Slide 1

Slide 1 text

Automate your iOS Projects From project creation to delivery Olivier Halligon

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

● 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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

● 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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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)

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

● 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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

● 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

Slide 22

Slide 22 text

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 !

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

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

Slide 28

Slide 28 text

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