readium / swift-toolkit

A toolkit for ebooks, audiobooks and comics written in Swift
https://readium.org/mobile/
BSD 3-Clause "New" or "Revised" License
274 stars 112 forks source link

Let's simplify example integrations with XcodeGen #188

Closed mickael-menu closed 3 years ago

mickael-menu commented 3 years ago

Swift Package Manager support is around the corner, thanks to @stevenzeck.

With it, we will need to add more Xcode targets to show how to use them. Currently the Test App has four of them, which adds some maintenance load:

Screenshot 2021-06-05 at 12 49 21

I think this also adds confusion for integrators, since the project contains artifacts for a few different types of integration.

Instead, I suggest removing the Xcode project entirely from r2-testapp-swift and instead add one XcodeGen project definition YAML file per integration example.

XcodeGen is a command line tool written in Swift that generates your Xcode project using your folder structure and a project spec. The project spec is a YAML or JSON file that defines your targets, configurations, schemes, custom build settings and many other options.

Pros

Cons

One step further

Not related to XcodeGen, but r2-workspace-swift also brings some maintenance load with its 4 different integration branches.

I suggest archiving this repository and instead adding the submodules directly in r2-testapp-swift, when used for development purposes.

mickael-menu commented 3 years ago

Example generating the test app project using SPM and with LCP:

name: R2TestApp
options:
  bundleIdPrefix: org.readium
packages:
  R2Shared:
    url: https://github.com/readium/r2-shared-swift.git
    branch: develop
  R2Streamer:
    url: https://github.com/readium/r2-streamer-swift.git
    branch: develop
  R2Navigator:
    url: https://github.com/readium/r2-navigator-swift.git
    branch: develop
  ReadiumOPDS:
    url: https://github.com/readium/r2-opds-swift.git
    branch: develop
  ReadiumLCP:
    url: https://github.com/readium/r2-lcp-swift.git
    branch: develop
  Kingfisher:
    url: https://github.com/onevcat/Kingfisher.git
    from: 5.15.8
  MBProgressHUD:
    url: https://github.com/jdg/MBProgressHUD.git
    from: 1.2.0
  SQLite:
    url: https://github.com/stephencelis/SQLite.swift.git
    from: 0.12.2
targets:
  R2TestApp:
    type: application
    platform: iOS
    deploymentTarget: "10.0"
    sources:
      - path: Sources
        excludes:
          - Resources/Samples
      - path: Sources/Resources/Samples
        type: folder
    dependencies:
      - carthage: R2LCPClient
      - package: R2Shared
      - package: R2Streamer
      - package: R2Navigator
      - package: ReadiumOPDS
      - package: ReadiumLCP
      - package: Kingfisher
      - package: MBProgressHUD
      - package: SQLite
    settings:
      OTHER_SWIFT_FLAGS: -DLCP

It generates this project:

Screenshot 2021-06-08 at 13 21 03