Swiftpack.co - Package - jaylees14/MonzoSwift


MonzoSwift is a framework for interacting with the Monzo API. The project uses Travis-CI for testing:

Build Status


The project uses SwiftPM as it's main method of distribution. Simply add a dependency in your Package.swift file:

dependencies: [
    .package(url: "https://github.com/jaylees14/MonzoSwift.git", from: "1.0.0"),


To start, access the shared Monzo class instance and set your access token

let monzo = Monzo.instance


Each of the API responses is returned is of type Either. This is similar to the Haskell style implementation, with the constructors renamed as Error and Result. The example below shows two alternative ways of dealing with this response:

Using .handle
monzo.getAllAccounts { (result) in
  result.handle( { (error) in 
    // Deal with an error if it occurs
  }, { (accounts) in
    // Otherwise deal with the successful accounts
Switching over the result
monzo.getAllAccounts { (response) in
  switch response {
  case .error(let error):
    // Deal with the error
  case .result(let accounts):
    // Otherwise deal with the successful accounts

API Methods

Validation of Auth Token

Validate your existing auth token

public func validateAccessToken(callback: @escaping (_ result: Either<Error, Bool>) -> Void )


Request all of the accounts associated with your access token

public func getAllAccounts(callback: @escaping (_ accounts: Either<Error, MonzoUser>) -> Void)


Request the balance for a Monzo Account

public func getBalance(for account: MonzoAccount, callback: @escaping (_ balance: Either<Error, MonzoBalance>) -> Void)


Request all of the transactions associated with a Monzo account

public func getTransactions(for account: MonzoAccount, callback: @escaping (_ transactions: Either<Error, [MonzoTransaction]>) -> Void)

Request a specific transaction id for your associated access token

public func getTransaction(for id: String, callback: @escaping ((Either<Error, MonzoTransaction>) -> Void))


Stars: 0
Help us keep the lights on


Used By

Total: 0