Getting Started

ReferralHero iOS Swift SDK

Getting Started

To start using the ReferralHero SDK, you will need to add it to your project as a framework. These can be downloaded from Here: https://github.com/maitre-app/ReferralHero-iOS

Manually

Step 1.

1. Visit the ReferralHero iOS SDK repository on GitHub: (https://github.com/maitre-app/ReferralHero-iOS).

2. You can either clone the repository using Git or download the ZIP file directly from GitHub. To clone, use the terminal with the command: `git clone https://github.com/maitre-app/ReferralHero-iOS.git`. If downloading the ZIP, extract it to a known location on your system.

Step 2.

1. Open your Xcode project.

2. Right-click on your project navigator and select "Add Files to [YourProjectName]".

3. Navigate to the location where you cloned or extracted the ReferralHero SDK. You should add the entire `ReferralHero.framework` to your project. Make sure "Copy items if needed" is checked so the framework is copied into your project directory.

Step 2.

1. Select your project in the Project Navigator to bring up the project settings.

2. Select your target and go to the "General" tab.

3. Scroll down to "Frameworks, Libraries, and Embedded Content".

4. Make sure `ReferralHero.framework` is listed and set to "Embed & Sign". This ensures the framework will be embedded into your app's bundle.

Step 3.

Import ReferralHero in AppDelegate.swift

import UIKit
import ReferralHero_iOS

If there is no AppDelegate, where @main identifier is present in App function

import SwiftUI
import ReferralHero_iOS

@main
struct Rh_TesteApp: App {

Step 4.

Import ReferralHero in AppDelegate.swift., Or where @main identifier is present in App function.

  • Back in the ReferralHero overview, you should enter your desired Campaign

  • click on Edit, so you can enter the Campaign

  • Then the Installation tab, then Mobile App Installation

  • Get your UUID: The 12-letter ID that starts with ‘MF’ in the Tracking Code, e.g. MF078d000987

Now, you should add The Campaign Token Obtained from the campaign, and UUID from the installation Tab.


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
   
        RHApiKey.configure(withAPIKey: "API_TOKEN", withuuID: "UUID")
        return true
    }

Well done! You should now be able to build and run your campaign. Before using the more advanced features of the SDK, you should learn about a couple of important concepts.

There are a few major components in the SDK that you can include in your app.

Last updated