Skip to content
项目

关于

让调试更轻松。自动为自定义对象生成 QuickLook 图像。

设计与媒体

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

CocoaDebugKit

Twitter: @PatrickKladek License Build Platform Tested Carthage compatible

Debugging made easy. Automatically create QuickLook images of custom objects.

This project helps developers to visualize custom objects and will therefore speed up your development process.

Lets say we have a custom Object called "Person" and want to inspect all variables in Xcode. This will look something like that:

alt text

With CocoaDebugKit it will look like this:

alt text

So how can we achieve this goal? It´s easy just add this Framework to your Project and implement this method in your custom object:

#import "Person.h"
#import <CocoaDebugKit/CocoaDebugKit.h>


@implementation Person

- (id)debugQuickLookObject
{
    return [CocoaDebugView debugViewWithAllPropertiesOfObject:self includeSuperclasses:YES];
}

@end

After that set a breakpoint in your code, select an object you want to inspect and hit space. This will open a small quicklook popover with the contents of your object.

Requirements

  • macOS 10.9+
  • iOS 8+
  • Xcode 11+

Installation

The prefered way to use CocoaDebugKit is via Carthage. Simply add this line to your cartfile:

github "Patrick-Kladek/CocoaDebugKit"

and run:

carthage update --platform ios

Known Limitations

  • NSObject rootclass required
  • Cocoa Runtime

Both of these limitations don't prevent you from using CocoaDebugKit. You can always create the debugView manually:

- (id)debugQuickLookObject
{
    CocoaDebugView *view = [CocoaDebugView debugView];

    [view addLineWithDescription:@"Image:" image:self.image];
    [view addLineWithDescription:@"First Name:" string:self.firstName];
    [view addLineWithDescription:@"Last Name:" string:self.lastName];
    [view addLineWithDescription:@"Birthday" date:self.birthday];

    return view;
}

Note

On iOS returning a UIView subclass to QuickLook may result in an empty preview. To fix this simply return an image.

return [[CocoaDebugView debugViewWithAllPropertiesOfObject:self includeSuperclasses:YES] imageRepresentation];

探索相关项目

加载中…