Skip to content

Settings

Patrick-Kladek edited this page May 25, 2017 · 5 revisions

This singleton class stores all the settings for the apperance of your debugViews and debugDescriptions.

You only need this class if you want to change the look of your debugViews. You can either set some properties in code or load them from a plist.

Load Settings:

- (void)loadSettings:(NSURL *)url

Use this method if you want to load settings from a plist file. You will find a complete list of supported keys on the end of this page. You can also use one of the default settings files in this repository. They all have different styles (inspired by the Xcode themes):

  • com.kladek.CocoaDebugKit.settings.default.plist
  • com.kladek.CocoaDebugKit.settings.dusk.plist
  • com.kladek.CocoaDebugKit.settings.basic.plist

Save Settings:

- (void)saveSettings:(NSURL *)url

Currently not supported.

Text

Text Color

Color Text Key

This property stores the color for all textfields.

@property (nonatomic) NSColor *textColor;

Text Font

Color Text Key Key

This property stores the Font of all Textfield.

@property (nonatomic) NSFont *textFont;

Keywords

The following Settings are for highlighting Keywords.

Highlight Keywords

Color Text Key

Currently the following keywords are highlighted:

  • nil, NULL, @"(null)"
  • YES, NO
@property (nonatomic) BOOL highlightKeywords;

Keyword Color

Color Text Key

This property stores the color of all keywords.

@property (nonatomic) NSColor *keywordColor;

Keyword Font

Color Text Key Key

This property stores the Font of all keywords.

@property (nonatomic) NSFont *keywordFont;

Numbers

Highlight Numbers

Color Text Key

If set numbers will be colored in a different color.

@property (nonatomic) BOOL highlightNumbers;

Number Color

Color Text Key

This property stores the Color of all numbers.

@property (nonatomic) BOOL numberColor;

Number Font

Color Text Key Key

This property stores the font of all Numbers

@property (nonatomic) NSFont numberFont;

Property Name

Propertynames (Keys) are drawn at the left side, while values are displayed on the right. Usually they have a lighter color so they are visually subtile while keys are stronger and a litle darker.

Example Image

Property Name Color

Color Text Key

This property stores the Color of all properties.

@property (nonatomic) NSColor *propertyNameColor;

Property Name Font

Color Text Key Key

This property stores the font of all Property Names

@property (nonatomic) NSFont propertyNameFont;

Title

Title Color

Color Text Key

This property stores the color of the title. Please keep in mind that this color and the color of the frame should have a high contrast.

@property (nonatomic) NSColor *titleColor;

Title Font

Color Text Key Key

This property stores the font of the Title

@property (nonatomic) NSFont *titleFont;

Data & Image

Now here comes the magic. Lets say you have an NSData property (which represent an image). To inspect the image/data you have to write some code, rebuild and navigate where you left. Or you could name your variable something like imageData and add image to the searchlist. Now every NSData object with image in its propertyName will be displayed as image and not as raw data.

Convert Data to Image

Color Text Key

To enable this feature this property must be set to TRUE.

@property (nonatomic) BOOL convertDataToImage;

Property Name Contains

Color Text Key

Furthermore this array must contain at least one entry otherwise the conversation won´t work.

@property (nonatomic) NSArray *propertyNameContains;

Image Size

Color Text Key

This property limits the size of an image. Use a resonable value or you are wasting a lot of space.

@property (nonatomic) NSSize imageSize;

Max Data Lenght

Color Text Key Only for DebugDescription.

You can cut a data objects lenght so it won´t produce a lot useless information. Just set the maxDataLenght property to a reasonable value.

@property (nonatomic) NSNumber *maxDataLenght;

Appearance

With this keys you can change the look of your views. For example change the Framecolor or Backgroundcolor.

Line Spacing

Color Text Key

This property stores the line space. The textfields are aligned vertically with linespacing in between.

@property (nonatomic) NSInteger lineSpace;

Background Color

Color Text Key

This property stores the background color information of the view.

@property (nonatomic) NSColor *backgroundColor;

Frame Color

Color Text Key

This property stores the Frame Color from which the frame gradient is created. The Gradient uses the frame color plus the same color with 20% more white. So it´s better to use some darker colors.

@property (nonatomic) NSColor *frameColor;

Color

Color Text Key

Colors are rendered as follows:

Because NSColor saves each rgb-channel as a float value we have to calculate the 8bit value. If you are using something other than a 8 bit colorspace you shoudld change this. You can set this property to 0 so the color channels are displayed as float values.

@property (nonatomic) NSInteger numberOfBitsPerColorComponent;

Date

Color Text Key

This property stores the dateFormat for the dateFormatter.

@property (nonatomic) NSString *dateFormat;

Auto Save

For Documentation you can also save each view automatically.

Save

Color Text Key

This property stores if the view is saved or not.

@property (nonatomic) BOOL save;

Save Path

Color Text Key

This property store the filepath where the view is saved. The File Structure look something like this

debugView/ Document Root

debugView/1.0 App Version

debugView/1.0/123 App Build Number

Because of the naming structure you should use a automated versioning tool. See Chapter Automated Versioning

@property (nonatomic) NSURL *saveUrl;

PDF

Color Text Key

This property decides if the saved file is a pdf or a png file.

@property (nonatomic) BOOL saveAsPDF;

Supported Keys

Here is a list of all supported keys.

debugView.keywords.highlight
debugView.keywords.color
debugView.keywords.font
debugView.keywords.size

debugView.numbers.highlight
debugView.numbers.color
debugView.numbers.font
debugView.numbers.size

debugView.text.color
debugView.text.font
debugView.text.size

debugView.propertyName.color
debugView.propertyName.font
debugView.propertyName.size

debugView.title.color
debugView.title.font
debugView.title.size

debugView.image.size
debugView.image.dataToImage
debugView.image.propertyNameContains

debugView.appearance.lineSpace
debugView.appearance.backgroundColor
debugView.appearance.frameColor
debugView.appearance.numberOfBitsPerColorComponent
debugView.appearance.save
debugView.appearance.path
debugView.appearance.usePDF

debugView.NSDate.format

debugDescription.NSData.cutLenght