hanpanpan200 / StartKit

ThoughtWorks iOS StartKit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS StarterKit

There is a demo in demo-clean branch (WIP)

iOS StarterKit Introduction

This iOS StarterKit based on:

  • IDE:Xcode9
  • Language:Swift4
  • Build tool:fastlane
  • Dependency management:Cocoapods
  • Code style check:SwiftLint
  • Unit test framework: Quick + Nimble
  • CI:
    • Jenkins
    • TBD: GoCD
    • TBD:BuildKit
  • Beta testing platform:
    • HockeyAPP
    • TBD:蒲公英

Setup Development Environment (admin & developers)

  • Install Xcode 9

  • Install rbenv

  • Install Cocoapods

     gem install cocoapods
    
  • Install Fastlane

     gem install fastlane --verbose
    
  • Install SwiftLint

     brew install swiftlint
    

Admin Setup (admin or codebase manage, who is managing the Apple account, development/distribution certificates.)

Step-1: Apply an Apple ID

  1. Apply account for apple developer program

Step-2: Setup Codebase

  1. Create a new project from xcode manually
  2. Run fastlane init
  3. Copy the Fastfile from this StartKit project and replace the project specific stuff with your own one( scheme/app_identifier/git_url/api_token/ipa).
  4. Modify the Appfile in ./fastlane/Appfile with your own values (app_identifier, apple_id, team_id)

Step-3: Config Apple Development Portal

  1. Create an App Id for your project
  2. Add all the testing devices' UUID in devices

Step-4: Setup certificates and provisioning profiles with match(a fastlane action)

Reference: `Usage` - `Setup` at `https://github.com/fastlane/fastlane/tree/master/match`
  1. Create a private repo (name it something like certificates)
  2. Write all the testing device’s UUID in the ./devices.txt file of your projects
  3. Run match init with the private repo URL
  4. Modify the generated Matchfile in ./fastlane/Matchfile with your own values (app_identifier, username, URL)
  5. Run match development, match adhoc or match app_store to install certificates and profiles(This will upload them to the private repo as well)
  6. Run fastlane add_devices every time new device is added into the file

Step-5: Setup Beta Testing platform: HockeyAPP

  1. Register a HockeyApp account
  2. Create an app manually in HockeyApp (with your project bundle identifier)
  3. Create an API Token for your project from account settings -> API Tokens in HockeyApp
  4. Modify fastlane deploy_beta lane in your Fastfile with the api_token

Step-6: Setup CI: Jenkins (on CI server)

  1. Install Jenkins

    Download jenkins.war from https://jenkins.io/
    
  2. Start Jenkins

    java -jar jenkins.war
    
  3. Install required Jenkins plugins: Pipeline and Git Plugin

    Install from jenkins console: Manage Jenkins -> Manage Plugins

  4. Generate Credential

    Generate from jenkins console: Credentials -> Global credentials -> Add Credentials

  5. Create new project

    Create from jenkins console: New Item -> Choose pipeline style

  6. Configure project

    Configure from jenkins console: Build Triggers -> Choose Pipeline defination Pipleline script from SCM -> Fill the form with the created credential.

Init Project (developer)

  • Clone your own Repo generated by the codebase manager
  • Setup the development environment as above and run fastlane cocoapods_update
  • Start coding...

Working flow (developer)

  • Run fastlane checkin locally everytime before git push
  • CI will trigger fastlane beta after every git push and deploy the successful build package to HockeyApp
  • Run fastlane add_devices every time new device is added into the file (codebase manager)

Other Recommendations

- Code Structure: Clean Swift

- Local database: CoreData

- Data analysis:

    - Fabric

    - Umen

- Push notifications

    - SNS

    - Umen

- Login or sharing by third party library such as facebook, WeChat: Use the official SDK for each

- Testing
    - Unit Test: Cover all the view model、utils, etc.
    - Functional Testing: Cover the main business scenarios.
    - UI Automation Testing: According to the functionality of the app, and the benefit/cost of your team.

- Common libraries

    - Security scanning: danger

    - Network: Alamofire

    - Spinning: SVProgressHUD

    - Image cache: Kingfisher

    - Autolayout: SnapKit

- Other good libraries

    - Access keychain library: KeychainAccess

    - Date formatter library: iso-8601-date-formatter

    - Time formatter library: TimeAgo

    - Form library: XLForm

    - Keyboard library: IQKeyboardManager

    - Logging: XCGLogger

    - Data cache: Haneke

About

ThoughtWorks iOS StartKit


Languages

Language:HTML 65.2%Language:Ruby 20.4%Language:Swift 14.4%