Created
April 30, 2014 11:53
-
-
Save m1entus/9e1579808a2e9ae1f086 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation NSDictionary (QuickLook) | |
- (id)debugQuickLookObject | |
{ | |
NSData *data = [NSJSONSerialization dataWithJSONObject:self options:NSJSONWritingPrettyPrinted error:nil]; | |
NSString *JSONString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; | |
NSString *embedHTML = [NSString stringWithFormat:@"<html><head></head><body><pre>%@</pre></body></html>",JSONString]; | |
NSURL *temporaryDirectory = [NSURL fileURLWithPath:NSTemporaryDirectory() isDirectory:YES]; | |
NSURL *file = [[temporaryDirectory URLByAppendingPathComponent:@"dictionaryQuickLook"] URLByAppendingPathExtension:@"html"]; | |
[[NSFileManager defaultManager] removeItemAtURL:file error:nil]; | |
[embedHTML writeToURL:file atomically:YES encoding:NSUTF8StringEncoding error:nil]; | |
return file; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment