├── .gitignore ├── JSONSyntaxHighlight.h ├── JSONSyntaxHighlight.m ├── JSONSyntaxHighlight.podspec ├── JSONSyntaxHighlight.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── JSONSyntaxHighlight ├── Mac Example │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── JSONSyntaxHighlightMac-Info.plist │ ├── en.lproj │ │ └── MainMenu.xib │ └── main.m ├── example.json └── iOS Example │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Default-568h@2x.png │ ├── Default.png │ ├── Default@2x.png │ ├── JSONSyntaxHighlightiOS-Info.plist │ ├── JSONSyntaxHighlightiOS-Prefix.pch │ ├── ViewController.h │ ├── ViewController.m │ ├── en.lproj │ ├── InfoPlist.strings │ ├── MainStoryboard_iPad.storyboard │ └── MainStoryboard_iPhone.storyboard │ └── main.m ├── LICENSE.txt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ######################### 2 | # .gitignore file for Xcode4 / OS X Source projects 3 | # 4 | # Version 2.0 5 | # For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects 6 | # 7 | # 2013 updates: 8 | # - fixed the broken "save personal Schemes" 9 | # 10 | # NB: if you are storing "built" products, this WILL NOT WORK, 11 | # and you should use a different .gitignore (or none at all) 12 | # This file is for SOURCE projects, where there are many extra 13 | # files that we want to exclude 14 | # 15 | ######################### 16 | 17 | ##### 18 | # OS X temporary files that should never be committed 19 | 20 | .DS_Store 21 | *.swp 22 | *.lock 23 | profile 24 | 25 | 26 | #### 27 | # Xcode temporary files that should never be committed 28 | # 29 | # NB: NIB/XIB files still exist even on Storyboard projects, so we want this... 30 | 31 | *~.nib 32 | 33 | 34 | #### 35 | # Xcode build files - 36 | # 37 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData" 38 | 39 | DerivedData/ 40 | 41 | # NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build" 42 | 43 | build/ 44 | 45 | 46 | ##### 47 | # Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) 48 | # 49 | # This is complicated: 50 | # 51 | # SOMETIMES you need to put this file in version control. 52 | # Apple designed it poorly - if you use "custom executables", they are 53 | # saved in this file. 54 | # 99% of projects do NOT use those, so they do NOT want to version control this file. 55 | # ..but if you're in the 1%, comment out the line "*.pbxuser" 56 | 57 | *.pbxuser 58 | *.mode1v3 59 | *.mode2v3 60 | *.perspectivev3 61 | # NB: also, whitelist the default ones, some projects need to use these 62 | !default.pbxuser 63 | !default.mode1v3 64 | !default.mode2v3 65 | !default.perspectivev3 66 | 67 | 68 | #### 69 | # Xcode 4 - semi-personal settings 70 | # 71 | # 72 | # OPTION 1: --------------------------------- 73 | # throw away ALL personal settings (including custom schemes! 74 | # - unless they are "shared") 75 | # 76 | # NB: this is exclusive with OPTION 2 below 77 | xcuserdata 78 | 79 | # OPTION 2: --------------------------------- 80 | # get rid of ALL personal settings, but KEEP SOME OF THEM 81 | # - NB: you must manually uncomment the bits you want to keep 82 | # 83 | # NB: this is exclusive with OPTION 1 above 84 | # 85 | #xcuserdata/**/* 86 | 87 | # (requires option 2 above): Personal Schemes 88 | # 89 | #!xcuserdata/**/xcschemes/* 90 | 91 | #### 92 | # XCode 4 workspaces - more detailed 93 | # 94 | # Workspaces are important! They are a core feature of Xcode - don't exclude them :) 95 | # 96 | # Workspace layout is quite spammy. For reference: 97 | # 98 | # /(root)/ 99 | # /(project-name).xcodeproj/ 100 | # project.pbxproj 101 | # /project.xcworkspace/ 102 | # contents.xcworkspacedata 103 | # /xcuserdata/ 104 | # /(your name)/xcuserdatad/ 105 | # UserInterfaceState.xcuserstate 106 | # /xcsshareddata/ 107 | # /xcschemes/ 108 | # (shared scheme name).xcscheme 109 | # /xcuserdata/ 110 | # /(your name)/xcuserdatad/ 111 | # (private scheme).xcscheme 112 | # xcschememanagement.plist 113 | # 114 | # 115 | 116 | #### 117 | # Xcode 4 - Deprecated classes 118 | # 119 | # Allegedly, if you manually "deprecate" your classes, they get moved here. 120 | # 121 | # We're using source-control, so this is a "feature" that we do not want! 122 | 123 | *.moved-aside 124 | 125 | 126 | #### 127 | # UNKNOWN: recommended by others, but I can't discover what these files are 128 | # 129 | # ...none. Everything is now explained. 130 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight.h: -------------------------------------------------------------------------------- 1 | /** 2 | * JSONSyntaxHighlight.h 3 | * JSONSyntaxHighlight 4 | * 5 | * Syntax highlight JSON 6 | * 7 | * Created by Dave Eddy on 8/3/13. 8 | * Copyright (c) 2013 Dave Eddy. All rights reserved. 9 | * 10 | * The MIT License (MIT) 11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, and to permit persons to whom the Software is 17 | * furnished to do so, subject to the following conditions: 18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software. 21 | * 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | * THE SOFTWARE. 29 | */ 30 | 31 | #import 32 | 33 | #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 34 | #import 35 | #else 36 | #import 37 | #endif 38 | 39 | @interface JSONSyntaxHighlight : NSObject 40 | 41 | // Create the object by giving a JSON object, nil will be returned 42 | // if the object can't be serialized 43 | - (JSONSyntaxHighlight *)init; 44 | - (JSONSyntaxHighlight *)initWithJSON:(id)JSON; 45 | 46 | // Return an NSAttributedString with the highlighted JSON in a pretty format 47 | - (NSAttributedString *)highlightJSON; 48 | 49 | // Return an NSAttributedString with the highlighted JSON optionally pretty formatted 50 | - (NSAttributedString *)highlightJSONWithPrettyPrint:(BOOL)prettyPrint; 51 | 52 | // Fire a callback for every key item found in the parsed JSON, each callback 53 | // is fired with the NSRange the substring appears in `self.parsedJSON`, as well 54 | // as the NSString at that location. 55 | - (void)enumerateMatchesWithIndentBlock:(void(^)(NSRange, NSString*))indentBlock 56 | keyBlock:(void(^)(NSRange, NSString*))keyBlock 57 | valueBlock:(void(^)(NSRange, NSString*))valueBlock 58 | endBlock:(void(^)(NSRange, NSString*))endBlock; 59 | 60 | // The JSON object, unmodified 61 | @property (readonly, nonatomic, strong) id JSON; 62 | 63 | // The serialized JSON string 64 | @property (readonly, nonatomic, strong) NSString *parsedJSON; 65 | 66 | // The attributes for Attributed Text 67 | @property (nonatomic, strong) NSDictionary *defaultAttributes; 68 | @property (nonatomic, strong) NSDictionary *keyAttributes; 69 | @property (nonatomic, strong) NSDictionary *stringAttributes; 70 | @property (nonatomic, strong) NSDictionary *nonStringAttributes; 71 | 72 | // Platform dependent helper functions 73 | #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 74 | + (UIColor *)colorWithRGB:(NSInteger)rgbValue; 75 | + (UIColor *)colorWithRGB:(NSInteger)rgbValue alpha:(CGFloat)alpha; 76 | #else 77 | + (NSColor *)colorWithRGB:(NSInteger)rgbValue; 78 | + (NSColor *)colorWithRGB:(NSInteger)rgbValue alpha:(CGFloat)alpha; 79 | #endif 80 | 81 | @end -------------------------------------------------------------------------------- /JSONSyntaxHighlight.m: -------------------------------------------------------------------------------- 1 | /** 2 | * JSONSyntaxHighlight.h 3 | * JSONSyntaxHighlight 4 | * 5 | * Syntax highlight JSON 6 | * 7 | * Created by Dave Eddy on 8/3/13. 8 | * Copyright (c) 2013 Dave Eddy. All rights reserved. 9 | * 10 | * The MIT License (MIT) 11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, and to permit persons to whom the Software is 17 | * furnished to do so, subject to the following conditions: 18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software. 21 | * 22 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | * THE SOFTWARE. 29 | */ 30 | 31 | #import "JSONSyntaxHighlight.h" 32 | 33 | @implementation JSONSyntaxHighlight { 34 | NSRegularExpression *regex; 35 | } 36 | 37 | #pragma mark Object Initializer 38 | // Must init with a JSON object 39 | - (JSONSyntaxHighlight *)init 40 | { 41 | return nil; 42 | } 43 | 44 | - (JSONSyntaxHighlight *)initWithJSON:(id)JSON 45 | { 46 | self = [super init]; 47 | if (self) { 48 | // save the origin JSON 49 | _JSON = JSON; 50 | 51 | // create the object local regex 52 | regex = [NSRegularExpression regularExpressionWithPattern:@"^( *)(\".+\" : )?(\"[^\"]*\"|[\\w.+-]*)?([,\\[\\]{}]?,?$)" 53 | options:NSRegularExpressionAnchorsMatchLines 54 | error:nil]; 55 | 56 | // parse the JSON if possible 57 | if ([NSJSONSerialization isValidJSONObject:self.JSON]) { 58 | NSJSONWritingOptions options = NSJSONWritingPrettyPrinted; 59 | NSData *data = [NSJSONSerialization dataWithJSONObject:self.JSON options:options error:nil]; 60 | NSString *o = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; 61 | _parsedJSON = o; 62 | } else { 63 | _parsedJSON = [NSString stringWithFormat:@"%@", self.JSON]; 64 | } 65 | 66 | // set the default attributes 67 | self.nonStringAttributes = @{NSForegroundColorAttributeName: [self.class colorWithRGB:0x000080]}; 68 | self.stringAttributes = @{NSForegroundColorAttributeName: [self.class colorWithRGB:0x808000]}; 69 | self.keyAttributes = @{NSForegroundColorAttributeName: [self.class colorWithRGB:0xa52a2a]}; 70 | } 71 | return self; 72 | } 73 | 74 | #pragma mark - 75 | #pragma mark JSON Highlighting 76 | - (NSAttributedString *)highlightJSON 77 | { 78 | return [self highlightJSONWithPrettyPrint:YES]; 79 | } 80 | 81 | - (NSAttributedString *)highlightJSONWithPrettyPrint:(BOOL)prettyPrint 82 | { 83 | NSMutableAttributedString *line = [[NSMutableAttributedString alloc] initWithString:@""]; 84 | [self enumerateMatchesWithIndentBlock: 85 | // The indent 86 | ^(NSRange range, NSString *s) { 87 | NSAttributedString *as = [[NSAttributedString alloc] initWithString:s attributes:self.defaultAttributes]; 88 | if (prettyPrint) [line appendAttributedString:as]; 89 | } 90 | keyBlock: 91 | // The key (with quotes and colon) 92 | ^(NSRange range, NSString *s) { 93 | // I hate this: this changes `"key" : ` to `"key"` 94 | NSString *key = [s substringToIndex:s.length - 3]; 95 | [line appendAttributedString:[[NSAttributedString alloc] initWithString:key attributes:self.keyAttributes]]; 96 | NSString *colon = prettyPrint ? @" : " : @":"; 97 | [line appendAttributedString:[[NSAttributedString alloc] initWithString:colon attributes:self.defaultAttributes]]; 98 | } 99 | valueBlock: 100 | // The value 101 | ^(NSRange range, NSString *s) { 102 | NSAttributedString *as; 103 | if ([s rangeOfString:@"\""].location == NSNotFound) // literal or number 104 | as = [[NSAttributedString alloc] initWithString:s attributes:self.nonStringAttributes]; 105 | else // string 106 | as = [[NSAttributedString alloc] initWithString:s attributes:self.stringAttributes]; 107 | 108 | [line appendAttributedString:as]; 109 | } 110 | endBlock: 111 | // The final comma, or ending character 112 | ^(NSRange range, NSString *s) { 113 | NSAttributedString *as = [[NSAttributedString alloc] initWithString:s attributes:self.defaultAttributes]; 114 | [line appendAttributedString:as]; 115 | if (prettyPrint) [line appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n"]]; 116 | }]; 117 | 118 | if ([line isEqualToAttributedString:[[NSAttributedString alloc] initWithString:@""]]) 119 | line = [[NSMutableAttributedString alloc] initWithString:self.parsedJSON]; 120 | return line; 121 | } 122 | 123 | #pragma mark JSON Parser 124 | - (void)enumerateMatchesWithIndentBlock:(void(^)(NSRange, NSString*))indentBlock 125 | keyBlock:(void(^)(NSRange, NSString*))keyBlock 126 | valueBlock:(void(^)(NSRange, NSString*))valueBlock 127 | endBlock:(void(^)(NSRange, NSString*))endBlock 128 | { 129 | [regex enumerateMatchesInString:self.parsedJSON 130 | options:0 131 | range:NSMakeRange(0, self.parsedJSON.length) 132 | usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop) { 133 | 134 | NSRange indentRange = [match rangeAtIndex:1]; 135 | NSRange keyRange = [match rangeAtIndex:2]; 136 | NSRange valueRange = [match rangeAtIndex:3]; 137 | NSRange endRange = [match rangeAtIndex:4]; 138 | 139 | if (indentRange.location != NSNotFound) 140 | indentBlock(indentRange, [self.parsedJSON substringWithRange:indentRange]); 141 | if (keyRange.location != NSNotFound) 142 | keyBlock(keyRange, [self.parsedJSON substringWithRange:keyRange]); 143 | if (valueRange.location != NSNotFound) 144 | valueBlock(valueRange, [self.parsedJSON substringWithRange:valueRange]); 145 | if (endRange.location != NSNotFound) 146 | endBlock(endRange, [self.parsedJSON substringWithRange:endRange]); 147 | }]; 148 | } 149 | 150 | #pragma mark - 151 | #pragma mark Color Helper Functions 152 | #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) 153 | + (UIColor *)colorWithRGB:(NSInteger)rgbValue 154 | { 155 | return [self.class colorWithRGB:rgbValue alpha:1.0]; 156 | } 157 | 158 | + (UIColor *)colorWithRGB:(NSInteger)rgbValue alpha:(CGFloat)alpha 159 | { 160 | return [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 161 | green:((float)((rgbValue & 0x00FF00) >> 8 )) / 255.0 162 | blue:((float)((rgbValue & 0x0000FF) >> 0 )) / 255.0 163 | alpha:alpha]; 164 | } 165 | #else 166 | + (NSColor *)colorWithRGB:(NSInteger)rgbValue 167 | { 168 | return [self.class colorWithRGB:rgbValue alpha:1.0]; 169 | } 170 | 171 | + (NSColor *)colorWithRGB:(NSInteger)rgbValue alpha:(CGFloat)alpha 172 | { 173 | return [NSColor colorWithCalibratedRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 174 | green:((float)((rgbValue & 0x00FF00) >> 8 )) / 255.0 175 | blue:((float)((rgbValue & 0x0000FF) >> 0 )) / 255.0 176 | alpha:alpha]; 177 | } 178 | #endif 179 | 180 | @end 181 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "JSONSyntaxHighlight" 3 | s.version = "1.0.0" 4 | s.summary = "Add syntax highlighting to JSON objects in Objective C for both Cocoa and iOS without using HTML." 5 | s.homepage = "https://github.com/bahamas10/JSONSyntaxHighlight" 6 | s.screenshots = "http://daveeddy.com/static/media/github/jsh.png" 7 | s.license = { :type => 'MIT', :file => 'LICENSE.txt' } 8 | s.author = { "Dave Eddy" => "dave@daveeddy.com" } 9 | s.source = { :git => "https://github.com/bahamas10/JSONSyntaxHighlight.git", :tag => "1.0.0" } 10 | 11 | s.ios.deployment_target = '5.0' 12 | s.osx.deployment_target = '10.7' 13 | 14 | s.source_files = '*.{h,m}' 15 | s.public_header_files = '*.h' 16 | 17 | s.ios.framework = 'UIKit' 18 | s.osx.framework = 'AppKit' 19 | 20 | s.requires_arc = true 21 | end 22 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 5515F1E717AD602C00D1B9D0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5515F1E617AD602C00D1B9D0 /* Cocoa.framework */; }; 11 | 5515F1F317AD602C00D1B9D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5515F1F217AD602C00D1B9D0 /* main.m */; }; 12 | 5515F1FA17AD602C00D1B9D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5515F1F917AD602C00D1B9D0 /* AppDelegate.m */; }; 13 | 5515F1FD17AD602C00D1B9D0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5515F1FB17AD602C00D1B9D0 /* MainMenu.xib */; }; 14 | 5515F20717AD661600D1B9D0 /* example.json in Resources */ = {isa = PBXBuildFile; fileRef = 5515F20617AD661600D1B9D0 /* example.json */; }; 15 | 5599AAC217ADB4BF00F19B96 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5515F1EB17AD602C00D1B9D0 /* Foundation.framework */; }; 16 | 5599AAD917ADB4BF00F19B96 /* MainStoryboard_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5599AAD717ADB4BF00F19B96 /* MainStoryboard_iPhone.storyboard */; }; 17 | 5599AADC17ADB4BF00F19B96 /* MainStoryboard_iPad.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5599AADA17ADB4BF00F19B96 /* MainStoryboard_iPad.storyboard */; }; 18 | 5599AAE417ADBAB700F19B96 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 5599AAE317ADBAB600F19B96 /* Default-568h@2x.png */; }; 19 | 5599AAE717ADBCE200F19B96 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5599AAE617ADBCE200F19B96 /* UIKit.framework */; }; 20 | 5599AAE917ADBCEA00F19B96 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5599AAE817ADBCEA00F19B96 /* CoreGraphics.framework */; }; 21 | 5599AAEA17ADBE2600F19B96 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5599AACF17ADB4BF00F19B96 /* AppDelegate.m */; }; 22 | 5599AAEB17ADBE2900F19B96 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5599AADE17ADB4BF00F19B96 /* ViewController.m */; }; 23 | 5599AAEC17ADBE2D00F19B96 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5599AACB17ADB4BF00F19B96 /* main.m */; }; 24 | 5599AAED17ADC05800F19B96 /* JSONSyntaxHighlight.m in Sources */ = {isa = PBXBuildFile; fileRef = 5515F20417AD604F00D1B9D0 /* JSONSyntaxHighlight.m */; }; 25 | 5599AAEE17ADC05800F19B96 /* JSONSyntaxHighlight.m in Sources */ = {isa = PBXBuildFile; fileRef = 5515F20417AD604F00D1B9D0 /* JSONSyntaxHighlight.m */; }; 26 | 5599AAEF17ADC12C00F19B96 /* example.json in Resources */ = {isa = PBXBuildFile; fileRef = 5515F20617AD661600D1B9D0 /* example.json */; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 5515F1E317AD602C00D1B9D0 /* JSONSyntaxHighlightMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSONSyntaxHighlightMac.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 5515F1E617AD602C00D1B9D0 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 32 | 5515F1E917AD602C00D1B9D0 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 33 | 5515F1EA17AD602C00D1B9D0 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 34 | 5515F1EB17AD602C00D1B9D0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 35 | 5515F1F217AD602C00D1B9D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = main.m; path = "Mac Example/main.m"; sourceTree = ""; }; 36 | 5515F1F817AD602C00D1B9D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = "Mac Example/AppDelegate.h"; sourceTree = ""; }; 37 | 5515F1F917AD602C00D1B9D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = "Mac Example/AppDelegate.m"; sourceTree = ""; }; 38 | 5515F1FC17AD602C00D1B9D0 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; 39 | 5515F20317AD604F00D1B9D0 /* JSONSyntaxHighlight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONSyntaxHighlight.h; sourceTree = ""; }; 40 | 5515F20417AD604F00D1B9D0 /* JSONSyntaxHighlight.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONSyntaxHighlight.m; sourceTree = ""; }; 41 | 5515F20617AD661600D1B9D0 /* example.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = example.json; path = JSONSyntaxHighlight/example.json; sourceTree = ""; }; 42 | 5599AAB917ADB49D00F19B96 /* JSONSyntaxHighlightMac-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "JSONSyntaxHighlightMac-Info.plist"; path = "Mac Example/JSONSyntaxHighlightMac-Info.plist"; sourceTree = ""; }; 43 | 5599AABF17ADB4BF00F19B96 /* JSONSyntaxHighlightiOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSONSyntaxHighlightiOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 5599AAC717ADB4BF00F19B96 /* JSONSyntaxHighlightiOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; name = "JSONSyntaxHighlightiOS-Info.plist"; path = "JSONSyntaxHighlight/iOS Example/JSONSyntaxHighlightiOS-Info.plist"; sourceTree = ""; }; 45 | 5599AACB17ADB4BF00F19B96 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = main.m; path = "JSONSyntaxHighlight/iOS Example/main.m"; sourceTree = SOURCE_ROOT; }; 46 | 5599AACE17ADB4BF00F19B96 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = "JSONSyntaxHighlight/iOS Example/AppDelegate.h"; sourceTree = ""; }; 47 | 5599AACF17ADB4BF00F19B96 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = "JSONSyntaxHighlight/iOS Example/AppDelegate.m"; sourceTree = SOURCE_ROOT; }; 48 | 5599AAD817ADB4BF00F19B96 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPhone.storyboard; sourceTree = ""; }; 49 | 5599AADB17ADB4BF00F19B96 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard_iPad.storyboard; sourceTree = ""; }; 50 | 5599AADD17ADB4BF00F19B96 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = "JSONSyntaxHighlight/iOS Example/ViewController.h"; sourceTree = ""; }; 51 | 5599AADE17ADB4BF00F19B96 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ViewController.m; path = "JSONSyntaxHighlight/iOS Example/ViewController.m"; sourceTree = SOURCE_ROOT; }; 52 | 5599AAE317ADBAB600F19B96 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "JSONSyntaxHighlight/iOS Example/Default-568h@2x.png"; sourceTree = SOURCE_ROOT; }; 53 | 5599AAE617ADBCE200F19B96 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; 54 | 5599AAE817ADBCEA00F19B96 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; 55 | 5599AAF017ADCA0800F19B96 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/CoreText.framework; sourceTree = DEVELOPER_DIR; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 5515F1E017AD602C00D1B9D0 /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 5515F1E717AD602C00D1B9D0 /* Cocoa.framework in Frameworks */, 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | 5599AABC17ADB4BF00F19B96 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 5599AAE917ADBCEA00F19B96 /* CoreGraphics.framework in Frameworks */, 72 | 5599AAE717ADBCE200F19B96 /* UIKit.framework in Frameworks */, 73 | 5599AAC217ADB4BF00F19B96 /* Foundation.framework in Frameworks */, 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | /* End PBXFrameworksBuildPhase section */ 78 | 79 | /* Begin PBXGroup section */ 80 | 5515F1DA17AD602C00D1B9D0 = { 81 | isa = PBXGroup; 82 | children = ( 83 | 5515F20317AD604F00D1B9D0 /* JSONSyntaxHighlight.h */, 84 | 5515F20417AD604F00D1B9D0 /* JSONSyntaxHighlight.m */, 85 | 5515F20617AD661600D1B9D0 /* example.json */, 86 | 5599AA9717ADB24F00F19B96 /* Mac Example */, 87 | 5599AAC517ADB4BF00F19B96 /* iOS Example */, 88 | 5515F1E817AD602C00D1B9D0 /* Frameworks */, 89 | 5515F1E417AD602C00D1B9D0 /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 5515F1E417AD602C00D1B9D0 /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 5515F1E317AD602C00D1B9D0 /* JSONSyntaxHighlightMac.app */, 97 | 5599AABF17ADB4BF00F19B96 /* JSONSyntaxHighlightiOS.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 5515F1E817AD602C00D1B9D0 /* Frameworks */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 5599AAF017ADCA0800F19B96 /* CoreText.framework */, 106 | 5599AAE817ADBCEA00F19B96 /* CoreGraphics.framework */, 107 | 5599AAE617ADBCE200F19B96 /* UIKit.framework */, 108 | 5515F1E617AD602C00D1B9D0 /* Cocoa.framework */, 109 | 5515F1E917AD602C00D1B9D0 /* AppKit.framework */, 110 | 5515F1EA17AD602C00D1B9D0 /* CoreData.framework */, 111 | 5515F1EB17AD602C00D1B9D0 /* Foundation.framework */, 112 | ); 113 | name = Frameworks; 114 | sourceTree = ""; 115 | }; 116 | 5599AA9717ADB24F00F19B96 /* Mac Example */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 5515F1F817AD602C00D1B9D0 /* AppDelegate.h */, 120 | 5515F1F917AD602C00D1B9D0 /* AppDelegate.m */, 121 | 5515F1FB17AD602C00D1B9D0 /* MainMenu.xib */, 122 | 5599AAB917ADB49D00F19B96 /* JSONSyntaxHighlightMac-Info.plist */, 123 | 5515F1F217AD602C00D1B9D0 /* main.m */, 124 | ); 125 | name = "Mac Example"; 126 | path = JSONSyntaxHighlight; 127 | sourceTree = ""; 128 | }; 129 | 5599AAC517ADB4BF00F19B96 /* iOS Example */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 5599AACE17ADB4BF00F19B96 /* AppDelegate.h */, 133 | 5599AACF17ADB4BF00F19B96 /* AppDelegate.m */, 134 | 5599AADD17ADB4BF00F19B96 /* ViewController.h */, 135 | 5599AADE17ADB4BF00F19B96 /* ViewController.m */, 136 | 5599AAD717ADB4BF00F19B96 /* MainStoryboard_iPhone.storyboard */, 137 | 5599AADA17ADB4BF00F19B96 /* MainStoryboard_iPad.storyboard */, 138 | 5599AAC717ADB4BF00F19B96 /* JSONSyntaxHighlightiOS-Info.plist */, 139 | 5599AACB17ADB4BF00F19B96 /* main.m */, 140 | 5599AAE317ADBAB600F19B96 /* Default-568h@2x.png */, 141 | ); 142 | name = "iOS Example"; 143 | path = JSONSyntaxHighlightiOS; 144 | sourceTree = ""; 145 | }; 146 | /* End PBXGroup section */ 147 | 148 | /* Begin PBXNativeTarget section */ 149 | 5515F1E217AD602C00D1B9D0 /* JSONSyntaxHighlightMac */ = { 150 | isa = PBXNativeTarget; 151 | buildConfigurationList = 5515F20017AD602C00D1B9D0 /* Build configuration list for PBXNativeTarget "JSONSyntaxHighlightMac" */; 152 | buildPhases = ( 153 | 5515F1DF17AD602C00D1B9D0 /* Sources */, 154 | 5515F1E017AD602C00D1B9D0 /* Frameworks */, 155 | 5515F1E117AD602C00D1B9D0 /* Resources */, 156 | ); 157 | buildRules = ( 158 | ); 159 | dependencies = ( 160 | ); 161 | name = JSONSyntaxHighlightMac; 162 | productName = JSONSyntaxHighlight; 163 | productReference = 5515F1E317AD602C00D1B9D0 /* JSONSyntaxHighlightMac.app */; 164 | productType = "com.apple.product-type.application"; 165 | }; 166 | 5599AABE17ADB4BF00F19B96 /* JSONSyntaxHighlightiOS */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = 5599AAE017ADB4BF00F19B96 /* Build configuration list for PBXNativeTarget "JSONSyntaxHighlightiOS" */; 169 | buildPhases = ( 170 | 5599AABB17ADB4BF00F19B96 /* Sources */, 171 | 5599AABC17ADB4BF00F19B96 /* Frameworks */, 172 | 5599AABD17ADB4BF00F19B96 /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | ); 178 | name = JSONSyntaxHighlightiOS; 179 | productName = JSONSyntaxHighlightiOS; 180 | productReference = 5599AABF17ADB4BF00F19B96 /* JSONSyntaxHighlightiOS.app */; 181 | productType = "com.apple.product-type.application"; 182 | }; 183 | /* End PBXNativeTarget section */ 184 | 185 | /* Begin PBXProject section */ 186 | 5515F1DB17AD602C00D1B9D0 /* Project object */ = { 187 | isa = PBXProject; 188 | attributes = { 189 | LastUpgradeCheck = 0460; 190 | ORGANIZATIONNAME = "Dave Eddy"; 191 | }; 192 | buildConfigurationList = 5515F1DE17AD602C00D1B9D0 /* Build configuration list for PBXProject "JSONSyntaxHighlight" */; 193 | compatibilityVersion = "Xcode 3.2"; 194 | developmentRegion = English; 195 | hasScannedForEncodings = 0; 196 | knownRegions = ( 197 | en, 198 | ); 199 | mainGroup = 5515F1DA17AD602C00D1B9D0; 200 | productRefGroup = 5515F1E417AD602C00D1B9D0 /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | 5515F1E217AD602C00D1B9D0 /* JSONSyntaxHighlightMac */, 205 | 5599AABE17ADB4BF00F19B96 /* JSONSyntaxHighlightiOS */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXResourcesBuildPhase section */ 211 | 5515F1E117AD602C00D1B9D0 /* Resources */ = { 212 | isa = PBXResourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 5515F1FD17AD602C00D1B9D0 /* MainMenu.xib in Resources */, 216 | 5515F20717AD661600D1B9D0 /* example.json in Resources */, 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | }; 220 | 5599AABD17ADB4BF00F19B96 /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | 5599AAD917ADB4BF00F19B96 /* MainStoryboard_iPhone.storyboard in Resources */, 225 | 5599AADC17ADB4BF00F19B96 /* MainStoryboard_iPad.storyboard in Resources */, 226 | 5599AAE417ADBAB700F19B96 /* Default-568h@2x.png in Resources */, 227 | 5599AAEF17ADC12C00F19B96 /* example.json in Resources */, 228 | ); 229 | runOnlyForDeploymentPostprocessing = 0; 230 | }; 231 | /* End PBXResourcesBuildPhase section */ 232 | 233 | /* Begin PBXSourcesBuildPhase section */ 234 | 5515F1DF17AD602C00D1B9D0 /* Sources */ = { 235 | isa = PBXSourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | 5515F1F317AD602C00D1B9D0 /* main.m in Sources */, 239 | 5515F1FA17AD602C00D1B9D0 /* AppDelegate.m in Sources */, 240 | 5599AAED17ADC05800F19B96 /* JSONSyntaxHighlight.m in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | 5599AABB17ADB4BF00F19B96 /* Sources */ = { 245 | isa = PBXSourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | 5599AAEA17ADBE2600F19B96 /* AppDelegate.m in Sources */, 249 | 5599AAEB17ADBE2900F19B96 /* ViewController.m in Sources */, 250 | 5599AAEC17ADBE2D00F19B96 /* main.m in Sources */, 251 | 5599AAEE17ADC05800F19B96 /* JSONSyntaxHighlight.m in Sources */, 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | /* End PBXSourcesBuildPhase section */ 256 | 257 | /* Begin PBXVariantGroup section */ 258 | 5515F1FB17AD602C00D1B9D0 /* MainMenu.xib */ = { 259 | isa = PBXVariantGroup; 260 | children = ( 261 | 5515F1FC17AD602C00D1B9D0 /* en */, 262 | ); 263 | name = MainMenu.xib; 264 | path = "Mac Example"; 265 | sourceTree = ""; 266 | }; 267 | 5599AAD717ADB4BF00F19B96 /* MainStoryboard_iPhone.storyboard */ = { 268 | isa = PBXVariantGroup; 269 | children = ( 270 | 5599AAD817ADB4BF00F19B96 /* en */, 271 | ); 272 | name = MainStoryboard_iPhone.storyboard; 273 | path = "JSONSyntaxHighlight/iOS Example"; 274 | sourceTree = SOURCE_ROOT; 275 | }; 276 | 5599AADA17ADB4BF00F19B96 /* MainStoryboard_iPad.storyboard */ = { 277 | isa = PBXVariantGroup; 278 | children = ( 279 | 5599AADB17ADB4BF00F19B96 /* en */, 280 | ); 281 | name = MainStoryboard_iPad.storyboard; 282 | path = "JSONSyntaxHighlight/iOS Example"; 283 | sourceTree = SOURCE_ROOT; 284 | }; 285 | /* End PBXVariantGroup section */ 286 | 287 | /* Begin XCBuildConfiguration section */ 288 | 5515F1FE17AD602C00D1B9D0 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ALWAYS_SEARCH_USER_PATHS = NO; 292 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 293 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 294 | CLANG_CXX_LIBRARY = "libc++"; 295 | CLANG_ENABLE_OBJC_ARC = YES; 296 | CLANG_WARN_CONSTANT_CONVERSION = YES; 297 | CLANG_WARN_EMPTY_BODY = YES; 298 | CLANG_WARN_ENUM_CONVERSION = YES; 299 | CLANG_WARN_INT_CONVERSION = YES; 300 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 301 | COPY_PHASE_STRIP = NO; 302 | GCC_C_LANGUAGE_STANDARD = gnu99; 303 | GCC_DYNAMIC_NO_PIC = NO; 304 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 305 | GCC_OPTIMIZATION_LEVEL = 0; 306 | GCC_PREPROCESSOR_DEFINITIONS = ( 307 | "DEBUG=1", 308 | "$(inherited)", 309 | ); 310 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 311 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 312 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 314 | GCC_WARN_UNUSED_VARIABLE = YES; 315 | MACOSX_DEPLOYMENT_TARGET = 10.8; 316 | ONLY_ACTIVE_ARCH = YES; 317 | PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; 318 | SDKROOT = macosx; 319 | }; 320 | name = Debug; 321 | }; 322 | 5515F1FF17AD602C00D1B9D0 /* Release */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ALWAYS_SEARCH_USER_PATHS = NO; 326 | ARCHS = "$(ARCHS_STANDARD_64_BIT)"; 327 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 328 | CLANG_CXX_LIBRARY = "libc++"; 329 | CLANG_ENABLE_OBJC_ARC = YES; 330 | CLANG_WARN_CONSTANT_CONVERSION = YES; 331 | CLANG_WARN_EMPTY_BODY = YES; 332 | CLANG_WARN_ENUM_CONVERSION = YES; 333 | CLANG_WARN_INT_CONVERSION = YES; 334 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 335 | COPY_PHASE_STRIP = YES; 336 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 337 | GCC_C_LANGUAGE_STANDARD = gnu99; 338 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 339 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 341 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | MACOSX_DEPLOYMENT_TARGET = 10.8; 344 | PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; 345 | SDKROOT = macosx; 346 | }; 347 | name = Release; 348 | }; 349 | 5515F20117AD602C00D1B9D0 /* Debug */ = { 350 | isa = XCBuildConfiguration; 351 | buildSettings = { 352 | COMBINE_HIDPI_IMAGES = YES; 353 | GCC_PRECOMPILE_PREFIX_HEADER = NO; 354 | GCC_PREFIX_HEADER = ""; 355 | INFOPLIST_FILE = "JSONSyntaxHighlight/Mac Example/JSONSyntaxHighlightMac-Info.plist"; 356 | PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; 357 | PRODUCT_NAME = "$(TARGET_NAME)"; 358 | WRAPPER_EXTENSION = app; 359 | }; 360 | name = Debug; 361 | }; 362 | 5515F20217AD602C00D1B9D0 /* Release */ = { 363 | isa = XCBuildConfiguration; 364 | buildSettings = { 365 | COMBINE_HIDPI_IMAGES = YES; 366 | GCC_PRECOMPILE_PREFIX_HEADER = NO; 367 | GCC_PREFIX_HEADER = ""; 368 | INFOPLIST_FILE = "JSONSyntaxHighlight/Mac Example/JSONSyntaxHighlightMac-Info.plist"; 369 | PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | WRAPPER_EXTENSION = app; 372 | }; 373 | name = Release; 374 | }; 375 | 5599AAE117ADB4BF00F19B96 /* Debug */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 379 | FRAMEWORK_SEARCH_PATHS = ( 380 | "$(inherited)", 381 | "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"", 382 | ); 383 | GCC_PRECOMPILE_PREFIX_HEADER = NO; 384 | GCC_PREFIX_HEADER = ""; 385 | INFOPLIST_FILE = "$(SRCROOT)/JSONSyntaxHighlight/iOS Example/JSONSyntaxHighlightiOS-Info.plist"; 386 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 387 | PRODUCT_NAME = "$(TARGET_NAME)"; 388 | SDKROOT = iphoneos; 389 | TARGETED_DEVICE_FAMILY = "1,2"; 390 | WRAPPER_EXTENSION = app; 391 | }; 392 | name = Debug; 393 | }; 394 | 5599AAE217ADB4BF00F19B96 /* Release */ = { 395 | isa = XCBuildConfiguration; 396 | buildSettings = { 397 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 398 | FRAMEWORK_SEARCH_PATHS = ( 399 | "$(inherited)", 400 | "\"$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Developer/Library/Frameworks\"", 401 | ); 402 | GCC_PRECOMPILE_PREFIX_HEADER = NO; 403 | GCC_PREFIX_HEADER = ""; 404 | INFOPLIST_FILE = "$(SRCROOT)/JSONSyntaxHighlight/iOS Example/JSONSyntaxHighlightiOS-Info.plist"; 405 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 406 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 407 | PRODUCT_NAME = "$(TARGET_NAME)"; 408 | SDKROOT = iphoneos; 409 | TARGETED_DEVICE_FAMILY = "1,2"; 410 | VALIDATE_PRODUCT = YES; 411 | WRAPPER_EXTENSION = app; 412 | }; 413 | name = Release; 414 | }; 415 | /* End XCBuildConfiguration section */ 416 | 417 | /* Begin XCConfigurationList section */ 418 | 5515F1DE17AD602C00D1B9D0 /* Build configuration list for PBXProject "JSONSyntaxHighlight" */ = { 419 | isa = XCConfigurationList; 420 | buildConfigurations = ( 421 | 5515F1FE17AD602C00D1B9D0 /* Debug */, 422 | 5515F1FF17AD602C00D1B9D0 /* Release */, 423 | ); 424 | defaultConfigurationIsVisible = 0; 425 | defaultConfigurationName = Release; 426 | }; 427 | 5515F20017AD602C00D1B9D0 /* Build configuration list for PBXNativeTarget "JSONSyntaxHighlightMac" */ = { 428 | isa = XCConfigurationList; 429 | buildConfigurations = ( 430 | 5515F20117AD602C00D1B9D0 /* Debug */, 431 | 5515F20217AD602C00D1B9D0 /* Release */, 432 | ); 433 | defaultConfigurationIsVisible = 0; 434 | defaultConfigurationName = Release; 435 | }; 436 | 5599AAE017ADB4BF00F19B96 /* Build configuration list for PBXNativeTarget "JSONSyntaxHighlightiOS" */ = { 437 | isa = XCConfigurationList; 438 | buildConfigurations = ( 439 | 5599AAE117ADB4BF00F19B96 /* Debug */, 440 | 5599AAE217ADB4BF00F19B96 /* Release */, 441 | ); 442 | defaultConfigurationIsVisible = 0; 443 | defaultConfigurationName = Release; 444 | }; 445 | /* End XCConfigurationList section */ 446 | }; 447 | rootObject = 5515F1DB17AD602C00D1B9D0 /* Project object */; 448 | } 449 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/Mac Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JSONSyntaxHighlight 4 | // 5 | // Created by Dave Eddy on 8/3/13. 6 | // Copyright (c) 2013 Dave Eddy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : NSObject 12 | 13 | @property (assign) IBOutlet NSWindow *window; 14 | 15 | @property (assign) IBOutlet NSTextView *textView; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/Mac Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JSONSyntaxHighlight 4 | // 5 | // Created by Dave Eddy on 8/3/13. 6 | // Copyright (c) 2013 Dave Eddy. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "JSONSyntaxHighlight.h" 12 | 13 | @implementation AppDelegate 14 | 15 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 16 | { 17 | // read the example JSON 18 | NSString *path = [NSBundle.mainBundle pathForResource:@"example" ofType:@"json"]; 19 | NSString *jsonString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 20 | id JSONObj = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; 21 | 22 | // create the JSONSyntaxHighilight Object 23 | JSONSyntaxHighlight *jsh = [[JSONSyntaxHighlight alloc] initWithJSON:JSONObj]; 24 | 25 | // place the text into the view 26 | self.textView.string = @"\n"; 27 | [self.textView insertText:[jsh highlightJSON]]; 28 | } 29 | @end 30 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/Mac Example/JSONSyntaxHighlightMac-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.daveeddy.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSHumanReadableCopyright 28 | Copyright © 2013 Dave Eddy. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/Mac Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JSONSyntaxHighlight 4 | // 5 | // Created by Dave Eddy on 8/3/13. 6 | // Copyright (c) 2013 Dave Eddy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return NSApplicationMain(argc, (const char **)argv); 14 | } 15 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": { 3 | "name": "Dave Eddy", 4 | "website": "http://www.daveeddy.com" 5 | }, 6 | "numbers": [1, 2, 3, 4], 7 | "literals": [ 8 | null, 9 | true, 10 | false 11 | ] 12 | } -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JSONSyntaxHighlightiOS 4 | // 5 | // Created by Dave Eddy on 8/3/13. 6 | // Copyright (c) 2013 Dave Eddy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JSONSyntaxHighlightiOS 4 | // 5 | // Created by Dave Eddy on 8/3/13. 6 | // Copyright (c) 2013 Dave Eddy. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | return YES; 16 | } 17 | 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bahamas10/JSONSyntaxHighlight/44dffdeec748586f44e22eb90f5d1b217b70be3c/JSONSyntaxHighlight/iOS Example/Default-568h@2x.png -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bahamas10/JSONSyntaxHighlight/44dffdeec748586f44e22eb90f5d1b217b70be3c/JSONSyntaxHighlight/iOS Example/Default.png -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bahamas10/JSONSyntaxHighlight/44dffdeec748586f44e22eb90f5d1b217b70be3c/JSONSyntaxHighlight/iOS Example/Default@2x.png -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/JSONSyntaxHighlightiOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.daveeddy.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard_iPhone 29 | UIMainStoryboardFile~ipad 30 | MainStoryboard_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/JSONSyntaxHighlightiOS-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'JSONSyntaxHighlightiOS' target in the 'JSONSyntaxHighlightiOS' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JSONSyntaxHighlightiOS 4 | // 5 | // Created by Dave Eddy on 8/3/13. 6 | // Copyright (c) 2013 Dave Eddy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @property (weak, nonatomic) IBOutlet UITextView *textView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JSONSyntaxHighlightiOS 4 | // 5 | // Created by Dave Eddy on 8/3/13. 6 | // Copyright (c) 2013 Dave Eddy. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JSONSyntaxHighlight.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | 22 | // read the example JSON 23 | NSString *path = [NSBundle.mainBundle pathForResource:@"example" ofType:@"json"]; 24 | NSString *jsonString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; 25 | id JSONObj = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:nil]; 26 | 27 | // create the JSONSyntaxHighilight Object 28 | JSONSyntaxHighlight *jsh = [[JSONSyntaxHighlight alloc] initWithJSON:JSONObj]; 29 | 30 | // place the text into the view 31 | self.textView.attributedText = [jsh highlightJSON]; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/en.lproj/MainStoryboard_iPad.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/en.lproj/MainStoryboard_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /JSONSyntaxHighlight/iOS Example/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JSONSyntaxHighlightiOS 4 | // 5 | // Created by Dave Eddy on 8/3/13. 6 | // Copyright (c) 2013 Dave Eddy. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2013 Dave Eddy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | JSON Syntax Highlight 2 | ===================== 3 | 4 | Add syntax highlighting to JSON objects in Objective C for both Cocoa and iOS 5 | without using HTML 6 | 7 | ![jsh](http://www.daveeddy.com/static/media/github/jsh.png) 8 | 9 | Requires ARC 10 | 11 | Installation 12 | ------------ 13 | 14 | ### [CocoaPods](http://cocoapods.org) 15 | 16 | Add `JSONSyntaxHighlight` to your `Podfile` 17 | 18 | ``` ruby 19 | pod 'JSONSyntaxHighlight' 20 | ``` 21 | 22 | ### Manually 23 | 24 | - Copy `JSONSyntaxHighlight.m` and `JSONSyntaxHighlight.h` to your porject 25 | - iOS 26 | - Add `UIKit.framework` to your project 27 | - Mac 28 | - Add `AppKit.framework` to your project 29 | 30 | Example 31 | ------- 32 | 33 | Clone this repository and open the Xcode project to see the Mac and iOS examples 34 | 35 | Import this library 36 | 37 | ``` objective-c 38 | // Pods 39 | #import 40 | // - or - 41 | // Manually 42 | #import "JSONSyntaxHighlight.h" 43 | ``` 44 | 45 | Create the `JSONSyntaxHighlight` object 46 | 47 | ``` objective-c 48 | id JSONObj = @{ 49 | @"name": @"dave" 50 | }; 51 | 52 | JSONSyntaxHighlight *jsh = [[JSONSyntaxHighlight alloc] initWithJSON:JSONObj]; 53 | ``` 54 | 55 | ### Basic highlighting 56 | 57 | ``` objective-c 58 | NSAttributedString *s; 59 | 60 | s = [jsh highlightJSON]; 61 | // s => an NSAttributedString with the JSON highlighted in pretty print format 62 | 63 | s = [jsh highlightJSONWithPrettyPrint:NO]; 64 | // s => same as above, but compressed JSON is returned 65 | ``` 66 | 67 | ### Advanced highlighting 68 | 69 | ``` objective-c 70 | jsh.nonStringAttributes = @{NSForegroundColorAttributeName: [JSONSyntaxHighlight colorWithRGB:0xffffff]}; 71 | jsh.stringAttributes = @{NSForegroundColorAttributeName: [JSONSyntaxHighlight colorWithRGB:0x00ff00]}; 72 | jsh.keyAttributes = @{NSForegroundColorAttributeName: [JSONSyntaxHighlight colorWithRGB:0x0000ff]}; 73 | s = [jsh highlightJSON]; 74 | // s => an NSAttributedString with the JSON highlighted in pretty print format 75 | // using the colors specified above 76 | ``` 77 | 78 | ### Event driven API 79 | 80 | ``` objective-c 81 | NSMutableString *json = [[NSMutableString alloc] initWithString:@""]; 82 | [jsh enumerateMatchesWithIndentBlock: 83 | // The indent 84 | ^(NSRange range, NSString *s) { 85 | [json appendAttributedString:s]; 86 | } 87 | keyBlock: 88 | // The key (with quotes and colon) 89 | ^(NSRange range, NSString *s) { 90 | [json appendAttributedString:s]; 91 | } 92 | valueBlock: 93 | // The value 94 | ^(NSRange range, NSString *s) { 95 | [json appendAttributedString:s]; 96 | } 97 | endBlock: 98 | // The final comma, or ending character 99 | ^(NSRange range, NSString *s) { 100 | [json appendAttributedString:s]; 101 | [json appendAttributedString:@"\n"]; 102 | }]; 103 | // json => a pretty printed JSON string 104 | ``` 105 | 106 | Usage 107 | ----- 108 | 109 | ``` objective-c 110 | - (JSONSyntaxHighlight *)initWithJSON:(id)JSON; 111 | ``` 112 | 113 | Create a `JSONSyntaxHighlight` object given a JSON object (`NSDictionary`, `NSArray`, etc.) 114 | 115 | ``` objective-c 116 | @property (readonly, nonatomic, strong) id JSON; 117 | @property (readonly, nonatomic, strong) NSString *parsedJSON; 118 | ``` 119 | 120 | `JSON` is the unmodified JSON object, and `parsedJSON` is the stringified pretty printed JSON 121 | string 122 | 123 | --- 124 | 125 | ``` objective-c 126 | - (NSAttributedString *)highlightJSON; 127 | - (NSAttributedString *)highlightJSONWithPrettyPrint:(BOOL)prettyPrint; 128 | ``` 129 | 130 | Return an `NSAttributedString` with the highlighted JSON in an optionally 131 | pretty printed format. If unspecified, pretty printing is the default 132 | 133 | ``` objective-c 134 | @property (nonatomic, strong) NSDictionary *keyAttributes; 135 | @property (nonatomic, strong) NSDictionary *stringAttributes; 136 | @property (nonatomic, strong) NSDictionary *nonStringAttributes; 137 | ``` 138 | 139 | Set the attributes to be used for the `NSAttributedString` for the JSON keys 140 | and values (both string and non-string) 141 | 142 | --- 143 | 144 | ``` objective-c 145 | - (void)enumerateMatchesWithIndentBlock:(void(^)(NSRange, NSString*))indentBlock 146 | keyBlock:(void(^)(NSRange, NSString*))keyBlock 147 | valueBlock:(void(^)(NSRange, NSString*))valueBlock 148 | endBlock:(void(^)(NSRange, NSString*))endBlock 149 | ``` 150 | 151 | Fire a callback for every key item found in the parsed JSON, each callback 152 | is fired with the `NSRange` the substring appears in `self.parsedJSON`, as well 153 | as the `NSString` at that location. 154 | 155 | An example JSON file with each "key item" is illustrated below 156 | 157 | ``` 158 | { 159 | "name": "dave", 160 | +---++------++----++ 161 | | | | | 162 | | | | +-->end (may be empty) 163 | | | +-------->value (will have quotes if string) 164 | | +---------------->key (will have quotes and colon) 165 | +--------------------->indent (leading spaces) 166 | "age": 24 167 | +---++-----++++ 168 | | | | | 169 | | | | +------->end @"" 170 | | | +--------->value @"24" 171 | | +---------------->key @"\"age\":" 172 | +--------------------->indent @" " 173 | } 174 | + 175 | | 176 | +--------------------->end @"}" 177 | ``` 178 | 179 | --- 180 | 181 | ``` objective-c 182 | + (Color *)colorWithRGB:(NSInteger)rgbValue; 183 | + (Color *)colorWithRGB:(NSInteger)rgbValue alpha:(CGFloat)alpha; 184 | ``` 185 | 186 | These functions can be used to return an `NSColor` or `UIColor` object (as appropriate) 187 | based on the given `rgbValue` 188 | 189 | Todo 190 | ---- 191 | 192 | - The regex parsing of JSON is ugly... maybe a custom stringify function 193 | should be used 194 | 195 | License 196 | ------- 197 | 198 | MIT License 199 | --------------------------------------------------------------------------------