Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrudel committed Jan 3, 2016
1 parent 5ab336b commit 40dd3b7
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Pod/Classes/MZCoreDataBrowserViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,49 @@

@class NSManagedObjectContext;

/**
This class defines a view controller which presents the objects within a Core
Data Managed Object Context and allows for inspection of the objects contained
therein, as well as navigation between relations. It is designed to be used
as part of a debug / developer menu within an application and isn't intended to
form the basis of any user-facing UI.
`MZCoreDataBrowserViewController` automatically iterates over all entity types
within your MOC, and displays a list of each entity's objects at a top level.
As you navigate into an object, you are able to quickly walk relations between
objects as well as do detailed inspections of an object's attributes.
For best results, your model objects should override `-description` to present
a useful short summary of this object; this method is used to populate the
description of an object in the top-level browser and within the list of
relation objects.
This View Controller must be presented within a UINavigationController.
*/
@interface MZCoreDataBrowserViewController : UITableViewController

/**
The MOC whose contents this browser is to display.
*/
@property NSManagedObjectContext *context;

/**
Specifies that the objects within this browser's context should be grouped by
their root entity type. This is useful when browsing models which make
extensive use of subclassing and class cluster style patterns.
This property only applies to the top level object list in the browser; object
lists describing the relations of are implicitly grouped by whatever the
destination type of the relation is.
The default for this property is NO.
*/
@property BOOL groupByRootEntity;

/**
Initialize a new browser instance, setting the browser's context to be the passed
value
*/
- (instancetype)initWithManagedObjectContext:(NSManagedObjectContext *)context NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,32 @@
[![License](https://img.shields.io/cocoapods/l/MZCoreDataBrowser.svg?style=flat)](http://cocoapods.org/pods/MZCoreDataBrowser)
[![Platform](https://img.shields.io/cocoapods/p/MZCoreDataBrowser.svg?style=flat)](http://cocoapods.org/pods/MZCoreDataBrowser)

`MZCoreDataBrowser` provides a super quick way to visualize and navigate your
Core Data models. It is designed to be used within a debug / developer menu
in an application to give you easy and deep visibility into the state of your
model data. It's dead-simple to integrate, and automatically discovers all
entities and objects within your Core Data stack.

## Usage

`MZCoreDataBrowser` is designed to be trivial to integrate with your
application. In virtually all cases, all you need to do is instantiate an
instance of `MZCoreDataBrowserViewController` and set its `context` property to
be the MOC you wish to browse. It's equally happy being instantiated via
storyboards or code. Something like the following is all you typically need:

MZCoreDataBrowserViewController *browser = [[MZCoreDataBrowserViewController alloc] initWithManagedObjectContext:self.context];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:browser];
[self presentViewController:navController animated:YES completion:nil];

To see an example of storyboard integration, check out the Example project.

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements

At least iOS 7 and ARC is required.

## Installation

MZCoreDataBrowser is available through [CocoaPods](http://cocoapods.org). To install
Expand Down

0 comments on commit 40dd3b7

Please sign in to comment.