Skip to content

configureAppIcon

从源图生成 iOS AppIcon.appiconset 所需多尺寸图标。

前置依赖

参数名类型说明
deps.existsSync / readFileSync / writeFileSync文件 IO读写 PNG 与 Contents.json
deps.join / dirnamePath路径
deps.sharpSharp缩放与格式转换

环境要求

  • Node.js + sharp

函数签名

typescript
function configureAppIconIOS(
  imagePath: string,
  projectPath: string,
  deps: ConfigureAppIconIOSDeps,
): Promise<ConfigureAppIconIOSResult>

参数

参数名类型必填说明
imagePathstring1024×1024 推荐
projectPathstring.xcodeproj 的 iOS 工程
depsConfigureAppIconIOSDepsfs / path / sharp

返回值

类型说明
ConfigureAppIconIOSResult{ success, error?, logs[] }

工作原理

  1. 定位或创建 Assets.xcassets/AppIcon.appiconset
  2. 按 Apple 要求尺寸列表用 sharp 生成 PNG。
  3. 更新 Contents.json 引用各 idiom/scale 文件。