DetailedProductsKit 0.3.2

DetailedProductsKit 0.3.2

Maintained by Stuart Breckenridge.



DetailedProductsKit

Build Status codecov Maintainability Version License Platform

DetailedProductsKit is a Swift library for iOS and macOS that manages all interaction with the the Franklin Templeton Detailed Products API.

Note

In order to use DetailedProductsKit you first need to register, create an app, and obtain credentials on the Franklin Templeton Developer portal.

Features

  • Authentication with the API
  • Data download
  • JSON decoding
  • Error handling
  • Response caching
  • Get up and running three lines of code

Requirements

  • iOS 12.1+
  • Xcode 10.1+
  • Swift 4.2+

Installation

DetailedProductsKit is available through CocoaPods. To integrate DetailedProductsKit into your project add the following line to your Podfile and then run pod install:

pod 'DetailedProductsKit'

Basics

The functionality offered by DetailedProductsKit is surfaced through the DetailedProductsAPI class.

Configuration

Add the following import declaration to the class where you want to use the API:

import DetailedProductsKit

Create a constant:

let productsAPI = DetailedProductsAPI(key: <#CONSUMER_KEY#>, secret: <#CONSUMER_SECRET#>)

Usage

After productsAPI is initialised, you can call any of the supported API endpoints. For example, to get the latest fund NAV data:

productsAPI.getFundNav(fundKey: "US8802081039", fundKeyType: .ISIN) { (fundNav, error) in
    // Your code
}

Caching

DetailedProductsAPI will cache responses to API requests to improve performance.

If you need to remove cached responses call the following method:

productsAPI.removeAllCachedResponses()

Example App

An example app is included. Change this line in ViewController to include your consumer key and secret:

let productsAPI = DetailedProductsAPI(key: "CONSUMER_KEY", secret: "CONSUMER_SECRET")

Then launch the app.

Author

Stuart Breckenridge

License

DetailedProductsKit is available under the MIT license. See the LICENSE file for more info.