Integrating and initializing the SDK

Installation with CocoaPods

We host our own cocoapods repository, so you have to add it to your sources by adding this line to your Podfile

source 'git@git.tickaroo.com:pub/CocoaPods.git'

Add the TickarooSDK pod to your Podfile by inserting the following line where applicable:

pod 'TickarooSDK'

Example Podfile:

source 'https://github.com/CocoaPods/Specs.git'
source 'git@git.tickaroo.com:pub/CocoaPods.git'

target 'TickarooSDKTest' do
    pod 'TickarooSDK'
end

Integrating and initializing the SDK

The SDK should be initialized at application-launch, so add

Objective-C

#import <TickarooSDK/TickarooSDK.h>

OR

@import TickarooSDK;

Swift

import TickarooSDK

at the top of your UIApplicationDelegate.

In - (void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;

of your UIApplicationDelegate you need to call the initialization-code of the TickarooSDK

Objective-C

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    ...

    [TickarooSDK application:application didFinishLaunchingWithOptions:launchOptions
                       delegate:yourDelegate
                        options:@{
                            ...
                        }
                        styling:@{
                            ...
                            }
    ];
    return YES;
}

Swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
    ...
        
    TickarooSDK.application(application, didFinishLaunchingWithOptions: launchOptions, 
        delegate: yourDelegate,
        options: [
            ...
        ], 
        styling: [
            ...
        ])

    return true
}    

your TickarooSDKDelegate (for Example the UIApplicationDelegate) needs to implement the following method

- (UINavigationController *)rootNavigationControllerForTickarooSDK:(TickarooSDK *)tickarooSDK;

and return an UINavigationController Instance for the Embeded Ticker to work on. The SDK will use this controller for pushing and presenting new ViewControllers if necessary.

Example AppDelegate.m:

Objective-C

#import "AppDelegate.h"
#import "ViewController.h"

@import TickarooSDK;

@interface AppDelegate ()<TickarooSDKDelegate>

@property (strong, nonatomic) UINavigationController *rootNavigationController;

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    _window = [[UIWindow alloc] initWithFrame: UIScreen.mainScreen.bounds];
    _rootNavigationController = [[UINavigationController alloc] initWithRootViewController:ViewController.new];
    _rootNavigationController.navigationBar.translucent = false;
    _window.rootViewController = _rootNavigationController;
    [_window makeKeyAndVisible];
    
    [TickarooSDK application:application didFinishLaunchingWithOptions:launchOptions
                    delegate:self
                     options:@{
                               TickarooOptionScoreboardImageMode : @(T2ScoreboardImageModeOwner),
                               TickarooOptionRefreshBehavior :@(T2RefreshUser),
                               TickarooOptionApiClientID : @"1234567890",
                               TickarooOptionApiHost : @"staging.tickaroo.com",
                               TickarooOptionLanguage : @"de"
                               }
                     styling:@{
                               TickarooStylingButtonCornerRadius : @(5),
                               TickarooStylingImageCornerRadius : @(5)
                            }];
    return YES;
}

#pragma mark - TickarooSDKDelegate
- (UINavigationController *)rootNavigationControllerForTickarooSDK:(TickarooSDK *)tickarooSDK {
    return _rootNavigationController;
}

Swift

import UIKit
import TickarooSDK

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    let viewController = ViewController()
    lazy var rootNavigationController = UINavigationController(rootViewController: viewController)
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        window = UIWindow(frame: UIScreen.main.bounds)
        rootNavigationController.navigationBar.isTranslucent = false
        window?.rootViewController = rootNavigationController
        window?.makeKeyAndVisible()
        
        TickarooSDK.application(application, didFinishLaunchingWithOptions: launchOptions, delegate: self, options: [
                TickarooOptionScoreboardImageMode: NSNumber(value: T2ScoreboardImageModeOwner.rawValue),
                TickarooOptionApiClientID: "1234567890",
                TickarooOptionApiHost: "staging.tickaroo.com",
                TickarooOptionLanguage: "de"
            ], styling: [
                TickarooStylingButtonCornerRadius: NSNumber(value: 5),
                TickarooStylingImageCornerRadius: NSNumber(value: 5)
            ])
        
        return true
    }
}

extension AppDelegate: TickarooSDKDelegate {
    func rootNavigationController(for tickarooSDK: TickarooSDK!) -> UINavigationController! {
        return rootNavigationController
    }
}

Options

You can configure the SDK during initialization with the following keys

Required

  • TickarooOptionApiClientID
    • NSString your clientID for tickaroo

Optional

Debug

  • TickarooOptionApiSchema
    • NSString (http or https), default is https
  • TickarooOptionApiHost
    • NSString (www.tickaroo.com or staging.tickaroo.com for tests)
  • TickarooOptionApiPort
    • NSNumber
  • TickarooOptionDisplayDebugViews
    • NSNumber @YES or @NO; if @YES views describing the content will be displayed