Kin SDK Docs

Kin SDK Docs

  • Developers
  • Build

›iOS

Overview

  • Getting Started
  • Kin Architecture Overview
  • How It Works
  • App Registration
  • Migration to New SDKs
  • Solana
  • Terms & Concepts

Agora

  • Agora API Reference
  • Agora Webhook Reference

Android

  • Android SDK

iOS

  • iOS SDK

Go

  • Go SDK

Python

  • Python SDK
  • Python API reference

Node.js

  • Node.js SDK

Deprecated

    Android

    • Hello World Android
    • Kin SDK for Android
    • Android API reference
    • Backup/Restore Module for Android
    • Discovery Module for Android
    • Send Kin Module for Android

    iOS

    • Hello World iOS
    • Kin SDK for iOS
    • iOS API reference
    • Backup/Restore Module for iOS
    • Appreciation Module 'Options Menu' for iOS

    Unity

    • Hello World Unity
    • Kin SDK for Unity

    Python

    • Hello World Python
    • Kin SDK for Python
    • Kin Python Bootstrap
    • Python API reference

    Node.js

    • Hello World Node.js
    • Kin SDK for Node.js
Edit

Appreciation Module 'Options Menu' for iOS

This module provides an interface for users to show their appreciation for other users through gifting them Kin. The module is independent from the Kin SDK, however it provides Kin branding. The UI presents a half-screen view with several gifting amount options. After choosing an option, a thank you animation will play before dismissing the view.

Quick Links

  • The appreciation module on GitHub

Installation

The Kin appreciation module for iOS can be included in your project with CocoaPods.

CocoaPods

Add the following to your Podfile:

pod 'KinAppreciationModuleOptionsMenu'

Setting Up the Appreciation Module

Step 1 - Create the View Controller

The initializer requires two parameters:

  • balance: The current user's balance of Kin
  • theme: The theme to be used with the module

The theme options are .light and .dark.

let appreciationViewController = KinAppreciationViewController(balance: 100, theme: .light)

Step 2 - Set up the Delegate

The delegate provides life cycle information for the appreciation module.

appreciationViewController.delegate = self

Protocol Stubs

extension SomeController: KinAppreciationViewControllerDelegate {
    func kinAppreciationViewControllerDidPresent(_ viewController: KinAppreciationViewController) {

    }

    func kinAppreciationViewController(_ viewController: KinAppreciationViewController, didDismissWith reason: KinAppreciationCancelReason) {

    }

    func kinAppreciationViewController(_ viewController: KinAppreciationViewController, didSelect amount: Decimal) {
        
    }
}

The appreciation module does not send the payment. It is your responsibility to provide this functionality in the didSelectAmount function.

Step 3 - Present the View Controller

The appreciation module inherits from UIViewController, so you will present it like any other view controller.

viewController.present(appreciationViewController, animated: true)

Dismissing the View Controller

The appreciation module will automatically dismiss itself in the following ways:

  • Background Tap: Tapping outside of the appreciation view controller bounds
  • Close Button: Tapping the close button in the appreciation view controller
  • Select Amount: Tapping one of the gifting buttons in the appreciation view controller

BI Events

Optionally, a BI events delegate is provided for you to log user interactions.

appreciationViewController.biDelegate = self

Protocol Stubs

extension SomeController: KinAppreciationBIDelegate {
    func kinAppreciationDidAppear() {
        
    }

    func kinAppreciationDidSelect(amount: Decimal) {
        
    }

    func kinAppreciationDidCancel(reason: KinAppreciationCancelReason) {
        
    }

    func kinAppreciationDidComplete() {
        
    }
}

Sample App

KinAppreciationModuleOptionsMenuSampleApp covers the entire functionality of KinAppreciationModuleOptionsMenu and serves as a detailed example of how to use the module. The sample app source code can be found here.

The sample app can also be installed through CocoaPods.

pod 'KinAppreciationModuleOptionsMenu', :appspecs => ['SampleApp']
Last updated on 2019-8-21
← Backup/Restore Module for iOSHello World Unity →
  • Quick Links
  • Installation
    • CocoaPods
  • Setting Up the Appreciation Module
    • Step 1 - Create the View Controller
    • Step 2 - Set up the Delegate
    • Step 3 - Present the View Controller
    • Dismissing the View Controller
  • BI Events
    • Protocol Stubs
  • Sample App
Kin SDK Docs

Docs

IntroductionAndroidiOSGoPythonNode.js

Resources

GithubGuidelines
LinkedInRedditMedium
Privacy policyTerms and conditions
© 2021 Kin Foundation