Skip to content

Commit

Permalink
high quality app icon
Browse files Browse the repository at this point in the history
  • Loading branch information
underthestars-zhy committed May 9, 2022
1 parent 122896c commit 931b161
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
8 changes: 4 additions & 4 deletions IconChanger.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_ASSET_PATHS = "\"IconChanger/Preview Content\"";
DEVELOPMENT_TEAM = 44BN78992X;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -344,7 +344,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.1.2;
MARKETING_VERSION = 1.1.3;
PRODUCT_BUNDLE_IDENTIFIER = com.zhuhaoyu.IconChanger;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -362,7 +362,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_ASSET_PATHS = "\"IconChanger/Preview Content\"";
DEVELOPMENT_TEAM = 44BN78992X;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -375,7 +375,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MARKETING_VERSION = 1.1.2;
MARKETING_VERSION = 1.1.3;
PRODUCT_BUNDLE_IDENTIFIER = com.zhuhaoyu.IconChanger;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
33 changes: 20 additions & 13 deletions IconChanger/IconList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,28 @@ struct IconList: View {
}
} else {
ForEach(iconManager.apps, id: \.self) { app in
VStack {
Button {
setPath = app
} label: {
Image(nsImage: NSWorkspace.shared.icon(forFile: app))
.resizable()
.scaledToFit()
.padding(.bottom)
}
.buttonStyle(BorderlessButtonStyle())
if let rep = NSWorkspace.shared.icon(forFile: app)
.bestRepresentation(for: NSRect(x: 0, y: 0, width: 1024, height: 1024), context: nil, hints: nil) {
VStack {
Button {
setPath = app
} label: {
Image(nsImage: { () -> NSImage in
let image = NSImage(size: rep.size)
image.addRepresentation(rep)
return image
}())
.resizable()
.scaledToFit()
.padding(.bottom)
}
.buttonStyle(BorderlessButtonStyle())

Text(iconManager.getAppName(app))
.multilineTextAlignment(.center)
Text(iconManager.getAppName(app))
.multilineTextAlignment(.center)
}
.padding()
}
.padding()
}
}
}
Expand Down

0 comments on commit 931b161

Please sign in to comment.