TinkMoneyManagerUI Documentation Beta

Class Categorize​Transaction​View​Controller

public final class CategorizeTransactionViewController: UINavigationController

A view controller for categorizing a transaction. Required scopes: categories:read, transactions:read, and transactions:categorize

A CategorizeTransactionViewController displays an interface for picking a category to recategorize a transaction as. After picking a category it can also display similar transactions which the user can select to also recategorize.

Overview

Provide the id of the transaction you want to categorize and which category types you want the user to choose categories from. For example, if the transaction has a negative amount you might only want to allow the transaction to be recategorized as an expense or transfer category.

let categorizeTransactionViewController = CategorizeTransactionViewController(
    tink: <#Tink#>,
    transactionID: <#Transaction.ID#>,
    categoryTypes: [<#Category.Kind#>]
)

Dismissing the Categorization Interface

This view controller is designed to be presented modally. To handle what should happen after the transaction has been categorized or if the user taps Cancel, you need to implement the CategorizeTransactionViewControllerDelegate. By default the view controller will dismiss itself when the user taps Cancel but you might also want to customize what should happen when the transaction was categorized or if an error occured.

categorizeTransactionViewController.delegate = <#delegateInstance#>
present(categorizeTransactionViewController, animated: true)
extension <#Class#>: CategorizeTransactionViewControllerDelegate {
    func categorizeTransactionViewController(_ controller: CategorizeTransactionViewController, didCategorize transactions: [Transaction.ID], category: Category) {
        dismiss(animated: true)
    }

    func categorizeTransactionViewController(_ controller: CategorizeTransactionViewController, didFailWithError error: Error) {
        <#Error handling#>
    }

    func categorizeTransactionViewControllerDidCancel(_ controller: CategorizeTransactionViewController) {
        dismiss(animated: true)
    }
}
CategorizeTransactionViewController CategorizeTransactionViewController UINavigationController UINavigationController CategorizeTransactionViewController->UINavigationController

Conforms To

UINavigationController

Initializers

init(tink:​transaction​ID:​category​Types:​category​ID:​show​Similar​Transactions:​)

public convenience init(tink: Tink = .shared, transactionID: Transaction.ID, categoryTypes: [TinkCore.Category.Kind], categoryID: TinkCore.Category.ID? = nil, showSimilarTransactions: Bool = true)

Initializes a new view controller.

Parameters

tink Tink

A configured Tink object.

transaction​ID Transaction.​ID

The id of the transaction to recategorize.

category​Types [Tink​Core.​Category.​Kind]

The available category types to choose from. Must not be empty.

category​ID Tink​Core.​Category.​ID?

The current category id of the transaction. If nil, no initial category will be selected. Defaults to nil.

show​Similar​Transactions Bool

The value of this determines wether to show similar transactions or not when categorizing. Detaults to true.

init(tink:​transaction​Id:​category​Types:​category​Id:​show​Similar​Transactions:​)

@available(*, deprecated, renamed: "init(tink:transactionID:categoryTypes:categoryID:showSimilarTransactions:)") public convenience init(tink: Tink = .shared, transactionId: Transaction.ID, categoryTypes: [TinkCore.Category.Kind], categoryId: TinkCore.Category.ID? = nil, showSimilarTransactions: Bool = true)

Properties

categorize​Transaction​Delegate

var categorizeTransactionDelegate: CategorizeTransactionViewControllerDelegate?

An object that conforms to the CategorizeTransactionViewControllerDelegate protocol.

Methods

view​Did​Load()

override public func viewDidLoad()

view​Will​Appear(_:​)

override public func viewWillAppear(_ animated: Bool)

view​Did​Appear(_:​)

override public func viewDidAppear(_ animated: Bool)