Installation

Choose your platform to get started with the ViralTech SDK:

Node.js / React Native

Install the SDK using npm:

npm install @viral-tech/sdk

Or using yarn:

yarn add @viral-tech/sdk

iOS (Swift)

Add the SDK to your Xcode project using Swift Package Manager:

  1. In Xcode, select File > Add Packages
  2. Enter the package URL: https://github.com/viral-development/viral-tech-sdk-swift
  3. Select “Up to Next Major Version” for dependency rule

Quick Start

Node.js / React Native

import { ViralTech } from '@viral-tech/sdk';

// Initialize the SDK
const viralTech = new ViralTech();

// Log a download
try {
    const result = await viralTech.logDownload();
    if (result.success) {
        console.log('Download logged successfully');
    } else {
        console.error('Error logging download:', result.error);
    }
} catch (error) {
    console.error('Error:', error);
}

// Log a conversion
try {
    const result = await viralTech.logConversion();
    if (result.success) {
        console.log('Conversion logged successfully');
    } else {
        console.error('Error logging conversion:', result.error);
    }
} catch (error) {
    console.error('Error:', error);
}

iOS (Swift)

import ViralTechSDK

// Initialize the SDK
let viralTech = ViralTech()

// Log a download
Task {
    let result = await viralTech.logDownload()
    switch result {
    case .success:
        print("Download logged successfully")
    case .failure(let error):
        print("Error logging download: \(error)")
    }
}

// Log a conversion
Task {
    let result = await viralTech.logConversion()
    switch result {
    case .success:
        print("Conversion logged successfully")
    case .failure(let error):
        print("Error logging conversion: \(error)")
    }
}