根据 XCAssets 内容,自动生成 Swift 代码。
- 根据
Assets
生成 Images 代码 - 根据
Assets
生成 Colors 代码 - 根据
.strings
生成 i18n 代码
//
// I18n
//
// ⚠️ DO NOT EDIT.
// Code generated by Yep(https://github.com/octree/Yep) on 2019/7/5.
// Copyright © 2019 Octree. All rights reserved.
//
import UIKit
struct I18n {
/// "删除"
@inline(__always) static var delete: String {
return NSLocalizedString("delete", comment: "")
}
/// "置顶"
@inline(__always) static var pin: String {
return NSLocalizedString("pin", comment: "")
}
}
//
// Images
//
// ⚠️ DO NOT EDIT.
// Code generated by Yep(https://github.com/octree/Yep) on 2019/7/5.
// Copyright © 2019 Octree. All rights reserved.
//
import SwiftUI
// MARK: - ImageRes
extension Image {
public enum Assets {
public enum CalendarUI {
public static var chevronLeft: Image {
return Image("CalendarUI/chevronLeft", bundle: .module)
}
}
}
}
在工程目录创建 .yep.json
文件
{
"assetPath": "./Sources/Assets/Resources/Media.xcassets",
"uiColorDestination": "./Sources/Assets/Generated/UIColor.Generated.swift",
"uiImageDestination": "./Sources/Assets/Generated/UIImage.Generated.swift",
"swiftUIColorDestination": "./Sources/Assets/Generated/Color.Generated.swift",
"swiftUIImageDestination": "./Sources/Assets/Generated/Image.Generated.swift",
"i18nStringsPath": "./Sources/Assets/Resources/en.lproj/Localizable.strings",
"i18nDestination": "./Sources/Assets/Generated/I18n.swift",
"isSPM": true
}
然后在工程目录执行命令即可
# just works
yep