This is an unofficial Swift SDK for the YouNeedABudget (YNAB) API. Please be aware that this SDK is not supported in any way by YNAB itself. No guarantees can be made about its functionality. Improper use of this SDK might corrupt your YNAB budget data.
- Supports Authorization Code Grant to authorize a user
- Request data:
- Budgets
- Accounts
- Categories
- Transactions
- Create transactions
- Basic UI components:
- Login
- Select a budget
- Select a category
- Select a payee
- iOS 11.0+
- Xcode 9.4
You can use CocoaPods to install YNAB-Swift-SDK
by adding it to your Podfile
:
platform :ios, '11.0'
use_frameworks!
pod 'YNAB-Swift-SDK', :git => 'https://github.com/roelspruit/YNAB-Swift-SDK.git'
Download the complete Source directory and include it in your project.
// Ask the user to log into YNAB
let authorize = YNABLoginViewController(clientId: "CLIENTID", redirectUri: "REDIRECTURL") { (accessToken) in
// Use returned accesstoken to create a YNAB client
let ynab = YNABClient(accessToken: accessToken!)
// Use the client to request the desired data
ynab.getBudgets { (budgets) in
// Use data
}
}
// Present the login viewcontroller
present(authorize, animated: true, completion: nil)