├── NibToXibConverter ├── English.lproj │ ├── InfoPlist.strings │ └── MainMenu.xib ├── NibToXibConverter-Info.plist ├── NibToXibConverter.xcodeproj │ └── project.pbxproj ├── NibToXibConverterAppDelegate.h ├── NibToXibConverterAppDelegate.m ├── NibToXibConverter_Prefix.pch └── main.m └── README.md /NibToXibConverter/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /NibToXibConverter/NibToXibConverter-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.yourcompany.${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 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /NibToXibConverter/NibToXibConverter.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; 11 | 256AC3DA0F4B6AC300CF3369 /* NibToXibConverterAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* NibToXibConverterAppDelegate.m */; }; 12 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 13 | 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 14 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 19 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 20 | 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 21 | 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; 22 | 256AC3D80F4B6AC300CF3369 /* NibToXibConverterAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NibToXibConverterAppDelegate.h; sourceTree = ""; }; 23 | 256AC3D90F4B6AC300CF3369 /* NibToXibConverterAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NibToXibConverterAppDelegate.m; sourceTree = ""; }; 24 | 256AC3F00F4B6AF500CF3369 /* NibToXibConverter_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NibToXibConverter_Prefix.pch; sourceTree = ""; }; 25 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 26 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 27 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 28 | 8D1107310486CEB800E47090 /* NibToXibConverter-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "NibToXibConverter-Info.plist"; sourceTree = ""; }; 29 | 8D1107320486CEB800E47090 /* NibToXibConverter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NibToXibConverter.app; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | 8D11072E0486CEB800E47090 /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 080E96DDFE201D6D7F000001 /* Classes */ = { 45 | isa = PBXGroup; 46 | children = ( 47 | 256AC3D80F4B6AC300CF3369 /* NibToXibConverterAppDelegate.h */, 48 | 256AC3D90F4B6AC300CF3369 /* NibToXibConverterAppDelegate.m */, 49 | ); 50 | name = Classes; 51 | sourceTree = ""; 52 | }; 53 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, 57 | ); 58 | name = "Linked Frameworks"; 59 | sourceTree = ""; 60 | }; 61 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | 29B97324FDCFA39411CA2CEA /* AppKit.framework */, 65 | 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, 66 | 29B97325FDCFA39411CA2CEA /* Foundation.framework */, 67 | ); 68 | name = "Other Frameworks"; 69 | sourceTree = ""; 70 | }; 71 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 8D1107320486CEB800E47090 /* NibToXibConverter.app */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 29B97314FDCFA39411CA2CEA /* NibToXibConverter */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 080E96DDFE201D6D7F000001 /* Classes */, 83 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 84 | 29B97317FDCFA39411CA2CEA /* Resources */, 85 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 86 | 19C28FACFE9D520D11CA2CBB /* Products */, 87 | ); 88 | name = NibToXibConverter; 89 | sourceTree = ""; 90 | }; 91 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 256AC3F00F4B6AF500CF3369 /* NibToXibConverter_Prefix.pch */, 95 | 29B97316FDCFA39411CA2CEA /* main.m */, 96 | ); 97 | name = "Other Sources"; 98 | sourceTree = ""; 99 | }; 100 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 8D1107310486CEB800E47090 /* NibToXibConverter-Info.plist */, 104 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, 105 | 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, 106 | ); 107 | name = Resources; 108 | sourceTree = ""; 109 | }; 110 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, 114 | 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, 115 | ); 116 | name = Frameworks; 117 | sourceTree = ""; 118 | }; 119 | /* End PBXGroup section */ 120 | 121 | /* Begin PBXNativeTarget section */ 122 | 8D1107260486CEB800E47090 /* NibToXibConverter */ = { 123 | isa = PBXNativeTarget; 124 | buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "NibToXibConverter" */; 125 | buildPhases = ( 126 | 8D1107290486CEB800E47090 /* Resources */, 127 | 8D11072C0486CEB800E47090 /* Sources */, 128 | 8D11072E0486CEB800E47090 /* Frameworks */, 129 | ); 130 | buildRules = ( 131 | ); 132 | dependencies = ( 133 | ); 134 | name = NibToXibConverter; 135 | productInstallPath = "$(HOME)/Applications"; 136 | productName = NibToXibConverter; 137 | productReference = 8D1107320486CEB800E47090 /* NibToXibConverter.app */; 138 | productType = "com.apple.product-type.application"; 139 | }; 140 | /* End PBXNativeTarget section */ 141 | 142 | /* Begin PBXProject section */ 143 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 144 | isa = PBXProject; 145 | attributes = { 146 | LastUpgradeCheck = 0460; 147 | }; 148 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NibToXibConverter" */; 149 | compatibilityVersion = "Xcode 3.2"; 150 | developmentRegion = English; 151 | hasScannedForEncodings = 1; 152 | knownRegions = ( 153 | English, 154 | Japanese, 155 | French, 156 | German, 157 | ); 158 | mainGroup = 29B97314FDCFA39411CA2CEA /* NibToXibConverter */; 159 | projectDirPath = ""; 160 | projectRoot = ""; 161 | targets = ( 162 | 8D1107260486CEB800E47090 /* NibToXibConverter */, 163 | ); 164 | }; 165 | /* End PBXProject section */ 166 | 167 | /* Begin PBXResourcesBuildPhase section */ 168 | 8D1107290486CEB800E47090 /* Resources */ = { 169 | isa = PBXResourcesBuildPhase; 170 | buildActionMask = 2147483647; 171 | files = ( 172 | 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, 173 | 1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */, 174 | ); 175 | runOnlyForDeploymentPostprocessing = 0; 176 | }; 177 | /* End PBXResourcesBuildPhase section */ 178 | 179 | /* Begin PBXSourcesBuildPhase section */ 180 | 8D11072C0486CEB800E47090 /* Sources */ = { 181 | isa = PBXSourcesBuildPhase; 182 | buildActionMask = 2147483647; 183 | files = ( 184 | 8D11072D0486CEB800E47090 /* main.m in Sources */, 185 | 256AC3DA0F4B6AC300CF3369 /* NibToXibConverterAppDelegate.m in Sources */, 186 | ); 187 | runOnlyForDeploymentPostprocessing = 0; 188 | }; 189 | /* End PBXSourcesBuildPhase section */ 190 | 191 | /* Begin PBXVariantGroup section */ 192 | 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { 193 | isa = PBXVariantGroup; 194 | children = ( 195 | 089C165DFE840E0CC02AAC07 /* English */, 196 | ); 197 | name = InfoPlist.strings; 198 | sourceTree = ""; 199 | }; 200 | 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { 201 | isa = PBXVariantGroup; 202 | children = ( 203 | 1DDD58150DA1D0A300B32029 /* English */, 204 | ); 205 | name = MainMenu.xib; 206 | sourceTree = ""; 207 | }; 208 | /* End PBXVariantGroup section */ 209 | 210 | /* Begin XCBuildConfiguration section */ 211 | C01FCF4B08A954540054247B /* Debug */ = { 212 | isa = XCBuildConfiguration; 213 | buildSettings = { 214 | ALWAYS_SEARCH_USER_PATHS = NO; 215 | COMBINE_HIDPI_IMAGES = YES; 216 | COPY_PHASE_STRIP = NO; 217 | GCC_DYNAMIC_NO_PIC = NO; 218 | GCC_MODEL_TUNING = G5; 219 | GCC_OPTIMIZATION_LEVEL = 0; 220 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 221 | GCC_PREFIX_HEADER = NibToXibConverter_Prefix.pch; 222 | INFOPLIST_FILE = "NibToXibConverter-Info.plist"; 223 | INSTALL_PATH = "$(HOME)/Applications"; 224 | PRODUCT_NAME = NibToXibConverter; 225 | }; 226 | name = Debug; 227 | }; 228 | C01FCF4C08A954540054247B /* Release */ = { 229 | isa = XCBuildConfiguration; 230 | buildSettings = { 231 | ALWAYS_SEARCH_USER_PATHS = NO; 232 | COMBINE_HIDPI_IMAGES = YES; 233 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 234 | GCC_MODEL_TUNING = G5; 235 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 236 | GCC_PREFIX_HEADER = NibToXibConverter_Prefix.pch; 237 | INFOPLIST_FILE = "NibToXibConverter-Info.plist"; 238 | INSTALL_PATH = "$(HOME)/Applications"; 239 | PRODUCT_NAME = NibToXibConverter; 240 | }; 241 | name = Release; 242 | }; 243 | C01FCF4F08A954540054247B /* Debug */ = { 244 | isa = XCBuildConfiguration; 245 | buildSettings = { 246 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 247 | GCC_C_LANGUAGE_STANDARD = gnu99; 248 | GCC_OPTIMIZATION_LEVEL = 0; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 250 | GCC_WARN_UNUSED_VARIABLE = YES; 251 | MACOSX_DEPLOYMENT_TARGET = 10.6; 252 | ONLY_ACTIVE_ARCH = YES; 253 | SDKROOT = macosx; 254 | }; 255 | name = Debug; 256 | }; 257 | C01FCF5008A954540054247B /* Release */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; 261 | GCC_C_LANGUAGE_STANDARD = gnu99; 262 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 263 | GCC_WARN_UNUSED_VARIABLE = YES; 264 | MACOSX_DEPLOYMENT_TARGET = 10.6; 265 | SDKROOT = macosx; 266 | }; 267 | name = Release; 268 | }; 269 | /* End XCBuildConfiguration section */ 270 | 271 | /* Begin XCConfigurationList section */ 272 | C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "NibToXibConverter" */ = { 273 | isa = XCConfigurationList; 274 | buildConfigurations = ( 275 | C01FCF4B08A954540054247B /* Debug */, 276 | C01FCF4C08A954540054247B /* Release */, 277 | ); 278 | defaultConfigurationIsVisible = 0; 279 | defaultConfigurationName = Release; 280 | }; 281 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NibToXibConverter" */ = { 282 | isa = XCConfigurationList; 283 | buildConfigurations = ( 284 | C01FCF4F08A954540054247B /* Debug */, 285 | C01FCF5008A954540054247B /* Release */, 286 | ); 287 | defaultConfigurationIsVisible = 0; 288 | defaultConfigurationName = Release; 289 | }; 290 | /* End XCConfigurationList section */ 291 | }; 292 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 293 | } 294 | -------------------------------------------------------------------------------- /NibToXibConverter/NibToXibConverterAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // NibToXibConverterAppDelegate.h 3 | // NibToXibConverter 4 | // 5 | // Created by Devarshi on 12/10/12. 6 | // Copyright 2012 DaemonConstruction. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NibToXibConverterAppDelegate : NSObject { 12 | NSWindow *window; 13 | NSURL *inputFolderUrl; 14 | NSURL *outputFolderUrl; 15 | BOOL converting; 16 | NSString *status; 17 | NSMutableArray *ibtoolCommandsArray; 18 | NSInteger processedFilesCount; 19 | NSInteger totalFilesCount; 20 | NSInteger leftFilesCount; 21 | } 22 | 23 | @property (assign) IBOutlet NSWindow *window; 24 | @property (readwrite, retain) NSMutableArray *ibtoolCommandsArray; 25 | @property (readwrite, retain) NSString *status; 26 | @property (readwrite, retain) NSURL *inputFolderUrl; 27 | @property (readwrite, retain) NSURL *outputFolderUrl; 28 | @property (assign) BOOL converting; 29 | @property (assign) NSInteger processedFilesCount; 30 | @property (assign) NSInteger totalFilesCount; 31 | @property (assign) NSInteger leftFilesCount; 32 | 33 | - (void)convertToXIBFromNib; 34 | - (void)chooseInputDirectory; 35 | - (void)chooseOutputDirectory; 36 | - (void)clearAll; 37 | @end 38 | -------------------------------------------------------------------------------- /NibToXibConverter/NibToXibConverterAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // NibToXibConverterAppDelegate.m 3 | // NibToXibConverter 4 | // 5 | // Created by Devarshi on 12/10/12. 6 | // Copyright 2012 DaemonConstruction. All rights reserved. 7 | //Steps: 8 | // 1. Frame array for iBtool commands 9 | // 2. Execute each command 10 | 11 | #import "NibToXibConverterAppDelegate.h" 12 | 13 | @interface NibToXibConverterAppDelegate (Private) 14 | - (void)frameIbtoolCommandForInputFilePath:(NSURL *)inputFileUrl; 15 | - (void)executeIBToolCommands; 16 | @end 17 | 18 | @implementation NibToXibConverterAppDelegate 19 | 20 | @synthesize window, inputFolderUrl, outputFolderUrl, status, converting, ibtoolCommandsArray, processedFilesCount, totalFilesCount, leftFilesCount; 21 | 22 | - (void)awakeFromNib 23 | { 24 | self.converting = NO; 25 | self.status = @"NIB to XIB Converter"; 26 | self.ibtoolCommandsArray = [[NSMutableArray alloc] initWithCapacity:2]; 27 | 28 | } 29 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { 30 | // Insert code here to initialize your application 31 | 32 | } 33 | 34 | - (void)chooseInputDirectory 35 | { 36 | self.status = @"Choose Input Directory"; 37 | NSOpenPanel *anOpenPanel = [NSOpenPanel openPanel]; 38 | [anOpenPanel setCanChooseDirectories:YES]; 39 | [anOpenPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) { 40 | if (result == NSFileHandlingPanelOKButton) { 41 | self.inputFolderUrl = [[anOpenPanel URLs] objectAtIndex:0]; 42 | 43 | } 44 | self.status = @"NIB to XIB Converter"; 45 | }]; 46 | 47 | 48 | } 49 | 50 | - (void)chooseOutputDirectory 51 | { 52 | self.status = @"Choose Output Directory"; 53 | NSOpenPanel *anOpenPanel = [NSOpenPanel openPanel]; 54 | [anOpenPanel setCanChooseDirectories:YES]; 55 | [anOpenPanel beginSheetModalForWindow:self.window completionHandler:^(NSInteger result) { 56 | if (result == NSFileHandlingPanelOKButton) { 57 | self.outputFolderUrl = [[anOpenPanel URLs] objectAtIndex:0]; 58 | } 59 | 60 | self.status = @"NIB to XIB Converter"; 61 | }]; 62 | 63 | 64 | } 65 | 66 | - (void)convertToXIBFromNib 67 | { 68 | 69 | BOOL isDirectory; 70 | if ([[NSFileManager defaultManager] fileExistsAtPath:[self.inputFolderUrl path] isDirectory:&isDirectory] && isDirectory) 71 | { 72 | if ([[self.inputFolderUrl pathExtension] isEqualToString:@"nib"]) { 73 | // use ibtool because nib is found :-) 74 | 75 | [self frameIbtoolCommandForInputFilePath:self.inputFolderUrl]; 76 | } 77 | else { 78 | // folder contains other folders so navigate 79 | 80 | NSFileManager *fileManager =[NSFileManager defaultManager]; 81 | NSArray *keys = [NSArray arrayWithObjects:NSURLIsDirectoryKey,NSURLNameKey,NSURLNameKey,nil]; 82 | 83 | NSDirectoryEnumerator *directoryEnumerator = [fileManager enumeratorAtURL:self.inputFolderUrl includingPropertiesForKeys:keys options:NSDirectoryEnumerationSkipsHiddenFiles errorHandler:^BOOL(NSURL *url, NSError *error) { 84 | return YES; 85 | }]; 86 | 87 | for (NSURL *url in directoryEnumerator) 88 | { 89 | NSNumber *isDirectory; 90 | [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:NULL]; 91 | 92 | if ([isDirectory boolValue]) { 93 | 94 | NSString *directoryName; 95 | [url getResourceValue:&directoryName forKey:NSURLNameKey error:NULL]; 96 | 97 | if ([[directoryName pathExtension] isEqualToString:@"nib"]) { 98 | [self frameIbtoolCommandForInputFilePath:url]; 99 | [directoryEnumerator skipDescendants]; 100 | } 101 | else { 102 | // do nothing 103 | // just chill :-) 104 | } 105 | 106 | } 107 | else { 108 | // file found :-( 109 | // do nothing :-) 110 | } 111 | 112 | } 113 | 114 | } 115 | 116 | } 117 | else { 118 | // file found :-( 119 | // do nothing :-) 120 | } 121 | 122 | 123 | [self executeIBToolCommands]; 124 | 125 | 126 | } 127 | 128 | - (void)frameIbtoolCommandForInputFilePath:(NSURL *)inputFileUrl 129 | { 130 | // obtain outputFileUrl 131 | NSString *inputFileName = [inputFileUrl lastPathComponent]; // file name with nib extension obtained 132 | NSString *inputFileBaseName = [inputFileName stringByDeletingPathExtension]; 133 | 134 | NSString *outputFileName = [inputFileBaseName stringByAppendingPathExtension:@"xib"]; 135 | 136 | // If inputFolderUrl and outputFolderUrl are the same, we convert the nib file in-place. 137 | NSURL *outputFileBaseURL; 138 | if ([self.outputFolderUrl isEqual:self.inputFolderUrl]) { 139 | outputFileBaseURL = [inputFileUrl URLByDeletingLastPathComponent]; 140 | } 141 | else { 142 | outputFileBaseURL = self.outputFolderUrl; 143 | } 144 | 145 | NSURL *outputFileURL = [outputFileBaseURL URLByAppendingPathComponent:outputFileName]; 146 | 147 | NSTask *theIBToolCommand = [[NSTask alloc] init]; 148 | [theIBToolCommand setLaunchPath:@"/Developer/usr/bin/ibtool"]; 149 | 150 | NSArray *argumentsArray = [[NSArray alloc] initWithObjects:[inputFileUrl path],@"--upgrade",@"--write",[outputFileURL path],nil]; 151 | [theIBToolCommand setArguments:argumentsArray]; 152 | [argumentsArray release]; 153 | 154 | [self.ibtoolCommandsArray addObject:theIBToolCommand]; 155 | [theIBToolCommand release]; 156 | //[theIBToolCommand launch]; 157 | // [theIBToolCommand waitUntilExit]; 158 | } 159 | 160 | - (void)executeIBToolCommands 161 | { 162 | self.status = @"Converting ..."; 163 | self.totalFilesCount = [self.ibtoolCommandsArray count]; 164 | self.leftFilesCount = self.totalFilesCount; 165 | self.processedFilesCount = 0; 166 | 167 | dispatch_queue_t aGlobalConcurrentQueue = dispatch_get_global_queue(0, 0); 168 | dispatch_async(aGlobalConcurrentQueue, ^{ 169 | self.converting = YES; 170 | dispatch_apply([self.ibtoolCommandsArray count], aGlobalConcurrentQueue, ^(size_t index) { 171 | ++ self.processedFilesCount; 172 | -- self.leftFilesCount; 173 | NSTask *receivedTask = [self.ibtoolCommandsArray objectAtIndex:index]; 174 | NSString *statusString = [[NSString alloc] initWithFormat:@"%@",[[[receivedTask arguments] lastObject] lastPathComponent]]; 175 | self.status = statusString; 176 | [statusString release]; 177 | [receivedTask launch]; 178 | [receivedTask waitUntilExit]; 179 | }); 180 | 181 | self.leftFilesCount = 0; 182 | self.converting = NO; 183 | self.status = @"NIB to XIB Converter"; 184 | [self.ibtoolCommandsArray removeAllObjects]; 185 | 186 | }); 187 | 188 | 189 | 190 | } 191 | - (void)clearAll 192 | { 193 | self.status = @"NIB to XIB Converter";// 194 | self.leftFilesCount = 0; // 195 | self.processedFilesCount = 0; // 196 | self.inputFolderUrl = nil; 197 | self.outputFolderUrl = nil; 198 | [self.ibtoolCommandsArray removeAllObjects];// 199 | self.totalFilesCount = 0;// 200 | } 201 | 202 | 203 | @end 204 | -------------------------------------------------------------------------------- /NibToXibConverter/NibToXibConverter_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'NibToXibConverter' target in the 'NibToXibConverter' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /NibToXibConverter/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // NibToXibConverter 4 | // 5 | // Created by Devarshi on 12/10/12. 6 | // Copyright 2012 DaemonConstruction. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Simple application to convert nib to xib. 2 | 3 | It uses ibtool and helps to convert nibs to xibs in bulk by giving option to select input and output folder. 4 | 5 | Here is a how to guide: http://daemonconstruction.blogspot.in/2012/10/nib-to-xib-conversion.html 6 | 7 | Have fun :-) 8 | 9 | Please note that the project is no longer actively maintained. My assumption is that this was useful when Apple first introduced XIBs, after that they moved to using Storyboard, Swift UI. So I think the initial use case is now obsolete. However if anyone still wants to use it for his/ her project I can provide commercial support for which I can be reached at ios.devarshi@gmail.com 10 | --------------------------------------------------------------------------------