Skip to content

Add swift-format config, reformat codebase, and add CI#2

Merged
winrid merged 2 commits into
mainfrom
swift-format-and-ci
Jun 30, 2026
Merged

Add swift-format config, reformat codebase, and add CI#2
winrid merged 2 commits into
mainfrom
swift-format-and-ci

Conversation

@winrid

@winrid winrid commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Adopts a standard Swift formatter, reformats the codebase to match it, and adds CI to enforce formatting + compilation going forward.

.swift-format config

Uses Apple's swift format (bundled with the Swift 6 toolchain — no extra install). Config tuned to the existing repo style:

  • 4-space indentation, 120-column line length
  • Collapse consecutive blank lines to one
  • UseSynthesizedInitializer disabled — for a library, that rule would strip the explicit public inits (the synthesized init is only internal), which would silently change the public API. A formatting PR shouldn't touch the API surface.

Reformat

swift format applied across all tracked Swift sources (Sources, Tests, ExampleApp). Whitespace/layout only — no behavioral changes. This is the bulk of the diff (57 files).

CI (.github/workflows/ci.yml)

Runs on PRs and pushes to main, on macos-latest with the latest stable Xcode. Two jobs:

  • formatswift format lint --strict; fails on any deviation from the committed config.
  • build — compiles the library and tests against the iOS simulator SDK (a plain swift build targets macOS and fails on UIKit code), then builds the example app. Compile checks only — the integration tests hit the live API, so they're not run in CI.

Verified locally

  • swift format lint --strict → clean (exit 0)
  • Library, test target, and example app all build for the iOS simulator

Note: CI uses the toolchain's swift format via latest-stable Xcode, matching the version used to format locally (Swift 6.3). If a runner's Xcode lags, pin the version in the workflow to keep local and CI formatting in lockstep.

winrid added 2 commits June 30, 2026 16:08
- Add a .swift-format config (4-space indentation, 120 col, collapse
  blank lines to one). UseSynthesizedInitializer is disabled so the
  formatter never strips the explicit public inits this library relies on.
- Apply swift format across all tracked Swift sources (Sources, Tests,
  ExampleApp). Formatting only — no behavioral changes.
- Add a GitHub Actions workflow (.github/workflows/ci.yml) with two jobs:
  - format: swift format lint --strict (fails on any deviation)
  - build: compile the library and tests against the iOS simulator SDK,
    and build the example app

Verified locally: lint is clean, and the library, tests, and example app
all build for the iOS simulator.
TestConfig.swift is gitignored (real credentials), so the test target
can't compile on a fresh checkout. Generate a placeholder with dummy
values before swift build --build-tests; CI only compiles the tests.
@winrid
winrid merged commit 2bc05f1 into main Jun 30, 2026
2 checks passed
@winrid
winrid deleted the swift-format-and-ci branch June 30, 2026 23:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant