GlobalCanadaEuropeAsia-Pacific
Sign in

Back to Open Source

District Core for Swift

The shared Swift core of the District AI apps for iPhone, iPad and Mac: the models, networking, data, sign-in logic and call state machines they have in common, as one Swift package of six modules. It builds and runs its tests on Linux as well as on Apple platforms, so almost all of the apps' logic is tested without a simulator, a network or an account.

Used by

District AI for iOSiPhone and iPad
District AI for MacIn development

Six modules, one package

DistrictModelEvery response the apps decode, and one error type
DistrictAuthCoreSign-in: PKCE, the Apple nonce, token refresh, sign-out
DistrictNetworkEvery endpoint, the API client and its errors
DistrictDataRepositories and paging
DistrictCallA call's outbound and inbound state machines
DistrictLiveThe desktop's live updates, presence and ring gate
Tested on Linux and macOS, and built for iOS.

One core for the Apple apps

Tested without a simulator

No module uses an Apple interface framework, so the whole package builds and runs its tests on Linux as well as on macOS. The tests must reach every line of every module, or continuous integration fails.

Held to the service's own answers

The repository carries responses recorded from the District AI service, and its tests decode and re-encode each one, failing on any field the models do not hold. The decoders themselves ignore a new field, so an installed app keeps working when the service adds one.

A change reaches an app as a version

A change lands here first, in a pull request with its tests. A release is a version tag, and each app moves to it in a pull request of its own, pinned to that exact version.

Licence
Apache-2.0
Built with
Swift, Swift Package Manager
Used by
District AI for iOS and District AI for Mac

District Core for Swift on GitHub

What is open source, and what is not

What is open source

This package, under Apache-2.0: you can read it, build it, change it and use it. The District AI and Distronode names, logos and app icons are trademarks, so an app you distribute with this package uses its own name, icon and bundle identifier.

The package reports no crashes: no crash-reporting library is among its dependencies, whose one outside package is Apple's swift-crypto.

What is not

The District AI service the package talks to. Signing in needs a District AI account; without one you can still build the package and run every test.

Without an account with us

Today the apps need a District AI account to sign in. We want them to work without an account with us too. We have not worked out what that looks like or whether it can work, and the answer depends on what people would use them with, so we are asking before we build anything.

Tell us what you would connect them to

Get involved

Issues and pull requests are welcome on GitHub. Report a vulnerability privately, as the security policy describes, and not in a public issue.

Contributing guide
CONTRIBUTING.md
Security policy
SECURITY.md
Changelog
CHANGELOG.md