├── .gitignore ├── .travis.yml ├── Classes ├── NSString+Pangu.h ├── NSString+Pangu.m ├── Pangu.h ├── UILabel+Pangu.h └── UILabel+Pangu.m ├── LICENSE ├── Pangu.Objective-C.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ ├── Pangu.Objective-C.xcscheme │ └── Pangu.Objective-CTests.xcscheme ├── Pangu.Objective-C ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── Pangu.Objective-CTests ├── Info.plist └── Pangu_Objective_CTests.m ├── Pangu.podspec └── Readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Objective-C ### 4 | # Xcode 5 | # 6 | build/ 7 | *.pbxuser 8 | !default.pbxuser 9 | *.mode1v3 10 | !default.mode1v3 11 | *.mode2v3 12 | !default.mode2v3 13 | *.perspectivev3 14 | !default.perspectivev3 15 | xcuserdata 16 | *.xccheckout 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | *.xcuserstate 22 | 23 | # CocoaPods 24 | # 25 | # We recommend against adding the Pods directory to your .gitignore. However 26 | # you should judge for yourself, the pros and cons are mentioned at: 27 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 28 | # 29 | #Pods/ 30 | 31 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | # xcode_project: Pangu.Objective-C.xcodeproj 3 | # xcode_scheme: Pangu.Objective-CTests 4 | # xcode_sdk: iphonesimulator 5 | script: 6 | - xctool -project Pangu.Objective-C.xcodeproj -scheme Pangu.Objective-CTests build test -sdk iphonesimulator GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES 7 | after_success: 8 | - bash <(curl -s https://codecov.io/bash) -------------------------------------------------------------------------------- /Classes/NSString+Pangu.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Pangu.h 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 26/07/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (Pangu) 12 | + (NSString *)spacing:(NSString *)text; 13 | @end 14 | -------------------------------------------------------------------------------- /Classes/NSString+Pangu.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+Pangu.m 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 26/07/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "NSString+Pangu.h" 10 | 11 | @implementation NSString (Pangu) 12 | 13 | + (NSString *)spacing:(NSString *)text 14 | { 15 | NSString *CJK_STRING = @"([\\p{InHiragana}\\p{InKatakana}\\p{InBopomofo}\\p{InCJKCompatibilityIdeographs}\\p{InCJKUnifiedIdeographs}])"; 16 | 17 | NSRegularExpression *cjk_ans_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@", CJK_STRING, @"([a-z0-9`~@\\$%\\^&\\*\\-_\\+=\\|\\\\/])"] 18 | options:NSRegularExpressionCaseInsensitive 19 | error:nil]; 20 | 21 | NSRegularExpression *ans_cjk_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@", @"([a-z0-9`~!\\$%\\^&\\*\\-_\\+=\\|\\\\;:,\\./\\?])", CJK_STRING] 22 | options:NSRegularExpressionCaseInsensitive 23 | error:nil]; 24 | 25 | NSRegularExpression *cjk_quote_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@", CJK_STRING, @"([\"'])"] 26 | options:0 27 | error:nil]; 28 | 29 | NSRegularExpression *quote_cjk_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@", @"([\"'])", CJK_STRING] 30 | options:0 31 | error:nil]; 32 | 33 | NSRegularExpression *fix_quote_regex = [NSRegularExpression regularExpressionWithPattern:@"([\"'])(\\s*)(.+?)(\\s*)([\"'])" options:0 error:nil]; 34 | 35 | NSRegularExpression *cjk_bracket_cjk_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@%@", CJK_STRING, @"([\\({\\[]+(.*?)[\\)}\\]]+)", CJK_STRING] 36 | options:0 37 | error:nil]; 38 | 39 | NSRegularExpression *cjk_bracket_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@", CJK_STRING, @"([\\(\\){}\\[\\]<>])"] 40 | options:0 41 | error:nil]; 42 | 43 | NSRegularExpression *bracket_cjk_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@", @"([\\(\\){}\\[\\]<>])", CJK_STRING] 44 | options:0 45 | error:nil]; 46 | 47 | NSRegularExpression *fix_bracket_regex = [NSRegularExpression regularExpressionWithPattern:@"([(\\({\\[)]+)(\\s*)(.+?)(\\s*)([\\)}\\]]+)" 48 | options:0 49 | error:nil]; 50 | 51 | NSRegularExpression *cjk_hash_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@", CJK_STRING, @"(#(\\S+))"] 52 | options:0 53 | error:nil]; 54 | 55 | NSRegularExpression *hash_cjk_regex = [NSRegularExpression regularExpressionWithPattern:[NSString stringWithFormat:@"%@%@", @"((\\S+)#)", CJK_STRING] 56 | options:0 57 | error:nil]; 58 | 59 | text = [cjk_quote_regex stringByReplacingMatchesInString:text 60 | options:0 61 | range:NSMakeRange(0, text.length) 62 | withTemplate:@"$1 $2"]; 63 | 64 | text = [quote_cjk_regex stringByReplacingMatchesInString:text 65 | options:0 66 | range:NSMakeRange(0, text.length) 67 | withTemplate:@"$1 $2"]; 68 | 69 | text = [fix_quote_regex stringByReplacingMatchesInString:text 70 | options:0 71 | range:NSMakeRange(0, text.length) 72 | withTemplate:@"$1$3$5"]; 73 | 74 | // CJK and brackets 75 | NSString *oldText = text; 76 | NSString *newText = [cjk_bracket_cjk_regex stringByReplacingMatchesInString:text 77 | options:0 78 | range:NSMakeRange(0, text.length) 79 | withTemplate:@"$1 $2 $4"]; 80 | text = newText; 81 | 82 | if ([oldText isEqualToString:newText]) { 83 | text = [cjk_bracket_regex stringByReplacingMatchesInString:text 84 | options:0 85 | range:NSMakeRange(0, text.length) 86 | withTemplate:@"$1 $2"]; 87 | text = [bracket_cjk_regex stringByReplacingMatchesInString:text 88 | options:0 89 | range:NSMakeRange(0, text.length) 90 | withTemplate:@"$1 $2"]; 91 | } 92 | 93 | text = [fix_bracket_regex stringByReplacingMatchesInString:text 94 | options:0 95 | range:NSMakeRange(0, text.length) 96 | withTemplate:@"$1$3$5"]; 97 | 98 | // CJK and hash 99 | text = [cjk_hash_regex stringByReplacingMatchesInString:text 100 | options:0 101 | range:NSMakeRange(0, text.length) 102 | withTemplate:@"$1 $2"]; 103 | text = [hash_cjk_regex stringByReplacingMatchesInString:text 104 | options:0 105 | range:NSMakeRange(0, text.length) 106 | withTemplate:@"$1 $3"]; 107 | 108 | // CJK and ANS 109 | text = [cjk_ans_regex stringByReplacingMatchesInString:text 110 | options:0 111 | range:NSMakeRange(0, text.length) 112 | withTemplate:@"$1 $2"]; 113 | text = [ans_cjk_regex stringByReplacingMatchesInString:text 114 | options:0 115 | range:NSMakeRange(0, text.length) 116 | withTemplate:@"$1 $2"]; 117 | 118 | return text; 119 | } 120 | 121 | @end 122 | -------------------------------------------------------------------------------- /Classes/Pangu.h: -------------------------------------------------------------------------------- 1 | // 2 | // Pangu.h 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 11/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #ifndef Pangu_Objective_C_Pangu_h 10 | #define Pangu_Objective_C_Pangu_h 11 | 12 | #import "NSString+Pangu.h" 13 | #import "UILabel+Pangu.h" 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /Classes/UILabel+Pangu.h: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Pangu.h 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 11/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "NSString+Pangu.h" 12 | 13 | @interface UILabel (Pangu) 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Classes/UILabel+Pangu.m: -------------------------------------------------------------------------------- 1 | // 2 | // UILabel+Pangu.m 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 11/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "UILabel+Pangu.h" 10 | 11 | @implementation UILabel (Pangu) 12 | 13 | + (void)load { 14 | static dispatch_once_t onceToken; 15 | dispatch_once(&onceToken, ^{ 16 | Class class = [self class]; 17 | 18 | SEL originalSelector = @selector(setText:); 19 | SEL swizzledSelector = @selector(pg_setText:); 20 | 21 | Method originalMethod = class_getInstanceMethod(class, originalSelector); 22 | Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); 23 | 24 | BOOL success = class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod)); 25 | if (success) { 26 | class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); 27 | } else { 28 | method_exchangeImplementations(originalMethod, swizzledMethod); 29 | } 30 | }); 31 | } 32 | 33 | - (void)pg_setText:(NSString *)string 34 | { 35 | if (string == nil) { 36 | string = @""; 37 | } 38 | [self pg_setText:[NSString spacing:string]]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Cee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /Pangu.Objective-C.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9281A7AD1B6526B400485A0B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9281A7AC1B6526B400485A0B /* main.m */; }; 11 | 9281A7B01B6526B400485A0B /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9281A7AF1B6526B400485A0B /* AppDelegate.m */; }; 12 | 9281A7B31B6526B400485A0B /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9281A7B21B6526B400485A0B /* ViewController.m */; }; 13 | 9281A7B61B6526B400485A0B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9281A7B41B6526B400485A0B /* Main.storyboard */; }; 14 | 9281A7B81B6526B400485A0B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9281A7B71B6526B400485A0B /* Images.xcassets */; }; 15 | 9281A7BB1B6526B400485A0B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9281A7B91B6526B400485A0B /* LaunchScreen.xib */; }; 16 | 9281A7C71B6526B400485A0B /* Pangu_Objective_CTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9281A7C61B6526B400485A0B /* Pangu_Objective_CTests.m */; }; 17 | 92CF04EA1B7972AA00484960 /* NSString+Pangu.m in Sources */ = {isa = PBXBuildFile; fileRef = 92CF04E91B7972AA00484960 /* NSString+Pangu.m */; }; 18 | 92CF04ED1B7972C300484960 /* UILabel+Pangu.m in Sources */ = {isa = PBXBuildFile; fileRef = 92CF04EC1B7972C300484960 /* UILabel+Pangu.m */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 9281A7C11B6526B400485A0B /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 9281A79F1B6526B400485A0B /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 9281A7A61B6526B400485A0B; 27 | remoteInfo = "Pangu.Objective-C"; 28 | }; 29 | /* End PBXContainerItemProxy section */ 30 | 31 | /* Begin PBXFileReference section */ 32 | 9281A7A71B6526B400485A0B /* Pangu.Objective-C.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Pangu.Objective-C.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33 | 9281A7AB1B6526B400485A0B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | 9281A7AC1B6526B400485A0B /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 35 | 9281A7AE1B6526B400485A0B /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 36 | 9281A7AF1B6526B400485A0B /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 37 | 9281A7B11B6526B400485A0B /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 38 | 9281A7B21B6526B400485A0B /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 39 | 9281A7B51B6526B400485A0B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 40 | 9281A7B71B6526B400485A0B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 41 | 9281A7BA1B6526B400485A0B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 42 | 9281A7C01B6526B400485A0B /* Pangu.Objective-CTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Pangu.Objective-CTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 9281A7C51B6526B400485A0B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 9281A7C61B6526B400485A0B /* Pangu_Objective_CTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Pangu_Objective_CTests.m; sourceTree = ""; }; 45 | 92CF04E81B7972AA00484960 /* NSString+Pangu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Pangu.h"; sourceTree = ""; }; 46 | 92CF04E91B7972AA00484960 /* NSString+Pangu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Pangu.m"; sourceTree = ""; }; 47 | 92CF04EB1B7972C300484960 /* UILabel+Pangu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+Pangu.h"; sourceTree = ""; }; 48 | 92CF04EC1B7972C300484960 /* UILabel+Pangu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+Pangu.m"; sourceTree = ""; }; 49 | 92CF04EE1B79752100484960 /* Pangu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Pangu.h; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 9281A7A41B6526B400485A0B /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | 9281A7BD1B6526B400485A0B /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 9281A79E1B6526B400485A0B = { 71 | isa = PBXGroup; 72 | children = ( 73 | 9281A7A91B6526B400485A0B /* Pangu.Objective-C */, 74 | 9281A7C31B6526B400485A0B /* Pangu.Objective-CTests */, 75 | 9281A7A81B6526B400485A0B /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | 9281A7A81B6526B400485A0B /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 9281A7A71B6526B400485A0B /* Pangu.Objective-C.app */, 83 | 9281A7C01B6526B400485A0B /* Pangu.Objective-CTests.xctest */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | 9281A7A91B6526B400485A0B /* Pangu.Objective-C */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 92CF04E71B7972AA00484960 /* Classes */, 92 | 9281A7AE1B6526B400485A0B /* AppDelegate.h */, 93 | 9281A7AF1B6526B400485A0B /* AppDelegate.m */, 94 | 9281A7B11B6526B400485A0B /* ViewController.h */, 95 | 9281A7B21B6526B400485A0B /* ViewController.m */, 96 | 9281A7B41B6526B400485A0B /* Main.storyboard */, 97 | 9281A7B71B6526B400485A0B /* Images.xcassets */, 98 | 9281A7B91B6526B400485A0B /* LaunchScreen.xib */, 99 | 9281A7AA1B6526B400485A0B /* Supporting Files */, 100 | ); 101 | path = "Pangu.Objective-C"; 102 | sourceTree = ""; 103 | }; 104 | 9281A7AA1B6526B400485A0B /* Supporting Files */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 9281A7AB1B6526B400485A0B /* Info.plist */, 108 | 9281A7AC1B6526B400485A0B /* main.m */, 109 | ); 110 | name = "Supporting Files"; 111 | sourceTree = ""; 112 | }; 113 | 9281A7C31B6526B400485A0B /* Pangu.Objective-CTests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 9281A7C61B6526B400485A0B /* Pangu_Objective_CTests.m */, 117 | 9281A7C41B6526B400485A0B /* Supporting Files */, 118 | ); 119 | path = "Pangu.Objective-CTests"; 120 | sourceTree = ""; 121 | }; 122 | 9281A7C41B6526B400485A0B /* Supporting Files */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 9281A7C51B6526B400485A0B /* Info.plist */, 126 | ); 127 | name = "Supporting Files"; 128 | sourceTree = ""; 129 | }; 130 | 92CF04E71B7972AA00484960 /* Classes */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 92CF04EE1B79752100484960 /* Pangu.h */, 134 | 92CF04E81B7972AA00484960 /* NSString+Pangu.h */, 135 | 92CF04E91B7972AA00484960 /* NSString+Pangu.m */, 136 | 92CF04EB1B7972C300484960 /* UILabel+Pangu.h */, 137 | 92CF04EC1B7972C300484960 /* UILabel+Pangu.m */, 138 | ); 139 | path = Classes; 140 | sourceTree = SOURCE_ROOT; 141 | }; 142 | /* End PBXGroup section */ 143 | 144 | /* Begin PBXNativeTarget section */ 145 | 9281A7A61B6526B400485A0B /* Pangu.Objective-C */ = { 146 | isa = PBXNativeTarget; 147 | buildConfigurationList = 9281A7CA1B6526B400485A0B /* Build configuration list for PBXNativeTarget "Pangu.Objective-C" */; 148 | buildPhases = ( 149 | 9281A7A31B6526B400485A0B /* Sources */, 150 | 9281A7A41B6526B400485A0B /* Frameworks */, 151 | 9281A7A51B6526B400485A0B /* Resources */, 152 | ); 153 | buildRules = ( 154 | ); 155 | dependencies = ( 156 | ); 157 | name = "Pangu.Objective-C"; 158 | productName = "Pangu.Objective-C"; 159 | productReference = 9281A7A71B6526B400485A0B /* Pangu.Objective-C.app */; 160 | productType = "com.apple.product-type.application"; 161 | }; 162 | 9281A7BF1B6526B400485A0B /* Pangu.Objective-CTests */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = 9281A7CD1B6526B400485A0B /* Build configuration list for PBXNativeTarget "Pangu.Objective-CTests" */; 165 | buildPhases = ( 166 | 9281A7BC1B6526B400485A0B /* Sources */, 167 | 9281A7BD1B6526B400485A0B /* Frameworks */, 168 | 9281A7BE1B6526B400485A0B /* Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | 9281A7C21B6526B400485A0B /* PBXTargetDependency */, 174 | ); 175 | name = "Pangu.Objective-CTests"; 176 | productName = "Pangu.Objective-CTests"; 177 | productReference = 9281A7C01B6526B400485A0B /* Pangu.Objective-CTests.xctest */; 178 | productType = "com.apple.product-type.bundle.unit-test"; 179 | }; 180 | /* End PBXNativeTarget section */ 181 | 182 | /* Begin PBXProject section */ 183 | 9281A79F1B6526B400485A0B /* Project object */ = { 184 | isa = PBXProject; 185 | attributes = { 186 | LastUpgradeCheck = 0640; 187 | ORGANIZATIONNAME = Cee; 188 | TargetAttributes = { 189 | 9281A7A61B6526B400485A0B = { 190 | CreatedOnToolsVersion = 6.4; 191 | }; 192 | 9281A7BF1B6526B400485A0B = { 193 | CreatedOnToolsVersion = 6.4; 194 | TestTargetID = 9281A7A61B6526B400485A0B; 195 | }; 196 | }; 197 | }; 198 | buildConfigurationList = 9281A7A21B6526B400485A0B /* Build configuration list for PBXProject "Pangu.Objective-C" */; 199 | compatibilityVersion = "Xcode 3.2"; 200 | developmentRegion = English; 201 | hasScannedForEncodings = 0; 202 | knownRegions = ( 203 | en, 204 | Base, 205 | ); 206 | mainGroup = 9281A79E1B6526B400485A0B; 207 | productRefGroup = 9281A7A81B6526B400485A0B /* Products */; 208 | projectDirPath = ""; 209 | projectRoot = ""; 210 | targets = ( 211 | 9281A7A61B6526B400485A0B /* Pangu.Objective-C */, 212 | 9281A7BF1B6526B400485A0B /* Pangu.Objective-CTests */, 213 | ); 214 | }; 215 | /* End PBXProject section */ 216 | 217 | /* Begin PBXResourcesBuildPhase section */ 218 | 9281A7A51B6526B400485A0B /* Resources */ = { 219 | isa = PBXResourcesBuildPhase; 220 | buildActionMask = 2147483647; 221 | files = ( 222 | 9281A7B61B6526B400485A0B /* Main.storyboard in Resources */, 223 | 9281A7BB1B6526B400485A0B /* LaunchScreen.xib in Resources */, 224 | 9281A7B81B6526B400485A0B /* Images.xcassets in Resources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | 9281A7BE1B6526B400485A0B /* Resources */ = { 229 | isa = PBXResourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | /* End PBXResourcesBuildPhase section */ 236 | 237 | /* Begin PBXSourcesBuildPhase section */ 238 | 9281A7A31B6526B400485A0B /* Sources */ = { 239 | isa = PBXSourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | 92CF04ED1B7972C300484960 /* UILabel+Pangu.m in Sources */, 243 | 9281A7B31B6526B400485A0B /* ViewController.m in Sources */, 244 | 92CF04EA1B7972AA00484960 /* NSString+Pangu.m in Sources */, 245 | 9281A7B01B6526B400485A0B /* AppDelegate.m in Sources */, 246 | 9281A7AD1B6526B400485A0B /* main.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | 9281A7BC1B6526B400485A0B /* Sources */ = { 251 | isa = PBXSourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | 9281A7C71B6526B400485A0B /* Pangu_Objective_CTests.m in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin PBXTargetDependency section */ 261 | 9281A7C21B6526B400485A0B /* PBXTargetDependency */ = { 262 | isa = PBXTargetDependency; 263 | target = 9281A7A61B6526B400485A0B /* Pangu.Objective-C */; 264 | targetProxy = 9281A7C11B6526B400485A0B /* PBXContainerItemProxy */; 265 | }; 266 | /* End PBXTargetDependency section */ 267 | 268 | /* Begin PBXVariantGroup section */ 269 | 9281A7B41B6526B400485A0B /* Main.storyboard */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | 9281A7B51B6526B400485A0B /* Base */, 273 | ); 274 | name = Main.storyboard; 275 | sourceTree = ""; 276 | }; 277 | 9281A7B91B6526B400485A0B /* LaunchScreen.xib */ = { 278 | isa = PBXVariantGroup; 279 | children = ( 280 | 9281A7BA1B6526B400485A0B /* Base */, 281 | ); 282 | name = LaunchScreen.xib; 283 | sourceTree = ""; 284 | }; 285 | /* End PBXVariantGroup section */ 286 | 287 | /* Begin XCBuildConfiguration section */ 288 | 9281A7C81B6526B400485A0B /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ALWAYS_SEARCH_USER_PATHS = NO; 292 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 293 | CLANG_CXX_LIBRARY = "libc++"; 294 | CLANG_ENABLE_MODULES = YES; 295 | CLANG_ENABLE_OBJC_ARC = YES; 296 | CLANG_WARN_BOOL_CONVERSION = YES; 297 | CLANG_WARN_CONSTANT_CONVERSION = YES; 298 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 299 | CLANG_WARN_EMPTY_BODY = YES; 300 | CLANG_WARN_ENUM_CONVERSION = YES; 301 | CLANG_WARN_INT_CONVERSION = YES; 302 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 303 | CLANG_WARN_UNREACHABLE_CODE = YES; 304 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 305 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 306 | COPY_PHASE_STRIP = NO; 307 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 308 | ENABLE_STRICT_OBJC_MSGSEND = YES; 309 | GCC_C_LANGUAGE_STANDARD = gnu99; 310 | GCC_DYNAMIC_NO_PIC = NO; 311 | GCC_NO_COMMON_BLOCKS = YES; 312 | GCC_OPTIMIZATION_LEVEL = 0; 313 | GCC_PREPROCESSOR_DEFINITIONS = ( 314 | "DEBUG=1", 315 | "$(inherited)", 316 | ); 317 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 318 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 319 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 320 | GCC_WARN_UNDECLARED_SELECTOR = YES; 321 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 322 | GCC_WARN_UNUSED_FUNCTION = YES; 323 | GCC_WARN_UNUSED_VARIABLE = YES; 324 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 325 | MTL_ENABLE_DEBUG_INFO = YES; 326 | ONLY_ACTIVE_ARCH = YES; 327 | SDKROOT = iphoneos; 328 | TARGETED_DEVICE_FAMILY = "1,2"; 329 | }; 330 | name = Debug; 331 | }; 332 | 9281A7C91B6526B400485A0B /* Release */ = { 333 | isa = XCBuildConfiguration; 334 | buildSettings = { 335 | ALWAYS_SEARCH_USER_PATHS = NO; 336 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 337 | CLANG_CXX_LIBRARY = "libc++"; 338 | CLANG_ENABLE_MODULES = YES; 339 | CLANG_ENABLE_OBJC_ARC = YES; 340 | CLANG_WARN_BOOL_CONVERSION = YES; 341 | CLANG_WARN_CONSTANT_CONVERSION = YES; 342 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 343 | CLANG_WARN_EMPTY_BODY = YES; 344 | CLANG_WARN_ENUM_CONVERSION = YES; 345 | CLANG_WARN_INT_CONVERSION = YES; 346 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 347 | CLANG_WARN_UNREACHABLE_CODE = YES; 348 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 349 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 350 | COPY_PHASE_STRIP = NO; 351 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 352 | ENABLE_NS_ASSERTIONS = NO; 353 | ENABLE_STRICT_OBJC_MSGSEND = YES; 354 | GCC_C_LANGUAGE_STANDARD = gnu99; 355 | GCC_NO_COMMON_BLOCKS = YES; 356 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 357 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 358 | GCC_WARN_UNDECLARED_SELECTOR = YES; 359 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 360 | GCC_WARN_UNUSED_FUNCTION = YES; 361 | GCC_WARN_UNUSED_VARIABLE = YES; 362 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 363 | MTL_ENABLE_DEBUG_INFO = NO; 364 | SDKROOT = iphoneos; 365 | TARGETED_DEVICE_FAMILY = "1,2"; 366 | VALIDATE_PRODUCT = YES; 367 | }; 368 | name = Release; 369 | }; 370 | 9281A7CB1B6526B400485A0B /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 374 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 375 | INFOPLIST_FILE = "Pangu.Objective-C/Info.plist"; 376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 377 | PRODUCT_NAME = "$(TARGET_NAME)"; 378 | }; 379 | name = Debug; 380 | }; 381 | 9281A7CC1B6526B400485A0B /* Release */ = { 382 | isa = XCBuildConfiguration; 383 | buildSettings = { 384 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 385 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 386 | INFOPLIST_FILE = "Pangu.Objective-C/Info.plist"; 387 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 388 | PRODUCT_NAME = "$(TARGET_NAME)"; 389 | }; 390 | name = Release; 391 | }; 392 | 9281A7CE1B6526B400485A0B /* Debug */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | BUNDLE_LOADER = "$(TEST_HOST)"; 396 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 397 | FRAMEWORK_SEARCH_PATHS = ( 398 | "$(SDKROOT)/Developer/Library/Frameworks", 399 | "$(inherited)", 400 | ); 401 | GCC_PREPROCESSOR_DEFINITIONS = ( 402 | "DEBUG=1", 403 | "$(inherited)", 404 | ); 405 | INFOPLIST_FILE = "Pangu.Objective-CTests/Info.plist"; 406 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 407 | PRODUCT_NAME = "$(TARGET_NAME)"; 408 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Pangu.Objective-C.app/Pangu.Objective-C"; 409 | }; 410 | name = Debug; 411 | }; 412 | 9281A7CF1B6526B400485A0B /* Release */ = { 413 | isa = XCBuildConfiguration; 414 | buildSettings = { 415 | BUNDLE_LOADER = "$(TEST_HOST)"; 416 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; 417 | FRAMEWORK_SEARCH_PATHS = ( 418 | "$(SDKROOT)/Developer/Library/Frameworks", 419 | "$(inherited)", 420 | ); 421 | INFOPLIST_FILE = "Pangu.Objective-CTests/Info.plist"; 422 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 423 | PRODUCT_NAME = "$(TARGET_NAME)"; 424 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Pangu.Objective-C.app/Pangu.Objective-C"; 425 | }; 426 | name = Release; 427 | }; 428 | /* End XCBuildConfiguration section */ 429 | 430 | /* Begin XCConfigurationList section */ 431 | 9281A7A21B6526B400485A0B /* Build configuration list for PBXProject "Pangu.Objective-C" */ = { 432 | isa = XCConfigurationList; 433 | buildConfigurations = ( 434 | 9281A7C81B6526B400485A0B /* Debug */, 435 | 9281A7C91B6526B400485A0B /* Release */, 436 | ); 437 | defaultConfigurationIsVisible = 0; 438 | defaultConfigurationName = Release; 439 | }; 440 | 9281A7CA1B6526B400485A0B /* Build configuration list for PBXNativeTarget "Pangu.Objective-C" */ = { 441 | isa = XCConfigurationList; 442 | buildConfigurations = ( 443 | 9281A7CB1B6526B400485A0B /* Debug */, 444 | 9281A7CC1B6526B400485A0B /* Release */, 445 | ); 446 | defaultConfigurationIsVisible = 0; 447 | defaultConfigurationName = Release; 448 | }; 449 | 9281A7CD1B6526B400485A0B /* Build configuration list for PBXNativeTarget "Pangu.Objective-CTests" */ = { 450 | isa = XCConfigurationList; 451 | buildConfigurations = ( 452 | 9281A7CE1B6526B400485A0B /* Debug */, 453 | 9281A7CF1B6526B400485A0B /* Release */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | /* End XCConfigurationList section */ 459 | }; 460 | rootObject = 9281A79F1B6526B400485A0B /* Project object */; 461 | } 462 | -------------------------------------------------------------------------------- /Pangu.Objective-C.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Pangu.Objective-C.xcodeproj/xcshareddata/xcschemes/Pangu.Objective-C.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /Pangu.Objective-C.xcodeproj/xcshareddata/xcschemes/Pangu.Objective-CTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Pangu.Objective-C/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 26/07/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Pangu.Objective-C/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 26/07/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "NSString+Pangu.h" 11 | 12 | @interface AppDelegate () 13 | 14 | @end 15 | 16 | @implementation AppDelegate 17 | 18 | 19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 20 | // Override point for customization after application launch. 21 | return YES; 22 | } 23 | 24 | - (void)applicationWillResignActive:(UIApplication *)application { 25 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 26 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 27 | } 28 | 29 | - (void)applicationDidEnterBackground:(UIApplication *)application { 30 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 31 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 32 | } 33 | 34 | - (void)applicationWillEnterForeground:(UIApplication *)application { 35 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 36 | } 37 | 38 | - (void)applicationDidBecomeActive:(UIApplication *)application { 39 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 40 | } 41 | 42 | - (void)applicationWillTerminate:(UIApplication *)application { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pangu.Objective-C/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Pangu.Objective-C/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Pangu.Objective-C/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /Pangu.Objective-C/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Cee.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Pangu.Objective-C/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 26/07/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /Pangu.Objective-C/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 26/07/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController () 12 | 13 | @end 14 | 15 | @implementation ViewController 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view, typically from a nib. 20 | } 21 | 22 | - (void)didReceiveMemoryWarning { 23 | [super didReceiveMemoryWarning]; 24 | // Dispose of any resources that can be recreated. 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Pangu.Objective-C/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Pangu.Objective-C 4 | // 5 | // Created by Cee on 26/07/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Pangu.Objective-CTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Cee.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /Pangu.Objective-CTests/Pangu_Objective_CTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // Pangu_Objective_CTests.m 3 | // Pangu.Objective-CTests 4 | // 5 | // Created by Cee on 26/07/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "Pangu.h" 12 | 13 | @interface Pangu_Objective_CTests : XCTestCase 14 | 15 | @end 16 | 17 | @implementation Pangu_Objective_CTests 18 | 19 | - (void)setUp { 20 | [super setUp]; 21 | // Put setup code here. This method is called before the invocation of each test method in the class. 22 | } 23 | 24 | - (void)tearDown { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testSpacingText { 30 | XCTAssertEqualObjects([NSString spacing:@"請問Jackie的鼻子有幾個?123個!"], @"請問 Jackie 的鼻子有幾個?123 個!"); 31 | 32 | XCTAssertEqualObjects([NSString spacing:@"請問 Jackie 的鼻子有幾個?123 個!"], @"請問 Jackie 的鼻子有幾個?123 個!"); 33 | } 34 | 35 | 36 | - (void)testTilde { 37 | XCTAssertEqualObjects([NSString spacing:@"前面~後面"], @"前面 ~ 後面"); 38 | 39 | XCTAssertEqualObjects([NSString spacing:@"前面 ~ 後面"], @"前面 ~ 後面"); 40 | } 41 | 42 | 43 | - (void)testBackQuote { 44 | XCTAssertEqualObjects([NSString spacing:@"前面`後面"], @"前面 ` 後面"); 45 | } 46 | 47 | 48 | - (void)testExclamationMark { 49 | XCTAssertEqualObjects([NSString spacing:@"前面!後面"], @"前面! 後面"); 50 | 51 | XCTAssertEqualObjects([NSString spacing:@"前面! 後面"], @"前面! 後面"); 52 | 53 | XCTAssertEqualObjects([NSString spacing:@"前面 ! 後面"], @"前面 ! 後面"); 54 | } 55 | 56 | 57 | - (void)testAt1 { 58 | XCTAssertEqualObjects([NSString spacing:@"請@vinta吃大便"], @"請 @vinta 吃大便"); 59 | } 60 | 61 | 62 | - (void)testAt2 { 63 | XCTAssertEqualObjects([NSString spacing:@"請@陳上進 吃大便"], @"請 @陳上進 吃大便"); 64 | } 65 | 66 | 67 | - (void)testHash1 { 68 | XCTAssertEqualObjects([NSString spacing:@"前面#H2G2後面"], @"前面 #H2G2 後面"); 69 | } 70 | 71 | 72 | - (void)testHash2 { 73 | XCTAssertEqualObjects([NSString spacing:@"前面#銀河便車指南 後面"], @"前面 #銀河便車指南 後面"); 74 | } 75 | 76 | 77 | - (void)testHash3 { 78 | XCTAssertEqualObjects([NSString spacing:@"前面#銀河公車指南 #銀河大客車指南 後面"], @"前面 #銀河公車指南 #銀河大客車指南 後面"); 79 | } 80 | 81 | 82 | - (void)testHash4 { 83 | XCTAssertEqualObjects([NSString spacing:@"前面#銀河閃電霹靂車指南#後面"], @"前面 #銀河閃電霹靂車指南# 後面"); 84 | } 85 | 86 | 87 | - (void)testDollar { 88 | XCTAssertEqualObjects([NSString spacing:@"前面$後面"], @"前面 $ 後面"); 89 | } 90 | 91 | 92 | - (void)testPercent { 93 | XCTAssertEqualObjects([NSString spacing:@"前面%後面"], @"前面 % 後面"); 94 | } 95 | 96 | 97 | - (void)testCarat { 98 | XCTAssertEqualObjects([NSString spacing:@"前面^後面"], @"前面 ^ 後面"); 99 | } 100 | 101 | 102 | - (void)testAmpersand { 103 | XCTAssertEqualObjects([NSString spacing:@"前面&後面"], @"前面 & 後面"); 104 | } 105 | 106 | 107 | - (void)testAsterisk { 108 | XCTAssertEqualObjects([NSString spacing:@"前面*後面"], @"前面 * 後面"); 109 | } 110 | 111 | 112 | - (void)testParenthesis { 113 | XCTAssertEqualObjects([NSString spacing:@"前面(後面"], @"前面 ( 後面"); 114 | 115 | XCTAssertEqualObjects([NSString spacing:@"前面 ( 後面"], @"前面 ( 後面"); 116 | 117 | XCTAssertEqualObjects([NSString spacing:@"前面)後面"], @"前面 ) 後面"); 118 | 119 | XCTAssertEqualObjects([NSString spacing:@"前面 ) 後面"], @"前面 ) 後面"); 120 | } 121 | 122 | 123 | - (void)testParenthesisPair { 124 | XCTAssertEqualObjects([NSString spacing:@"前面(中文123漢字)後面"], @"前面 (中文 123 漢字) 後面"); 125 | 126 | XCTAssertEqualObjects([NSString spacing:@"前面(中文123)後面"], @"前面 (中文 123) 後面"); 127 | 128 | XCTAssertEqualObjects([NSString spacing:@"前面(123漢字)後面"], @"前面 (123 漢字) 後面"); 129 | 130 | XCTAssertEqualObjects([NSString spacing:@"前面(中文123漢字) tail"], @"前面 (中文 123 漢字) tail"); 131 | 132 | XCTAssertEqualObjects([NSString spacing:@"head (中文123漢字)後面"], @"head (中文 123 漢字) 後面"); 133 | 134 | XCTAssertEqualObjects([NSString spacing:@"head (中文123漢字) tail"], @"head (中文 123 漢字) tail"); 135 | } 136 | 137 | 138 | - (void)testMinus { 139 | XCTAssertEqualObjects([NSString spacing:@"前面-後面"], @"前面 - 後面"); 140 | } 141 | 142 | 143 | - (void)testUnderscore { 144 | XCTAssertEqualObjects([NSString spacing:@"前面_後面"], @"前面 _ 後面"); 145 | 146 | XCTAssertEqualObjects([NSString spacing:@"前面 _ 後面"], @"前面 _ 後面"); 147 | } 148 | 149 | 150 | - (void)testPlus { 151 | XCTAssertEqualObjects([NSString spacing:@"前面+後面"], @"前面 + 後面"); 152 | } 153 | 154 | 155 | - (void)testEqual { 156 | XCTAssertEqualObjects([NSString spacing:@"前面=後面"], @"前面 = 後面"); 157 | } 158 | 159 | 160 | - (void)testBrace { 161 | XCTAssertEqualObjects([NSString spacing:@"前面{後面"], @"前面 { 後面"); 162 | } 163 | 164 | 165 | - (void)testBracket { 166 | XCTAssertEqualObjects([NSString spacing:@"前面[後面"], @"前面 [ 後面"); 167 | } 168 | 169 | 170 | - (void)testPipe { 171 | XCTAssertEqualObjects([NSString spacing:@"前面|後面"], @"前面 | 後面"); 172 | } 173 | 174 | 175 | - (void)testBackslash { 176 | XCTAssertEqualObjects([NSString spacing:@"前面\\後面"], @"前面 \\ 後面"); 177 | } 178 | 179 | 180 | - (void)testColon { 181 | XCTAssertEqualObjects([NSString spacing:@"前面:後面"], @"前面: 後面"); 182 | 183 | XCTAssertEqualObjects([NSString spacing:@"前面: 後面"], @"前面: 後面"); 184 | 185 | XCTAssertEqualObjects([NSString spacing:@"前面 : 後面"], @"前面 : 後面"); 186 | } 187 | 188 | 189 | - (void)testSemicolon { 190 | XCTAssertEqualObjects([NSString spacing:@"前面;後面"], @"前面; 後面"); 191 | 192 | XCTAssertEqualObjects([NSString spacing:@"前面; 後面"], @"前面; 後面"); 193 | 194 | XCTAssertEqualObjects([NSString spacing:@"前面 ; 後面"], @"前面 ; 後面"); 195 | } 196 | 197 | 198 | - (void)testQuote { 199 | XCTAssertEqualObjects([NSString spacing:@"前面\"後面"], @"前面 \" 後面"); 200 | 201 | XCTAssertEqualObjects([NSString spacing:@"前面\"中文123漢字\"後面"], @"前面 \"中文 123 漢字\" 後面"); 202 | 203 | XCTAssertEqualObjects([NSString spacing:@"前面\"\"後面"], @"前面 \"\" 後面"); 204 | 205 | XCTAssertEqualObjects([NSString spacing:@"前面\" \"後面"], @"前面 \" \" 後面"); 206 | } 207 | 208 | 209 | - (void)testSingleQuote { 210 | XCTAssertEqualObjects([NSString spacing:@"前面'後面"], @"前面 ' 後面"); 211 | 212 | XCTAssertEqualObjects([NSString spacing:@"前面'中文123漢字'後面"], @"前面 '中文 123 漢字' 後面"); 213 | 214 | XCTAssertEqualObjects([NSString spacing:@"前面''後面"], @"前面 '' 後面"); 215 | 216 | XCTAssertEqualObjects([NSString spacing:@"前面' '後面"], @"前面 ' ' 後面"); 217 | } 218 | 219 | 220 | - (void)testLessThan { 221 | XCTAssertEqualObjects([NSString spacing:@"前面<後面"], @"前面 < 後面"); 222 | } 223 | 224 | 225 | - (void)testComma { 226 | XCTAssertEqualObjects([NSString spacing:@"前面,後面"], @"前面, 後面"); 227 | 228 | XCTAssertEqualObjects([NSString spacing:@"前面, 後面"], @"前面, 後面"); 229 | 230 | XCTAssertEqualObjects([NSString spacing:@"前面, 後面"], @"前面, 後面"); 231 | } 232 | 233 | 234 | - (void)testGreaterThan { 235 | XCTAssertEqualObjects([NSString spacing:@"前面>後面"], @"前面 > 後面"); 236 | } 237 | 238 | 239 | - (void)testPeriod { 240 | XCTAssertEqualObjects([NSString spacing:@"前面.後面"], @"前面. 後面"); 241 | 242 | XCTAssertEqualObjects([NSString spacing:@"前面. 後面"], @"前面. 後面"); 243 | 244 | XCTAssertEqualObjects([NSString spacing:@"前面. 後面"], @"前面. 後面"); 245 | } 246 | 247 | 248 | - (void)testQuestionMark { 249 | XCTAssertEqualObjects([NSString spacing:@"前面?後面"], @"前面? 後面"); 250 | 251 | XCTAssertEqualObjects([NSString spacing:@"前面? 後面"], @"前面? 後面"); 252 | 253 | XCTAssertEqualObjects([NSString spacing:@"前面? 後面"], @"前面? 後面"); 254 | } 255 | 256 | 257 | - (void)testSlash { 258 | XCTAssertEqualObjects([NSString spacing:@"前面/後面"], @"前面 / 後面"); 259 | } 260 | 261 | - (void)testSetText { 262 | UILabel *label = [UILabel new]; 263 | label.text = @"請@vinta吃大便"; 264 | XCTAssertEqualObjects(label.text, @"請 @vinta 吃大便"); 265 | label.text = nil; 266 | XCTAssertEqualObjects(label.text, @""); 267 | } 268 | 269 | - (void)testPerformanceExample { 270 | // This is an example of a performance test case. 271 | [self measureBlock:^{ 272 | // Put the code you want to measure the time of here. 273 | }]; 274 | } 275 | 276 | @end 277 | -------------------------------------------------------------------------------- /Pangu.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "Pangu" 3 | s.version = "0.2.1" 4 | s.summary = "Paranoid text spacing in Objective-C" 5 | s.description = "Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean) and half-width characters (alphabetical letters, numerical digits and symbols)." 6 | 7 | s.homepage = "https://github.com/Cee/pangu.objective-c" 8 | 9 | s.license = { :type => "MIT", :file => "LICENSE" } 10 | 11 | s.author = { "Cee" => "cee@chu2byo.com" } 12 | 13 | s.ios.deployment_target = '5.0' 14 | 15 | s.source = { :git => "https://github.com/Cee/pangu.objective-c.git", :tag => "v#{s.version.to_s}" } 16 | 17 | s.source_files = "Classes", "Classes/**/*.{h,m}" 18 | end 19 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Pangu.objective-c 2 | 3 | [![Travis CI](https://travis-ci.org/Cee/pangu.objective-c.svg?branch=master)](https://travis-ci.org/Cee/pangu.objective-c) 4 | [![codecov.io](http://codecov.io/github/Cee/pangu.objective-c/coverage.svg?branch=master)](http://codecov.io/github/Cee/pangu.objective-c?branch=master) 5 | [![Cocoapods](https://cocoapod-badges.herokuapp.com/v/Pangu/badge.png)](http://cocoapods.org/?q=Pangu) 6 | 7 | Paranoid text spacing for good readability, to automatically insert whitespace between CJK (Chinese, Japanese, Korean), half-width English, digit and symbol characters. 8 | 9 | * Go version: [pangu.go](https://github.com/vinta/pangu) 10 | * Java version: [pangu.java](https://github.com/vinta/pangu.java) 11 | * JavaScript version: [pangu.js](https://github.com/vinta/paranoid-auto-spacing/blob/master/src/pangu.js) 12 | * Node.js version: [pangu.node](https://github.com/huei90/pangu.node) 13 | * Python version: [pangu.py](https://github.com/vinta/pangu.py) 14 | * Ruby version: [pangu.rb](https://github.com/dlackty/pangu.rb) 15 | 16 | ## Installation 17 | 18 | The simplest option is to use `pod "Pangu"`. 19 | 20 | You can also add the `Classes` folder to your project, and then `import Pangu.h`. There are no further requirements. 21 | 22 | ## Usage 23 | 24 | ```objective-c 25 | #import "Pangu.h" 26 | 27 | [NSString spacing:@"請問Jackie的鼻子有幾個?123個!"]; 28 | // 請問 Jackie 的鼻子有幾個?123 個! 29 | 30 | UILabel *label = [UILable new]; 31 | label.text = @"請問Jackie的鼻子有幾個?123個!"; 32 | // 請問 Jackie 的鼻子有幾個?123 個! 33 | ``` 34 | 35 | ## License 36 | 37 | Released under the MIT License. --------------------------------------------------------------------------------