集成SwiftGen图片资源管理器
1.cocoapods导入
pod 'SwiftGen'
2.新增js脚本,在TARGETS-Build Phaes-New Run Script Phase

3.导入下方js语句
if [[ -f "${PODS_ROOT}/SwiftGen/bin/swiftgen" ]]; then
"${PODS_ROOT}/SwiftGen/bin/swiftgen"
else
echo "warning: SwiftGen is not installed. Run 'pod install --repo-update' to install it."
fi

4.将js脚本位置至于resource之前

5.项目根目录下创建swiftgen.yml文件

6.将下面代码粘贴到swiftgen.yml文件中,注意替换JHProject项目名
input_dir: JHProject/
output_dir: JHProject/SwiftGen
strings:
inputs:
- base.lproj
outputs:
- templateName: structured-swift5
params:
publicAccess: true
enumName: Strings
output: Strings+Generated.swift
xcassets:
inputs:
- Assets.xcassets
outputs:
- templateName: swift5
params:
forceProvidesNamespaces: true
output: XCAssets+Generated.swift
7.项目里新建SwiftGen文件夹

8.编译项目,编译成功后项目里会生成下方两个文件,将其导入到项目中

9.使用
imgv.image = Asset.Tabbar.homeSelect.image

浙公网安备 33010602011771号