Share
Embed
Transcript
18 slides
-
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 -
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 -
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 -
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 -
CocoaHeads Prague July 2019 Target dependencies • Other targets •
Apple SDKs • Frameworks • Carthage !7 -
CocoaHeads Prague July 2019 Other features • Multiplatform frameworks •
Detection of Info.plist and assets directory • Target templates, variables !8 -
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 -
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 -
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 -
CocoaHeads Prague July 2019 Schemes Xcodegen creates scheme for each
configuration targets: MyApp: (...) scheme: configVariants: - Test - Staging - Production !13 -
CocoaHeads Prague July 2019 Demo Weather App (for iOS and
tvOS) [CZ, US, UK] !15 -
CocoaHeads Prague July 2019 configs: CZ Debug: debug CZ Release:
release UK Debug: debug UK Release: release US Debug: debug US Release: release !16 -
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