iOS
[Xcode] SwiftGen 적용하기
teunteun2
2022. 9. 7. 15:12
1. Homebrew 설치
$ brew update
$ brew install swiftgen
2. SwiftGen 적용하고자 하는 프로젝트 상위 디렉토리로 이동해서
$ swiftgen config init
3. 그럼 자동으로 yml 파일이 생기고 열린다 ! -> yml 작성
input_dir: Hous-iOS-release/Resources/
output_dir: Hous-iOS-release/Resources/
xcassets:
inputs: Colors.xcassets
outputs:
templateName: swift5
output: Generated/Colors+Generated.swift
params:
enumName: Colors
inputs: Images.xcassets
outputs:
templateName: swift5
output: Generated/Images+Generated.swift
params:
enumName: Images
fonts:
inputs: Fonts
outputs:
templateName: swift5
output: Generated/Fonts+Generated.swift
params:
enumName: Fonts
xcassets 따로따로 작성하면 따로 생성되긴 하는데, 마지막으로 작성된 것만 올라간다.. 그래서 한번 순서 바꿔준다음 한번 다시 Run 해주어야 하던데 이거 해결방법 없나 ...
4. swiftgen config run !
yml 템플릿 여기서 참고 !
https://github.com/SwiftGen/SwiftGen/tree/stable/Documentation/templates