github.com/rosberry/butterbroad



Documentation

ButterBroad

ButterBroad is a lightweight aggregator for different analytic components such as Facebook, Firebase, Crashlytics e.t.c.

Features

  • Combines different analytics components
  • Simple program interface

Requirements

  • iOS 10.0+
  • Xcode 8.0+

Installation

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add the framework to your project.

github "rosberry/ButterBroad"

Manually

Drag Sources folder from last release into your project.

Usage

  • Provide an adapter for analytic component by the implementing of Analytics protocol
  • Combine adapters using an instance of Butter class
import ButterBroad

extension Butter {
    static let common: Butter = .init(broads: <YOUR ADAPTERS THERE>)
}
  • Use logEvent method to send an event with custom name

Favorite broads

//  Butter+ApplicationBroads.swift
import UIKit
import ButterBroad
import AnalogBroad
import FacebookBroad
import FirebaseBroad

extension Butter {
    static let analog: AnalogBroad = .init()
    static let facebook: FacebookBroad = .init()
    static let firebase: FirebaseBroad = .init()
    static let common: Butter = .init(broads: analog, facebook, firebase)
}

//  AppDelegate.swift

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        Butter.common.activationHandler?()
        return true
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        Butter.facebook.activationHandler?()
    }
}

//  ViewController.swift

func logButtonClick() {
    Butter.common.logEvent(with: "button_click")
}

Authors

About

This project is owned and maintained by Rosberry. We build mobile apps for users worldwide 🌏.

Check out our open source projects, read our blog or give us a high-five on 🐦 @rosberryapps.

License

Butterbroad is available under the MIT license. See the LICENSE file for more info.