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

XcodeGen

Avatar for Petr Pavlik Petr Pavlik
July 03, 2019
150

 XcodeGen

Avatar for Petr Pavlik

Petr Pavlik

July 03, 2019
Tweet

Transcript

  1. CocoaHeads Prague July 2019 XcodeGen • A open source command

    line tool for generating Xcode projects • Available on GitHub: https:// github.com/yonaskolb/XcodeGen • Introduces YAML-based project specification • Powered by xcodeproj !2
  2. CocoaHeads Prague July 2019 How to start? • brew install

    xcodegen • https://github.com/yonaskolb/XcodeGen/blob/master/ Docs/ProjectSpec.md • xcodegen generate --spec project.yml !3
  3. CocoaHeads Prague July 2019 YAML-based project specification name: MyApp options:

    bundleIdPrefix: com.myapp.bundle.id targets: MyApp: type: application platform: iOS deploymentTarget: "12.0" sources: [MyApp] dependencies: - carthage: RxSwift - sdk: MapKit.framework !5
  4. CocoaHeads Prague July 2019 YAML-based project specification Build Configurations (Optional)

    Settings Groups (Optional) Targets Schemes Dependencies Settings Source Files Platforms Xcodegen Options Schemes !6
  5. CocoaHeads Prague July 2019 Other features • Multiplatform frameworks •

    Detection of Info.plist and assets directory • Target templates, variables !8
  6. CocoaHeads Prague July 2019 No more merge conflicts! • Just

    add Xcode project to .gitignore • No need to sync groups and files anymore • PRs and commits will be smaller • Changes in .yml are very rare • Low risk of unintended changes in build settings !9
  7. CocoaHeads Prague July 2019 Settings Groups • Recommended way of

    modifying build settings • Shared across targets • Groups can be extended • You can define properties for every configuration or just for particular one !11
  8. CocoaHeads Prague July 2019 Settings Groups Example settingGroups: app: base:

    THIRD_PARTY_API_KEY: "<KEY>" configs: Test: groups: [test] Staging: groups: [stag] Production: groups: [prod] test: API_URL: "https://test.myapp.com/api/" PRODUCT_NAME: "MyApp TEST" stag: API_URL: "https://stag.myapp.com/api/" PRODUCT_NAME: "MyApp STAG" prod: API_URL: "https://production.myapp.com/api/" PRODUCT_NAME: "MyApp PROD" !12
  9. CocoaHeads Prague July 2019 Schemes Xcodegen creates scheme for each

    configuration targets: MyApp: (...) scheme: configVariants: - Test - Staging - Production !13
  10. CocoaHeads Prague July 2019 configs: CZ Debug: debug CZ Release:

    release UK Debug: debug UK Release: release US Debug: debug US Release: release !16
  11. CocoaHeads Prague July 2019 settingGroups: app: base: OPEN_WEATHER_MAP_API_KEY: "API_CODE" configs:

    CZ: groups: [cz] UK: groups: [uk] US: groups: [us] cz: APP_CONFIG_URL: "https://(...)" PRODUCT_BUNDLE_IDENTIFIER: "com.rb.sample.WeatherApp.cz" PRODUCT_NAME: "Weather CZ" uk: APP_CONFIG_URL: "https://(...)" PRODUCT_BUNDLE_IDENTIFIER: "com.rb.sample.WeatherApp.uk" PRODUCT_NAME: "Weather UK" us: APP_CONFIG_URL: "https://(...)" PRODUCT_BUNDLE_IDENTIFIER: "com.rb.sample.WeatherApp.us" PRODUCT_NAME: "Weather US" !17