Fix Image
This commit is contained in:
parent
498c8fa4ae
commit
b4bbaa3bfd
@ -3,12 +3,12 @@
|
|||||||
FORCE_FLAG="$1"
|
FORCE_FLAG="$1"
|
||||||
|
|
||||||
## Font
|
## Font
|
||||||
swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \
|
#swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt" \
|
||||||
--extension-output-path "./Fonts/Generated" \
|
# --extension-output-path "./Fonts/Generated" \
|
||||||
--extension-name "FontYolo" \
|
# --extension-name "FontYolo" \
|
||||||
--extension-name-ui-kit "UIFontYolo" \
|
# --extension-name-ui-kit "UIFontYolo" \
|
||||||
--extension-suffix "GenAllScript" \
|
# --extension-suffix "GenAllScript" \
|
||||||
--info-plist-paths "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist"
|
# --info-plist-paths "./Fonts/Generated/test.plist ./Fonts/Generated/test2.plist"
|
||||||
#
|
#
|
||||||
#echo "\n-------------------------\n"
|
#echo "\n-------------------------\n"
|
||||||
#
|
#
|
||||||
@ -61,10 +61,10 @@ swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/sampleFontsAll.txt"
|
|||||||
|
|
||||||
#echo "\n-------------------------\n"
|
#echo "\n-------------------------\n"
|
||||||
#
|
#
|
||||||
## Images
|
# Images
|
||||||
#swift run -c release ResgenSwift images $FORCE_FLAG "./Images/sampleImages.txt" \
|
swift run -c release ResgenSwift images $FORCE_FLAG "./Images/sampleImages.txt" \
|
||||||
# --xcassets-path "./Images/imagium.xcassets" \
|
--xcassets-path "./Images/imagium.xcassets" \
|
||||||
# --extension-output-path "./Images/Generated" \
|
--extension-output-path "./Images/Generated" \
|
||||||
# --extension-name "UIImage" \
|
--extension-name "ImageYolo" \
|
||||||
# --extension-name-swift-ui "ImageYolo" \
|
--extension-name-ui-kit "UIImageYolo" \
|
||||||
# --extension-suffix "GenAllScript"
|
--extension-suffix "GenAllScript"
|
||||||
|
@ -47,8 +47,8 @@ images:
|
|||||||
inputFile: ./Images/sampleImages.txt
|
inputFile: ./Images/sampleImages.txt
|
||||||
xcassetsPath: ./Images/imagium.xcassets
|
xcassetsPath: ./Images/imagium.xcassets
|
||||||
extensionOutputPath: ./Images/Generated
|
extensionOutputPath: ./Images/Generated
|
||||||
extensionName: UIImage
|
extensionName: ImageYolo
|
||||||
extensionNameSwiftUI: ImageYolo
|
extensionNameUIKit: UIImageYolo
|
||||||
extensionSuffix: GenAllScript
|
extensionSuffix: GenAllScript
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
let xcassetsPath: String
|
let xcassetsPath: String
|
||||||
let extensionOutputPath: String
|
let extensionOutputPath: String
|
||||||
let extensionName: String?
|
let extensionName: String?
|
||||||
let extensionNameSwiftUI: String?
|
let extensionNameUIKit: String?
|
||||||
let extensionSuffix: String?
|
let extensionSuffix: String?
|
||||||
private let staticMembers: Bool?
|
private let staticMembers: Bool?
|
||||||
|
|
||||||
@ -235,14 +235,14 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
xcassetsPath: String,
|
xcassetsPath: String,
|
||||||
extensionOutputPath: String,
|
extensionOutputPath: String,
|
||||||
extensionName: String?,
|
extensionName: String?,
|
||||||
extensionNameSwiftUI: String?,
|
extensionNameUIKit: String?,
|
||||||
extensionSuffix: String?,
|
extensionSuffix: String?,
|
||||||
staticMembers: Bool?) {
|
staticMembers: Bool?) {
|
||||||
self.inputFile = inputFile
|
self.inputFile = inputFile
|
||||||
self.xcassetsPath = xcassetsPath
|
self.xcassetsPath = xcassetsPath
|
||||||
self.extensionOutputPath = extensionOutputPath
|
self.extensionOutputPath = extensionOutputPath
|
||||||
self.extensionName = extensionName
|
self.extensionName = extensionName
|
||||||
self.extensionNameSwiftUI = extensionNameSwiftUI
|
self.extensionNameUIKit = extensionNameUIKit
|
||||||
self.extensionSuffix = extensionSuffix
|
self.extensionSuffix = extensionSuffix
|
||||||
self.staticMembers = staticMembers
|
self.staticMembers = staticMembers
|
||||||
}
|
}
|
||||||
@ -254,7 +254,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
- Xcassets path: \(xcassetsPath)
|
- Xcassets path: \(xcassetsPath)
|
||||||
- Extension output path: \(extensionOutputPath)
|
- Extension output path: \(extensionOutputPath)
|
||||||
- Extension name: \(extensionName ?? "-")
|
- Extension name: \(extensionName ?? "-")
|
||||||
- Extension name SwiftUI: \(extensionNameSwiftUI ?? "-")
|
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||||
- Extension suffix: \(extensionSuffix ?? "-")
|
- Extension suffix: \(extensionSuffix ?? "-")
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
@ -36,10 +36,10 @@ extension ImagesConfiguration: Runnable {
|
|||||||
extensionName
|
extensionName
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
if let extensionNameSwiftUI = extensionNameSwiftUI {
|
if let extensionNameUIKit = extensionNameUIKit {
|
||||||
args += [
|
args += [
|
||||||
"--extension-name-swift-ui",
|
"--extension-name-ui-kit",
|
||||||
extensionNameSwiftUI
|
extensionNameUIKit
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
|
@ -21,8 +21,8 @@ struct Images: ParsableCommand {
|
|||||||
// MARK: - Static
|
// MARK: - Static
|
||||||
|
|
||||||
static let toolName = "Images"
|
static let toolName = "Images"
|
||||||
static let defaultExtensionName = "UIImage"
|
static let defaultExtensionName = "Image"
|
||||||
static let defaultExtensionNameSUI = "Image"
|
static let defaultExtensionNameUIKit = "UIImage"
|
||||||
|
|
||||||
// MARK: - Command Options
|
// MARK: - Command Options
|
||||||
|
|
||||||
@ -58,14 +58,14 @@ struct Images: ParsableCommand {
|
|||||||
inputFilename: options.inputFilenameWithoutExt,
|
inputFilename: options.inputFilenameWithoutExt,
|
||||||
extensionName: options.extensionName,
|
extensionName: options.extensionName,
|
||||||
extensionFilePath: options.extensionFilePath,
|
extensionFilePath: options.extensionFilePath,
|
||||||
isSwiftUI: false)
|
isSwiftUI: true)
|
||||||
|
|
||||||
ImageExtensionGenerator.generateExtensionFile(images: imagesToGenerate,
|
ImageExtensionGenerator.generateExtensionFile(images: imagesToGenerate,
|
||||||
staticVar: options.staticMembers,
|
staticVar: options.staticMembers,
|
||||||
inputFilename: options.inputFilenameWithoutExt,
|
inputFilename: options.inputFilenameWithoutExt,
|
||||||
extensionName: options.extensionNameSwiftUI,
|
extensionName: options.extensionNameUIKit,
|
||||||
extensionFilePath: options.extensionFilePathSwiftUI,
|
extensionFilePath: options.extensionFilePathUIKit,
|
||||||
isSwiftUI: true)
|
isSwiftUI: false)
|
||||||
|
|
||||||
print("[\(Self.toolName)] Images generated")
|
print("[\(Self.toolName)] Images generated")
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ struct Images: ParsableCommand {
|
|||||||
_ = Images.getSvgConverterPath()
|
_ = Images.getSvgConverterPath()
|
||||||
|
|
||||||
// Extension for UIKit and SwiftUI should have different name
|
// Extension for UIKit and SwiftUI should have different name
|
||||||
guard options.extensionName != options.extensionNameSwiftUI else {
|
guard options.extensionName != options.extensionNameUIKit else {
|
||||||
let error = ImagesError.extensionNamesCollision(options.extensionName)
|
let error = ImagesError.extensionNamesCollision(options.extensionName)
|
||||||
print(error.description)
|
print(error.description)
|
||||||
Images.exit(withError: error)
|
Images.exit(withError: error)
|
||||||
|
@ -27,11 +27,11 @@ struct ImagesOptions: ParsableArguments {
|
|||||||
@Option(help: "Tell if it will generate static properties or not")
|
@Option(help: "Tell if it will generate static properties or not")
|
||||||
var staticMembers: Bool = false
|
var staticMembers: Bool = false
|
||||||
|
|
||||||
@Option(help: "Extension name. If not specified, it will generate an UIImage extension.")
|
@Option(help: "Extension name. If not specified, it will generate an Image extension.")
|
||||||
var extensionName: String = Images.defaultExtensionName
|
var extensionName: String = Images.defaultExtensionName
|
||||||
|
|
||||||
@Option(help: "Extension name. If not specified, it will generate an Image extension.")
|
@Option(help: "Extension name. If not specified, it will generate an UIImage extension.")
|
||||||
var extensionNameSwiftUI: String = Images.defaultExtensionNameSUI
|
var extensionNameUIKit: String = Images.defaultExtensionNameUIKit
|
||||||
|
|
||||||
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Image{extensionSuffix}.swift")
|
@Option(help: "Extension suffix. Ex: MyApp, it will generate {extensionName}+Image{extensionSuffix}.swift")
|
||||||
var extensionSuffix: String?
|
var extensionSuffix: String?
|
||||||
@ -41,7 +41,7 @@ struct ImagesOptions: ParsableArguments {
|
|||||||
|
|
||||||
extension ImagesOptions {
|
extension ImagesOptions {
|
||||||
|
|
||||||
// MARK: - UIKit
|
// MARK: - SwiftUI
|
||||||
|
|
||||||
var extensionFileName: String {
|
var extensionFileName: String {
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
@ -54,17 +54,17 @@ extension ImagesOptions {
|
|||||||
"\(extensionOutputPath)/\(extensionFileName)"
|
"\(extensionOutputPath)/\(extensionFileName)"
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - SwiftUI
|
// MARK: - UIKit
|
||||||
|
|
||||||
var extensionFileNameSwiftUI: String {
|
var extensionFileNameUIKit: String {
|
||||||
if let extensionSuffix = extensionSuffix {
|
if let extensionSuffix = extensionSuffix {
|
||||||
return "\(extensionNameSwiftUI)+\(extensionSuffix).swift"
|
return "\(extensionNameUIKit)+\(extensionSuffix).swift"
|
||||||
}
|
}
|
||||||
return "\(extensionNameSwiftUI).swift"
|
return "\(extensionNameUIKit).swift"
|
||||||
}
|
}
|
||||||
|
|
||||||
var extensionFilePathSwiftUI: String {
|
var extensionFilePathUIKit: String {
|
||||||
"\(extensionOutputPath)/\(extensionFileNameSwiftUI)"
|
"\(extensionOutputPath)/\(extensionFileNameUIKit)"
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: -
|
// MARK: -
|
||||||
|
Loading…
x
Reference in New Issue
Block a user