Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
This project is part for SwiftBeanCount, please check out the main documentation here.
This is the importer of SwiftBeanCount. It reads files to create transactions. This library does not include any UI, so consumers need to provide a UI for selecting accounts, settings, as well as editing of transactions.
How to use
- Create a
FileImporterManager.new(ledger: Ledger?, url: URL?)or a
TextImporterManager.new(ledger: Ledger?, transaction: String, balance: String), depending on what you want to import.
possibleAccounts()on the importer. If there is more than one or none, promt to user to enter/select the account to use.
- Pass the result to the importer via
- If using a FileImporter call
- If using a TextImporter, call
parse()to get a string of the parsed transactions. If using a FileImporter, call
parseLineIntoTransaction()to retrive transaction after transactions till it returns
nil. It is recommended to allow the user the edit the transactions while doing this. (See #2)
The different importers which are included in this library can be configured:
ImporterManager.importersto retreive all importers
importer.settingsNameto get the user friendly name of the importer
importer.settingsto get the
ImporterSettings which an importer offers
importer.set(setting: ImporterSetting, to value: String)to modify these settings.
The library supports the Swift Package Manger, so simply add a dependency in your
.package(url: "https://github.com/Nef10/SwiftBeanCountImporter.git", .exact("X.Y.Z")),
Note: as per semantic versioning all versions changes < 1.0.0 can be breaking, so please use
.exact for now