<commit_before>![Gilt Tech logo](Documentation/images/gilt-tech-logo.png)

# Mockingbird Toolbox

The Mockingbird Toolbox is a set of general-purpose utility code for use in iOS applications.

The Toolbox is the lowest-level module in the Mockingbird Library open-source project from Gilt Groupe.

**Master branch status:**

[![Build Status](https://travis-ci.org/gilt/mockingbird-toolbox.svg?branch=master)](https://travis-ci.org/gilt/mockingbird-toolbox)

## Highlights

The Mockingbird Toolbox includes:

### Battery & Power Monitoring

The `MBBatteryMonitor` class reports the device’s power status and battery level, and also posts events through the `NSNotificationCenter` when these values change.

### Network Monitoring

The `MBNetworkMonitor` class provides details about the current status of the device’s wifi and carrier network, and can also be configured to post `NSNotificationCenter` events as network status changes occur.

### Caching

Mockingbird Toolbox provides a simple but extensible caching architecture.

The `MBThreadsafeCache` class implements a basic memory cache that can be safely shared across threads.

A subclass, `MBFilesystemCache`, adds a filesystem backing store to the memory cache.

### Thread-Local Storage

`MBThreadLocalStorage` provides an interface for safely sharing thread-local storage among unrelated units of code.

The class can also be used as a lock-free cache: Objects that are expensive to create, such as `NSDateFormatter` instances, can be cached in thread-local storage without incurring the locking overhead required by a shared object cache like `MBThreadsafeCache`.

### Regular Expressions

The Mockingbird Toolbox provides `NSString` and `NSMutableString` class extensions to help create, manipulate, and execute regular expressions.

These extensions make use of the `MBRegexCache` for reusing regular expressions, which can be expensive to create.

### Message Digests

The `MBMessageDigest` class provides a high-level API for generating MD5 and SHA-1 secure one-way hashes from strings, `NSData` instances, byte arrays, and files.

Class extensions for `NSString` and `NSData` are also provided to simplify creating message digests from existing objects.

### Network Activity Indicator

The `MBNetworkIndicator` class provides a mechanism to coordinate the display of the status bar network activity indicator.

### Colors

Mockingbird Toolbox includes various utilities for creating, examining, and manipulating colors.

### Images

The Toolbox contains a `UIImage` class extension that adds methods for scaling images, as well as a `UIView` class extension for capturing the contents of a view as a `UIImage`, `CIImage` or `CGImageRef`.

### Bitmaps

The `MBBitmapPixelPlane` class represents a plane of pixels that can be accessed individually, regardless of the underlying pixel format. This allows direct extraction and manipulation of pixel data within a bitmap.

### ...and more

That’s just a quick summary.

For further details, start with [the Mockingbird Toolbox API documentation](https://rawgit.com/gilt/mockingbird-toolbox/master/Documentation/html/index.html).

## Integrating with Mockingbird Toolbox

There are several ways you can make use of Mockingbird Toolbox:

* [Embedding the Project File](#embedding-the-project-file)
* [Building the Static Libraries](#building-the-static-libraries)
* Building the Framework — __*support coming soon*__ (only for iOS 8+)
* Using Cocoapods — __*support coming soon*__

### Embedding the Project File

You can add Mockingbird Toolbox to an existing Xcode project by embedding the `MBToolbox.xcodeproj` project file.

If your project relies on the default “Debug” and “Release” build configurations created by Xcode, your selection for that setting will cascade down to the Toolbox when it is built. This is handy if you find yourself needing to do debugging within the Toolbox itself.

When you embed the project file, you will need to modify your current project’s build settings to ensure your targets can link against the library binary and Xcode can find the necessary header files.

Here’s how you can incorporate Mockingbird Toolbox through project file embedding:

#### I. Embedding

1. In Xcode, Open the project file to which you want to add Mockingbird Toolbox. 

2. In the Navigator sidebar, select the first tab, the **Project Navigator**. You can display it quickly by pressing ⌘1.

3. Select the item representing your project in the Project Navigator. Unless you have a complicated project structure, your project will be the topmost item in the tree.

4. In the **File** menu, select “Add Files to...”.

5. Locate the `MBToolbox.xcodeproj` file, select it, and press the **Add** button.

#### II. Build “MBToolbox”

Once you’ve embedded the project file, perform an Xcode build using the “MBToolbox” scheme.<commit_msg>remove reference to framework support<commit_after>![Gilt Tech logo](Documentation/images/gilt-tech-logo.png)

# Mockingbird Toolbox

The Mockingbird Toolbox is a set of general-purpose utility code for use in iOS applications.

The Toolbox is the lowest-level module in the Mockingbird Library open-source project from Gilt Groupe.

**Master branch status:**

[![Build Status](https://travis-ci.org/gilt/mockingbird-toolbox.svg?branch=master)](https://travis-ci.org/gilt/mockingbird-toolbox)

## Highlights

The Mockingbird Toolbox includes:

### Battery & Power Monitoring

The `MBBatteryMonitor` class reports the device’s power status and battery level, and also posts events through the `NSNotificationCenter` when these values change.

### Network Monitoring

The `MBNetworkMonitor` class provides details about the current status of the device’s wifi and carrier network, and can also be configured to post `NSNotificationCenter` events as network status changes occur.

### Caching

Mockingbird Toolbox provides a simple but extensible caching architecture.

The `MBThreadsafeCache` class implements a basic memory cache that can be safely shared across threads.

A subclass, `MBFilesystemCache`, adds a filesystem backing store to the memory cache.

### Thread-Local Storage

`MBThreadLocalStorage` provides an interface for safely sharing thread-local storage among unrelated units of code.

The class can also be used as a lock-free cache: Objects that are expensive to create, such as `NSDateFormatter` instances, can be cached in thread-local storage without incurring the locking overhead required by a shared object cache like `MBThreadsafeCache`.

### Regular Expressions

The Mockingbird Toolbox provides `NSString` and `NSMutableString` class extensions to help create, manipulate, and execute regular expressions.

These extensions make use of the `MBRegexCache` for reusing regular expressions, which can be expensive to create.

### Message Digests

The `MBMessageDigest` class provides a high-level API for generating MD5 and SHA-1 secure one-way hashes from strings, `NSData` instances, byte arrays, and files.

Class extensions for `NSString` and `NSData` are also provided to simplify creating message digests from existing objects.

### Network Activity Indicator

The `MBNetworkIndicator` class provides a mechanism to coordinate the display of the status bar network activity indicator.

### Colors

Mockingbird Toolbox includes various utilities for creating, examining, and manipulating colors.

### Images

The Toolbox contains a `UIImage` class extension that adds methods for scaling images, as well as a `UIView` class extension for capturing the contents of a view as a `UIImage`, `CIImage` or `CGImageRef`.

### Bitmaps

The `MBBitmapPixelPlane` class represents a plane of pixels that can be accessed individually, regardless of the underlying pixel format. This allows direct extraction and manipulation of pixel data within a bitmap.

### ...and more

That’s just a quick summary.

For further details, start with [the Mockingbird Toolbox API documentation](https://rawgit.com/gilt/mockingbird-toolbox/master/Documentation/html/index.html).

## Integrating with Mockingbird Toolbox

There are several ways you can make use of Mockingbird Toolbox:

* [Embedding the Project File](#embedding-the-project-file)
* [Building the Static Libraries](#building-the-static-libraries)
* Using Cocoapods — __*support coming soon*__

### Embedding the Project File

You can add Mockingbird Toolbox to an existing Xcode project by embedding the `MBToolbox.xcodeproj` project file.

If your project relies on the default “Debug” and “Release” build configurations created by Xcode, your selection for that setting will cascade down to the Toolbox when it is built. This is handy if you find yourself needing to do debugging within the Toolbox itself.

When you embed the project file, you will need to modify your current project’s build settings to ensure your targets can link against the library binary and Xcode can find the necessary header files.

Here’s how you can incorporate Mockingbird Toolbox through project file embedding:

#### I. Embedding

1. In Xcode, Open the project file to which you want to add Mockingbird Toolbox. 

2. In the Navigator sidebar, select the first tab, the **Project Navigator**. You can display it quickly by pressing ⌘1.

3. Select the item representing your project in the Project Navigator. Unless you have a complicated project structure, your project will be the topmost item in the tree.

4. In the **File** menu, select “Add Files to...”.

5. Locate the `MBToolbox.xcodeproj` file, select it, and press the **Add** button.

#### II. Build “MBToolbox”

Once you’ve embedded the project file, perform an Xcode build using the “MBToolbox” scheme.
{'fraction_non_alphanumeric': 0.06316551225059444, 'fraction_numerical': 0.0017574692442882249, 'mean_word_length': 5.0199128811449905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1283541', 'n_tokens_mistral': 2480, 'n_tokens_neox': 2414, 'n_words': 1272}