convertappicon 将PDF转换为iOS和watchOS的多个应用程序图标

网友投稿 699 2022-10-25

convertAPPicon 将PDF转换为iOS和watchOS的多个应用程序图标

convertappicon 将PDF转换为iOS和watchOS的多个应用程序图标

convertappicon

convertappicon converts a pdf into multiple app icons. It is a macOS tool written in Swift and currently supports generating iOS icons (iPhone, iPad and watch). The easiest way is to execute it from a project target script phase inside of Xcode.

IMPORTANT: Put the master pdf file into the project right alongside the destination AppIcon with an additional tailing 'Pdf' asset name (see sample). You do not need to bundle/copy the pdf to the target itself.

Background

Xcode supports (named) images from pdf assets for a long time, but sadly the app icon itself is an exception: up to 18 png files have to be arranged manually inside of Xcode to provide a proper app icon.

Due to an app offering multiple, pre-defined app icons to the user as an alternative as well, this can be a cumbersome task.

For that reason, I've created this script during a hackathon as a proof of concept and then later moved from a bash/ImageMagick/scripting setup to a native Swift tool.

Feel free to ask questions, fork or create pull requests - oliver.michalak@kreait.com

Synopsis

convertappicon [-c] [-h] [-t] [-s iphone ipad watch marketing] APPICONSETPATH

APPICONSETPATH : The last parameter is the (partial) path to the destination .appiconset folder. It will traverse down and tries to find the first matching subfolder.

-c : Will clean the target folder first.

-h : Will show this help.

-t : Test only, will print app icon path, master pdf path and all possible icons only.

-s : Select icon categories: 'iphone', 'ipad', 'watch' or 'marketing' - if omitted all of them will be created.

Sample

There is a sample project showing you how the tool is going to be integrated. It was setup in the following steps:

create a new iOS projectopen the Assets.xcassets entry (a default AppIcon asset should already be set up but empty)add an new image asset and name it AppIconPdffrom either Sketch or OmniGraffle export the sample Icon file into a pdfdrag the pdf into the newly created AppIconPdf panel (optional: set scale to Single Scale)create a new (aggregation) target in the projects target list (see cross platform templates)within that target, create a new run script build phaseenter the path to the convertappicon script and add the "${SRCROOT}" folderselect the build target and build it, to run the conversionnow the previously empty AppIcon asset contains all icons

Providing "${SRCROOT}" in a target build script is usually enough but if you have multiple icons, you must provide the full folder path.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:electron-vue —— 基于 vue 来构造 electron 应用程序的样板代码
下一篇:Discourse 自定义头部链接(Custom Header Links)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~