Swiftpack.co - Package - tink-ab/tink-pfm-ios
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.

Tink PFM SDK for iOS

Prerequisites

  1. Follow the getting started guide to set up your Tink account.
  2. Get an access token with the scopes required for the features you intend to use.

Installation

Using CocoaPods

Refer to their guide for usage and installation instructions.

  1. Add TinkPFMUI to your Podfile.

    pod "TinkPFMUI"
    
  2. Run pod install in your project directory.

  3. Open your .xcworkspace file to see the project in Xcode.

Manual Installation

Drag the TinkPFMUI.xcframework and TinkCore.xcframework into the Frameworks, Libraries, and Embedded Content section on your application targets’ General tab.

You should now be able to import TinkPFMUI within your project.

Fetching data

Tink PFM SDK needs a valid access token for a specific user to function correctly. Since Tink PFM SDK does not handle any type of authentication, this needs to be done by your backend. See this link for more info on how this is done. Once you have an access token you pass it on to your Tink instance.

Tink.shared.userSession = .accessToken(<#T##String#>)

Displaying the Finance Overview

Create a FinanceOverviewViewController and provide which features should be displayed. The FinanceOverviewViewController is designed to be used in a navigation controller so you need to embed it in one.

let financeOverviewViewController = FinanceOverviewViewController(features: [.statistics([.expenses, .income]), .accounts, .latestTransactions])
let navigationController = UINavigationController(rootViewController: financeOverviewViewController)
// Present or add to a UITabBarController for instance.  

Refreshing access tokens

User access tokens expire after a set amount of time. You can keep your user logged in by exchanging your refresh token for a new access token (see Tink docs) and passing it to the Tink PFM SDK. This will overwrite the token that the fragment was initialzed with. If needed you can also refresh the statistics, accounts, and latest transactions:

Tink.shared.userSession = .accessToken(<#String#>)
Tink.shared.refresh()

Customization

To configure colors, font or icons you update the Appearance.provider. This needs to be done before initializing the FinanceOverviewViewController or any of the other View Controllers provided by the PFM SDK.

Colors

Color Description
background Color for the main background of the interface.
secondaryBackground Color for content layered on top of the main background.
groupedBackground Color for the main background of grouped interface components.
secondaryGroupedBackground Color for content layered on top of the main background of grouped interface components.
label Primary text color.
secondaryLabel Secondary text color.
separator Color for separators.
accent Colors for buttons, indicators and other similar elements.
expenses Color to represent expenses.
income Color to represent income.
transfers Color to represent transfers.
uncategorized Color representing uncategorized transactions.
warning Color representing a warning.
let colorProvider = ColorProvider()
colorProvider.accent = <#UIColor#>
colorProvider.expenses = <#UIColor#>
colorProvider.income = <#UIColor#>
colorProvider.transfers = <#UIColor#>
colorProvider.uncategorized = <#UIColor#>
Appearance.provider.colors = colorProvider

Icons

You can decide if you want to change all icons or just some icons. It is also possible to customize the icons background corner radiuses with categoryIconBackgroundCornerRadiusFactor. This can be set with a factor from 0.0 to 1.0 where 0.0 results in a square shape and 1.0 , which is the default value, makes a circle.

Themes

You can configure colors, font and icons by providing Tink PFM SDK with a ColorProviding , IconProviding and FontProviding type respectively. Tink PFM SDK also provides a AppearanceProvider type that can be used to easily customize the Tink PFM SDK views.

let colorProvider = ColorProvider()
let fontProvider = FontProvider()
let iconProvider = IconProvider()
colorProvider.accent = <#UIColor#>
colorProvider.expenses = <#UIColor#>
colorProvider.income = <#UIColor#>
colorProvider.transfers = <#UIColor#>
colorProvider.uncategorized = <#UIColor#>
fontProvider.lightFont = <#UIFont#>
fontProvider.regularFont = <#UIFont#>
fontProvider.semiBoldFont = <#UIFont#>
fontProvider.boldFont = <#UIFont#>
iconProvider.wellness = <#UIImage#>
iconProvider.house = <#UIImage#>
iconProvider.entertainment = <#UIImage#>
iconProvider.shopping = <#UIImage#>
iconProvider.categoryIconBackgroundCornerRadiusFactor = <#CGFloat#>

Appearance.provider = AppearanceProvider(colors: colorProvider, fonts: fontProvder, icons: iconProvider)

Caching

The SDK will cache fetched data in memory. If the user logs out, you need to reset the cache to make sure there won't be any cached data presented to the wrong user.

Tink.shared.resetCache()

Localization

Numerical and time-based information such as transaction amounts and dates are formatted with the locale settings set by the current user in the system Settings app.

Since some user-facing text is sent from the Tink API we recommend you to set the locale of the Tink user model to match the user's preference for a consistent user experience.

User-facing text in Tink PFM SDK are in English by default. To add translations for other locales, refer to Localizable Strings document provided with the SDK.

Additional requirements

Locking screen orientation

View controllers from Tink PFM SDK should always be displayed in a portrait orientation since they currently do not support landscape orientations. If presented in a landscape orientation, it will cause unexpected results and a suboptimal user experience. Disable other orientations than portrait by either overriding supportedInterfaceOrientations in the view controller that presents the view controller you're using from Tink PFM SDK.

override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
    return .portrait
}

Or by disabling all Device Orientations except Portrait in the Deployment Info section on your application targets’ General tab.

Example

This example project shows how to setup and use the FinanceOverviewViewController in your app.

Documentation

For more detailed usage and full documentation, please refer to our PFM SDK for iOS guide.

Github

link
Stars: 0

Releases

Tink PFM iOS 0.13.1 - 2021-01-15T15:17:27

  • Fixed insights not updating after calling refresh().
  • Fixed insights card on finance overview not updating after archiving an insight.
  • Fixed view insights archive card on overview not using accent color from theme.

Tink PFM iOS 0.13.0 - 2021-01-13T13:41:09

  • Fixed category statistics only showing statistics back to the year when the current user was created.
  • Added screen tracking events for budgets. You can read more about how to use these in this article on event tracking.
  • Adjustments to the font sizing and weights used across the SDK.
  • Fixed insights not being archived after selecting one of the actions.

Tink PFM iOS 0.12.1 - 2020-12-16T14:07:10

  • Updated date formatting in transaction lists.
  • Changed month formatting to be capitalized in overtime category statistics chart.
  • Hide time period filter in overtime category statistics chart if there isn't more than 6 months of historical data.
  • Use filter category from overtime category statistics chart when showing transactions list.
  • Improved handling of calls to refresh method.
  • Minor UI fixes.
  • Updated design for setting dates for budgets with a custom period.
  • Added option to change category on existing budget.
  • Automatically clears the cache when the user changes.

Tink PFM iOS 0.12.0 - 2020-12-04T13:45:17

  • Improved the support of dark mode. The default color theme supports dark mode now.

  • Added new colors button and buttonLabel to configure the buttons.

  • Updated the new design for the BUDGET_SUGGEST_CREATE_TOP_CATEGORY insight.

  • Added default action handling for the MONTHLY_SUMMARY_EXPENSE_TRANSACTIONS insight.

  • Added transaction details.

    • Added TransactionDetailsViewController for showing details about a specific transaction.
    let transactionDetailsViewController = TransactionDetailsViewController(transactionID: <#T##Transaction.ID#>)
    show(transactionDetailsViewController, sender: <#Any#>)
    
    • Added transactionItemAction property to the FinanceOverviewViewController where you can configure what should happen when a transaction is selected. Either show transaction details or the categorization flow.
    financeOverviewViewController.configuration.transactionItemAction = .categorize  // to show the categorization flow
    financeOverviewViewController.configuration.transactionItemAction = .showDetails // to show the new transaction details view
    
  • Added a new configuration type TinkPFMConfiguration. Use this instead of Tink.Configuration if you only use the Tink PFM SDK.

    let configuration = TinkPFMConfiguration(clientID: <#String#>)
    

Tink PFM iOS 0.11.2 - 2020-11-26T09:51:26

  • Fixed close button not showing in Category Statistics for some environments.
  • Fixed colors of period and date pickers when using a dark theme.
  • Added localization strings for Budgets in LOCALIZABLE_STRINGS.md.

Tink PFM iOS 0.11.1 - 2020-11-13T13:45:28

  • Added a new custom feature option to support adding a custom UIView to FinanceOverviewViewController.
  • Added more localization strings for Actionable Insights in LOCALIZABLE_STRINGS.md.
  • Added support for the Swift package manager.
  • Updated the EditBudgetViewController to public class.

Tink PFM iOS 0.11.0 - 2020-10-22T07:56:31

  • Improvements to Actionable Insights:
    • Adds support for insight types:
      • CREDIT_CARD_LIMIT_CLOSE
      • CREDIT_CARD_LIMIT_REACHED
      • LEFT_TO_SPEND_POSITIVE_MID_MONTH
      • LEFT_TO_SPEND_NEGATIVE_MID_MONTH
      • LEFT_TO_SPEND_NEGATIVE_SUMMARY
      • BUDGET_SUGGEST_CREATE_TOP_CATEGORY
      • BUDGET_SUGGEST_CREATE_FIRST
      • LEFT_TO_SPEND_POSITIVE_BEGINNING_MONTH
      • LEFT_TO_SPEND_NEGATIVE_BEGINNING_MONTH
      • LEFT_TO_SPEND_NEGATIVE
      • SPENDING_BY_CATEGORY_INCREASED
      • LEFT_TO_SPEND_POSITIVE_SUMMARY_SAVINGS_ACCOUNT
      • LEFT_TO_SPEND_POSITIVE_FINAL_WEEK
      • AGGREGATION_REFRESH_PSD2_CREDENTIAL
    • Hides actionable insights with unsupported actions.
    • Monthly summary insights links to expense statistics pie chart instead of showing a list of transactions by default.
    • Removed default handling to show or categorize multiple transactions.
      • Implement delegate methods actionableInsightsViewController(_:showTransactionsWithIDs:) and actionableInsightsViewController(_:categorizeTransactionsWithIDs:completionHandler:) to handle actions related to multiple transactions.
    • Added new card for monthly and weekly transaction summary.
    • Adjusted fonts and icons used on actionable insights.
  • Now shows currency symbols in category statistics bar charts.
  • When configuring Tink, the redirect URI is now optional.

Tink PFM iOS 0.10.0 - 2020-10-02T14:45:21

  • Added Budget functionality on the SDK.
    • Configure FinanceOverviewViewController to display a budget on the overview.
    • Configure CreateBudgetViewController to directly create a budget.
    • Configure BudgetDetailsViewController to display the budget detail.
  • Fixed issues with monthly view of category statistics when there is no data at the start of a monthly period.
  • Shows loading indicator until category statistics data is available in some environments.
  • Now hides unsupported Actionable Insights from lists.
  • Loading indicators use the same color everywhere.
  • Icon shapes in actionable insights are customized by the same appearance property as other icons.
  • Improved support for devices with smaller screens.
  • Moved the networking layer and related models to the TinkCore framework.
  • Fixed swipe to go back gesture.

Tink PFM iOS 0.9.9 - 2020-09-18T13:21:35

  • Latest transactions list on overview now refreshes when shown in some environments.

Tink PFM iOS 0.9.8 - 2020-09-04T12:49:51

  • Added an empty state to the overview pie charts that are shown if there are no statistics available.
  • Changed how the appearance of UINavigationBar is configured in modals so they can be customized using UINavigationBar.appearance().
  • Removed the minus sign of the amount title on the overview pie charts.