diff --git a/Mobile Apps Icon Generator.xcodeproj/project.pbxproj b/Mobile Apps Icon Generator.xcodeproj/project.pbxproj index 36ae06c..8edabd4 100644 --- a/Mobile Apps Icon Generator.xcodeproj/project.pbxproj +++ b/Mobile Apps Icon Generator.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 28CE9DEA266488E300A3F7B1 /* macOS_Contents.json in Resources */ = {isa = PBXBuildFile; fileRef = 28CE9DE9266488E300A3F7B1 /* macOS_Contents.json */; }; A6321E691B09994E003247B1 /* LTUtilites.m in Sources */ = {isa = PBXBuildFile; fileRef = A6321E681B09994E003247B1 /* LTUtilites.m */; }; A6321E6F1B09C1CD003247B1 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6321E6E1B09C1CD003247B1 /* CoreGraphics.framework */; }; A6321E711B09C1F5003247B1 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A6321E701B09C1F5003247B1 /* Quartz.framework */; }; @@ -35,6 +36,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 28CE9DE9266488E300A3F7B1 /* macOS_Contents.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = macOS_Contents.json; sourceTree = ""; }; A6321E671B09994E003247B1 /* LTUtilites.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LTUtilites.h; sourceTree = ""; }; A6321E681B09994E003247B1 /* LTUtilites.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LTUtilites.m; sourceTree = ""; }; A6321E6A1B099961003247B1 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; @@ -86,6 +88,7 @@ A65A3FB21B09F5A10062D80C /* Assets */ = { isa = PBXGroup; children = ( + 28CE9DE9266488E300A3F7B1 /* macOS_Contents.json */, A68D6AD21BC50CEB000E35E0 /* AndroidIconSize.plist */, A65A3FB31B09F5A10062D80C /* Contents.json */, A65A3FB51B09F6DD0062D80C /* IconSize.plist */, @@ -214,12 +217,12 @@ A65AFA261B05F07E008EDF83 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0820; + LastUpgradeCheck = 1250; ORGANIZATIONNAME = "© IML"; TargetAttributes = { A65AFA2D1B05F07E008EDF83 = { CreatedOnToolsVersion = 6.3.1; - DevelopmentTeam = LH225FX8ZS; + DevelopmentTeam = 2Z39MNNT8W; }; A65AFA431B05F07E008EDF83 = { CreatedOnToolsVersion = 6.3.1; @@ -229,7 +232,7 @@ }; buildConfigurationList = A65AFA291B05F07E008EDF83 /* Build configuration list for PBXProject "Mobile Apps Icon Generator" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, @@ -254,6 +257,7 @@ A65AFA571B05FC3A008EDF83 /* droppanel.png in Resources */, A65AFA3C1B05F07E008EDF83 /* Images.xcassets in Resources */, A68D6AD31BC50CEB000E35E0 /* AndroidIconSize.plist in Resources */, + 28CE9DEA266488E300A3F7B1 /* macOS_Contents.json in Resources */, A65A3FB61B09F6DD0062D80C /* IconSize.plist in Resources */, A65AFA3F1B05F07E008EDF83 /* Main.storyboard in Resources */, A65A3FB41B09F5A10062D80C /* Contents.json in Resources */, @@ -316,18 +320,28 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -362,18 +376,28 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -400,13 +424,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = "Apple Development"; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = LH225FX8ZS; + DEVELOPMENT_TEAM = 2Z39MNNT8W; + ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "iOS Apps Icon Generator/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.9; - PRODUCT_BUNDLE_IDENTIFIER = com.imodlife.apps.icongenerator; + PRODUCT_BUNDLE_IDENTIFIER = com.paopaosa.icongenerator; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -415,13 +440,14 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_IDENTITY = "Apple Development"; COMBINE_HIDPI_IMAGES = YES; - DEVELOPMENT_TEAM = LH225FX8ZS; + DEVELOPMENT_TEAM = 2Z39MNNT8W; + ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = "iOS Apps Icon Generator/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; MACOSX_DEPLOYMENT_TARGET = 10.9; - PRODUCT_BUNDLE_IDENTIFIER = com.imodlife.apps.icongenerator; + PRODUCT_BUNDLE_IDENTIFIER = com.paopaosa.icongenerator; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/iOS Apps Icon Generator/Assets/macOS_Contents.json b/iOS Apps Icon Generator/Assets/macOS_Contents.json new file mode 100644 index 0000000..b32bc8b --- /dev/null +++ b/iOS Apps Icon Generator/Assets/macOS_Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x", + "filename" : "icon_16@1x.png" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x", + "filename" : "icon_16@2x.png" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x", + "filename" : "icon_32@1x.png" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x", + "filename" : "icon_32@2x.png" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x", + "filename" : "icon_128@1x.png" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x", + "filename" : "icon_128@2x.png" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x", + "filename" : "icon_256@1x.png" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x", + "filename" : "icon_256@2x.png" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x", + "filename" : "icon_512@1x.png" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x", + "filename" : "icon_512@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/iOS Apps Icon Generator/ViewController.h b/iOS Apps Icon Generator/ViewController.h index 273891a..504405e 100644 --- a/iOS Apps Icon Generator/ViewController.h +++ b/iOS Apps Icon Generator/ViewController.h @@ -16,6 +16,8 @@ NSString *outputPathAndroid; + NSString *outputPathMacOS; + NSDictionary *iconNamedSizes; } @@ -23,6 +25,7 @@ @property (weak) IBOutlet IMLImageView_DragDrop *ivIcon; +@property (weak) IBOutlet NSButton *isMacOS; @property (weak) IBOutlet NSButton *isIOS; @property (weak) IBOutlet NSButton *isAndroid; diff --git a/iOS Apps Icon Generator/ViewController.m b/iOS Apps Icon Generator/ViewController.m index 0f426d5..88691e8 100644 --- a/iOS Apps Icon Generator/ViewController.m +++ b/iOS Apps Icon Generator/ViewController.m @@ -10,7 +10,7 @@ @implementation ViewController @synthesize ivIcon, lbOutputPath, lbMessage; -@synthesize isIOS, isAndroid; +@synthesize isIOS, isAndroid, isMacOS; - (void)viewDidLoad { [super viewDidLoad]; @@ -34,6 +34,8 @@ - (void)dropComplete:(NSString *)filePath { outputPath = [[[[filePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"iml_generated_output/ios"] stringByAppendingString:@".xcassets"] stringByAppendingPathComponent:@"AppIcon.appiconset"]; + outputPathMacOS = [[[[filePath stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"iml_generated_output/macOS"] stringByAppendingString:@".xcassets"] stringByAppendingPathComponent:@"AppIcon.appiconset"]; + lbOutputPath.stringValue = [filePath stringByDeletingLastPathComponent]; } @@ -49,6 +51,26 @@ - (IBAction)btnGenerateClicked:(id)sender { NSError *error; NSFileManager *fm = [NSFileManager defaultManager]; + // macOS work + if (isMacOS.state == NSOnState) { + // delete old one + [fm removeItemAtPath:outputPathMacOS error:&error]; + + // create new result dir for iOS + if([fm createDirectoryAtPath:outputPathMacOS withIntermediateDirectories:YES attributes:nil error:&error]){ + // make macOS json file + [self makeContentJsonForMacOS:fm withIconSizeFile:@"macOSIconSize.plist" outputPath:outputPathMacOS]; + + + //NSRunAlertPanel(@"Success", @"Your Icon set was generated at: %@", nil, nil, nil, outputPath); + [self showMessage:@"Success" forError:false]; + } else { + //NSLog(@"Convert error: %@", error.description); + //NSRunAlertPanel(@"Error", @"%@", nil, nil, nil, @"Convert failed, please try again."); + [self showMessage:@"Failed" forError:true]; + } + } + // iOS work if (isIOS.state == NSOnState) { // delete old one @@ -126,4 +148,31 @@ - (void)showMessage:(NSString *)msg forError:(Boolean)isError { lbMessage.hidden = false; } +- (void)makeContentJsonForMacOS:(NSFileManager *)fm withIconSizeFile:(NSString *)plistFileName outputPath:(NSString *)outPath { + NSError *error = nil; + NSString *originJsonPath = [[NSBundle mainBundle] pathForResource:@"macOS_Contents" ofType:@"json"]; + [fm copyItemAtPath:originJsonPath toPath:[outPath stringByAppendingPathComponent:@"Contents.json"] error:&error]; + NSData *originData = [NSData dataWithContentsOfFile:originJsonPath]; + id jsonObject = [NSJSONSerialization JSONObjectWithData:originData options:NSJSONReadingAllowFragments error:&error]; + if ([jsonObject isKindOfClass:[NSDictionary class]] == NO) return; + NSDictionary *dict = (NSDictionary *)jsonObject; + // rewrite for reading from macOS_Contents.json + iconNamedSizes = [dict objectForKey:@"images"]; + NSString *sizeA,*sizeB,*scale; + NSString *sizeStr = nil; + NSArray *sizeArray = nil; + NSString *named; + for (NSDictionary *item in iconNamedSizes) { + sizeStr = [item objectForKey:@"size"]; + sizeArray = [sizeStr componentsSeparatedByString:@"x"]; + sizeA = sizeArray.firstObject; + sizeB = sizeArray.lastObject; + named = [item objectForKey:@"filename"]; + scale = [[item objectForKey:@"scale"] stringByReplacingOccurrencesOfString:@"x" withString:@""]; + double sizeWidth = sizeA.doubleValue * scale.doubleValue; + double sizeHeight = sizeB.doubleValue * scale.doubleValue; + [LTUtilites writeImage:[LTUtilites resizeImageWithPath:inputPath toSize:CGSizeMake(sizeWidth,sizeHeight)] toPath:[outPath stringByAppendingPathComponent:named]]; + } +} + @end diff --git a/iOS Apps Icon Generator/en.lproj/Main.storyboard b/iOS Apps Icon Generator/en.lproj/Main.storyboard index 479c16b..2aa0ae3 100644 --- a/iOS Apps Icon Generator/en.lproj/Main.storyboard +++ b/iOS Apps Icon Generator/en.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -168,11 +168,11 @@ - + - + @@ -183,7 +183,7 @@ - + @@ -192,16 +192,16 @@ - + - + - 1- Drag your designed 1024x1024 (px) icon to the left. + 1- Drag your designed 1024x1024 (px) icon to the left. 2- Choose the target Mobile Platform 3- Press Generate button 
Support: @@ -213,13 +213,13 @@ - + - + @@ -227,19 +227,16 @@ - - + + + - - + - + + - - - + + + - + + - + + +