Contributions are welcome. Please ensure the SDK builds and the test suite passes before opening a pull request.
- macOS with Xcode 15.0 or newer
- Swift 5.9+ (bundled with Xcode 15)
- xcodegen (only needed if you touch the example apps):
brew install xcodegen
git clone https://github.com/polyai/ios-sdk.git
cd ios-sdk
swift build
swift testThe SDK has zero third-party dependencies — Apple frameworks only. Do not add Swift Package dependencies to Package.swift.
swift test # SDK unit tests
scripts/build-all.sh # build every example app (slow — full ladder)To work on a single example:
cd Examples/SwiftUI/Chat/06-FullReference
xcodegen generate
open *.xcodeprojSources/PolyMessaging/— the SDKPublic/— public API surface (only types here are part of the contract)Internal/— implementation (Adapters, Helpers, Ports, Services, Wire)PolyMessaging.swift— top-level facadePolyMessagingClient.swift— lower-level client used byChatSession
Tests/PolyMessagingTests/— XCTest suiteExamples/SwiftUI/andExamples/UIKit/— the feature ladder (01-Hello…07-Playground)scripts/—build-all.sh,verify.sh,run-uitests.sh
If you change the SDK, mirror the change across the SwiftUI and UIKit example ladders, and keep README.md in sync.
- Follow the existing Swift style — 4-space indent, types in
UpperCamelCase, members inlowerCamelCase. - Every new
.swiftfile must start with// Copyright PolyAI Limitedfollowed by a blank line. - Public types and methods need a doc comment (
///) describing why to use them, not just what they do. - Don't introduce comments that simply restate the code. Only comment non-obvious invariants.
- The SDK is
@MainActorwhere it touchesChatSessionstate — preserve those annotations. - Never log connector tokens or session identifiers.
This repository uses Conventional Commits for commit messages. Versioning and CHANGELOG.md are maintained by hand when cutting a release.
| Type | Effect on version (pre-1.0) |
|---|---|
feat: |
Minor bump (0.X.0) |
fix: |
Patch bump (0.0.X) — pre-1.0 minor bump is disabled |
feat!: / BREAKING CHANGE: |
Minor bump (pre-1.0); major bump post-1.0 |
docs:, chore:, test:, refactor:, style:, ci:, build:, perf: |
No release |
Examples:
feat: add typing-indicator throttling to ChatSession
fix: drop dead WebSocket immediately on NWPath offline
docs(examples): keep 04-Resilience README in sync with code
chore(release): 0.5.0
Releases are cut manually:
- Conventional commits land on
main. - To cut a release, bump the version in all three places —
Sources/PolyMessaging/Public/Version.swift,PolyMessaging.podspec, and a newCHANGELOG.mdentry — then tagvX.Y.Z. - Publish the CocoaPod:
pod trunk push PolyMessaging.podspec(requires a one-timepod trunk register). The:tagin the podspec must match thevX.Y.Ztag, so push only after tagging. - The version literal in
Version.swiftis the single source of truth — it is the User-Agent the SDK sends and the version surfaced to example apps. The podspec version must mirror it exactly. Bump them only when cutting a release, never in feature PRs.
swift build # SDK compiles
swift test # tests pass
scripts/build-all.sh # every example app builds (only if you touched Examples/ or public API)For UI/example changes, open the relevant Examples/<platform>/<NN-Name> project and exercise the feature in the simulator.
- No third-party dependencies. This package is intentionally dependency-free.
- Don't edit
Sources/PolyMessaging/to make integration "easier" — the public API is the contract; integration changes belong in the consuming app. - Keep credentials out of source. Connector tokens are set via
PolyMessaging.initialize(...)at runtime, never committed.