Giter Site home page Giter Site logo

baymax's Introduction

Baymax

Build Status Swift 5.5 Apache 2

Baymax is a diagnostics tool for iOS apps which allows you and 3rd party frameworks to provide diagnostics via a shared interface.

Installation

Carthage

Carthage is the our suggested method for including Baymax into your iOS project or framework. Carthage is a package manager which either builds projects and provides you with binaries or uses pre-built frameworks from release tags in GitHub. To add Baymax to your project, simply specify it in your Cartfile:

github "3sidedcube/Baymax" ~> 2.0.0

We recommend that you build with xcframeworks:

carthage update --platform ios --use-xcframeworks

Usage

Attaching Baymax to your window

Baymax must be attached to your app window in order to display UI when the user performs (currently) a 4 finger swipe upwards on the device:

DiagnosticsManager.shared.attach(to: myWindow)

the function accepts a window object, and an optional closure which can be used to provide a login mechanism for accessing Baymax's UI for the case where you might not want users to be able to access your diagnostics tools.

Registering a set of diagnostic tools

DiagnosticServiceProvider protocol

To register yourself as a diagnostics provider, you need to conform to the DiagnosticsServiceProvider and then call:

DiagnosticsManager.sharedInstance.register(provider: myProvider)

DiagnosticsServiceProvider is a simple protocol which requires only two properties to be implemented:

serviceName (String)

This provides the readable name which will be displayed at the root level of Baymax's UI. It should represent your tool fairly so users know what each provider in baymax provides for them.

diagnosticsTools (Array<DiagnosticTool>)

This provides an array of tools, which will be rendered for selection when the user clicks the entry in the main UI for your service provider.

DiagnosticTool protocol

DiagnosticTool is also a simple protocol with one property, and one function that need implementing:

displayName (String)

This provides the readable name that will be displayed in Baymax's UI once the user has clicked into your provider.

launchUI (Function)

func launchUI(in navigationController: UINavigationController)

launchUI function gets passed the current navigation controller that Baymax is using for it's UI, allowing you to push/present whatever UI you would like for your tool. This is called when the user clicks the table cell for an individual tool.

Logging

Baymax provides an alternative to Apple's os_log function, which will save logs to the user's documents directory, they will also be viewable using the Logs tool provided by default by baymax. The logger can be used like so:

baymax_log("App Launch", category: "App Lifecycle", type: .debug)

the function also supports providing a subsystem like the os_log function. This function will NOT also write to os_log so you should make sure you are still logging there if you want to utilise Apple's logging tools.

Default Tools

Logging

The logging tool allows you to view, share and delete logs created by calling baymax_log or manually using a Logger object.

Property List Viewer

The property list viewer allows you to view the contents of your app's Info.plist!

baymax's People

Contributors

benshutt avatar mattcheetham avatar simonmitchell 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.