Thank you for your interest in contributing to Swift Accounting! This document provides guidelines to help you get started.
If you find a bug, please open an issue and include:
- A clear description of the problem
- Steps to reproduce the issue
- Expected vs. actual behavior
- The Swift and Xcode versions you are using
For feature requests (e.g. support for a new accounting plan), please open an issue first to discuss the idea before submitting code.
- Fork the repository
- Create a branch from
main(e.g.feature/add-accounting-planorfix/accounting-account) - Make your changes
- Ensure the project builds and any tests pass
- Submit a merge request against
main
This project uses SwiftLint to enforce code style.
General guidelines:
- Use 4-space indentation
- Follow Swift naming conventions:
PascalCasefor types,camelCasefor properties and methods - Add doc comments for public API
When adding support for a new accounting plan (e.g., US GAAP, UK GAAP, etc.), follow these steps:
-
Create the data file: Add a JSON file under
Sources/SwiftAccounting/[COUNTRY]/[YEAR]/containing the accounting plan data- Example:
Sources/SwiftAccounting/PCGFR/2026/pcg_2026.json
- Example:
-
Register the resource: Add the data file to the package resources in
Package.swift:.target( name: "SwiftAccounting", resources: [ .process("PCGFR/2026/pcg_2026.json"), .process("YourCountry/Year/your_plan.json"), ] )
-
Create a parser: Implement a parser class following the pattern of
PCGFRParser:- Create a static method to parse your JSON file
- Return an array of
AccountingAccountobjects - Handle hierarchical sub-accounts if applicable
-
Add an AccountingAuthority extension: If the plan has a governing authority, add it as a static property:
extension AccountingAuthority { public static let yourAuthority = AccountingAuthority( name: "Authority Name", acronym: "ACRONYM", description: "Description", websiteURL: "https://example.com", address: "Address", zipCode: "12345", city: "City", countryCodeISO: 123 ) }
-
Add an AccountingPlan extension: Create a convenience method to load your plan:
extension AccountingPlan { public static func getYourPlan() throws -> AccountingPlan { let accounts = try YourParser.parseYourPlan() return AccountingPlan( label: "Plan Name", description: "Description", countryCodeISO: 123, languageCodeISO: "eng", version: "1.0", effectiveYear: 2026, authority: .yourAuthority, accounts: accounts ) } }
-
Update documentation: Add the new accounting plan to the "Included Standards" section in
README.md -
Add tests: Create tests to verify the plan loads correctly and contains expected accounts
This package is a data model layer only. Contributions should focus on:
- New or updated accounting plans
- Bug fixes in accounting plans, accounts or authorities
- Documentation improvements
Networking, authentication, and API client logic are out of scope for this package.
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.