GithubHelp home page GithubHelp logo

justm0rph3u5 / batching Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phonepe/batching

0.0 1.0 0.0 710 KB

An iOS batching library for analytics events.

License: MIT License

Ruby 5.75% Objective-C 2.55% Swift 91.70%

batching's Introduction

Batching

A iOS batching library for analytics events.

Installation

CocoaPods

Add the following line to your Podfile:

pod 'Batching'

Usage

The Batching library uses core data (sqlite) to store events. Each event should be NSCoding compliant.

To initialise the PPBatchManager:

let batchManager = PPBatchManager(sizeStrategy: PPSizeBatchingStrategy(), timeStrategy: PPTimeBatchingStrategy(), dbName: "EventsDB")

You may customise the time and size strategies to suit your needs.

To add an event to the DB:

 batchManager.addToBatch(event, timestamp: Date().timeIntervalSince1970)

PPBatchManager flushes the events back to you using a delegate callback.

public func batchManagerShouldIngestBatch(_ manager: PPBatchManager, batch: [Any], completion: @escaping (Bool, Error?) -> Void) {
	//Here you may de-serialize your events and then feed it to an analytics service of your choice 
}

To force flush the events use:

batchManager.flush(true)

batching's People

Contributors

arorajatin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.