集成SwiftGen图片资源管理器

1.cocoapods导入

1
pod 'SwiftGen'

2.新增js脚本,在TARGETS-Build Phaes-New Run Script Phase

3.导入下方js语句

1
2
3
4
5
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项目名

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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.使用  

1
imgv.image = Asset.Tabbar.homeSelect.image

 

posted @   zk1947  阅读(153)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 通过 API 将Deepseek响应流式内容输出到前端
· 因为Apifox不支持离线,我果断选择了Apipost!
历史上的今天:
2017-09-07 ios弹出键盘取消默认大写属性
点击右上角即可分享
微信分享提示