iOS Integration Guide

Implement donation functionality into your app

Ahillz iOS SDK provides powerful and customizable way to set up and present donation screen in your mobile application. With a few easy methods you can modify the look of the SDK to make it fit your app, as well as apply certain filters to the causes displayed by Ahillz to match your brand and the content inside the app.

A complete example of Ahillz SDK integration is available in the Ahillz Demo App. Get it by leaving your email.

Install and configure the SDK

You can install Ahillz SDK via CocoaPods. Please note that Ahillz CocoaPods repo may not be available right now, as it is under development.

  1. Install the latest version of the CocoaPods.
  2. Add Ahillz to your podfile:
    pod 'Ahillz'
  3. Install Ahillz pod by running:
    pod install
  4. Keep in mind that .xcworkspace file should be used to open your project in the Xcode instead of .xcodeproj file

Configure Ahillz during your app's launch

Initialize Ahillz during the app launch with your own public and secret key. Contact Ahillz team to get your keys.

import UIKit
import Stripe

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    Ahillz.initWithAppKey("demo_app_key", secretKey:"demo_secret_key")
    return true
  }
}

Enable Apple Pay donations

Apple Pay simplifies donation process, and will make your users enjoy giving via your app. Ahillz provides and manages merchant identifies for you. All you need to do is to enable Apple Pay capability in Target's settings and specify the following merchant id:

appleMerchantIdentifier = "merchant.com.ahillz.ahillzDemo"

Present Ahillz

Ahillz can be presented via ads (banner or interstitial) or directly on the click of your custom button.

For Ad Presentation you need to choose the type of ad — banner or interstitial. See images below to see the difference between them.

import UIKit
import Stripe

  class ViewController: UIViewController {

    override func viewDidLoad() {
      super.viewDidLoad()
      Ahillz.presentAhillzAdWithType(AhillzAdType.Interstitial, withRootViewController:self)
      // replace AhillzAdType.Interstitial with AhillzAdType.Banner to present banner
      // the ad will be presented as soon as possible after you call the method
    }
}

For Custom Presentation you need to implement Ahillz presentation code in your button click callback as described below.

import UIKit
import Stripe

  class ViewController: UIViewController {

    @IBAction func customButtonPressed(sender:UIButton) {
      Ahillz.presentAhillzWithRootViewController(self)
    }
}

See Ahillz in action

Download a demo app to give Ahillz a go. iOS devices only