Contributing code to Matrix
Please read https://github.com/matrix-org/synapse/blob/master/CONTRIBUTING.md.
Element iOS support can be found in this room:
Setting up a development environment
It's mandatory to have homebrew installed on your mac, and run after the checkout:
swift run tools setup-project
- Install various brew dependencies required for the project (like xcodegen).
- Set up git to use the shared githooks from the repo, instead of the default ones.
- Automatically run xcodegen for the first time.
We suggest using an Xcode version later than 13.2.1.
The Xcode project can be directly compiled through the shared ElementX scheme which includes the main application as well as the unit and UI tests.
The Xcode project itself is generated through xcodegen so any changes shouldn't be made directly to it but to the configuration files.
Dependencies will be automatically fetched through the Swift Package Manager, including a release version of the MatrixRustSDK. If you encounter issues while resolving the package graph please attempt a cache reset through
File -> Packages -> Reset Package Caches.
To setup the RustSDK in local development mode run the following command
swift run tools build-sdk
This will clone a copy of the SDK if needed, build it for all supported architectures and configure ElementX to use the built framework. To learn about additional options run
swift run tools build-sdk --help
The project depends on some tools for the build process. These are all included in the
Brewfile and can be easily installed by running
Git LFS is used to store UI test snapshots.
swift run tools setup-project will already install it, however it can also be installed after a checkout by running:
git lfs install
The project uses its own shared githooks stored in the .githooks folder, you will need to configure git to use such folder, this is already done if you have run the setup tool with
swift run tools setup-project otherwise you would need to run:
git config core.hooksPath .githooks
Strings and Translations
The project uses Localazy and is sharing its translations with the ElementX Android project: https://localazy.com/p/element
Please read the Android docs for more information about how this works. Note: On iOS we don't have the additional step of filtering strings per module.
ElementX uses Fastlane for running actions on the CI and tries to keep the configuration confined to either fastlane or xcodegen.
bundle exec fastlane to see available options.
Network debugging proxy
It's possible to debug the app's network traffic with a proxy server by setting the
HTTPS_PROXY environment variable in the ElementX scheme to the proxy's address (e.g. localhost:8080 for mitmproxy).
Please see our pull request guide.
Implementing a new screen
New screen flows are currently using the MVVM-Coordinator pattern. Please refer to the create screen template section.
All changes, even minor ones, need a corresponding changelog / newsfragment entry. These are managed by Towncrier.
To create a changelog entry, make a new file in the
named in the format of
ElementXiOSIssueNumber.type. The type can be one of the
featurefor a new feature
changefor updates to an existing feature
bugfixfor bug fix
apifor an api break
buildfor changes related to build, tools, CI/CD
docfor updates to the documentation
wipfor anything that isn't ready to ship and will be enabled at a later date
miscfor other changes
This file will become part of our changelog at the next release, so the content of the file should be a short description of your change in the same style as the rest of the changelog. The file must only contain one line. It can contain Markdown formatting. It should start with the area of the change (screen, module, ...) and end with a full stop (.) or an exclamation mark (!) for consistency.
Adding credits to the changelog is encouraged, we value your contributions and would like to have you shouted out in the release notes!
For example, a fix for an issue #1234 would have its changelog entry in
changelog.d/1234.bugfix, and contain content like:
Voice Messages: Fix a crash when sending a voice message. Contributed by Jane Matrix.
If there are multiple pull requests involved in a single bugfix/feature/etc,
then the content for each
changelog.d file should be the same. Towncrier will
merge the matching files together into a single changelog entry when we come to
There are exceptions on the
ElementXiOSIssueNumber.type entry format. Even if
it is not encouraged, you can use:
pr-[PRNumber].typefor a PR with no related issue
x-nolink-[AnyNumber].typefor a PR with a change entry that will not have a link automatically appended. It must be used for internal project update only.
AnyNumbershould be a value that does not clash with existing files.
To preview the changelog for pending changelog entries, use:
$ towncrier build --draft --version 1.2.3
For Swift coding style we use SwiftLint to check some conventions at compile time (rules are located in the
Otherwise please have a look to Apple Swift conventions. We are also using some of the conventions of raywenderlich.com Swift style guide.
We enforce the coding style by running checks on the CI for every PR through Danger, SwiftLint, SwiftFormat and SonarCloud
We also gather coverage reports on every PR through Codecov and will eventually start enforcing minimums.
Thank your for contributing to Matrix projects!