Refactor SwiftUI extension generation and generation SwiftUI extension for images
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit

This commit is contained in:
2022-11-03 15:00:27 +01:00
parent 4f7d7e18b1
commit 085f1ffc33
25 changed files with 219 additions and 264 deletions

View File

@ -72,17 +72,16 @@ struct ParsedImage {
// MARK: - Extension property
func getImageProperty() -> String {
"""
var \(name): UIImage {
UIImage(named: "\(name)")!
}
"""
}
func getStaticImageProperty() -> String {
"""
static var \(name): UIImage {
func getImageProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
if isSwiftUI {
return """
\(isStatic ? "static ": "")var \(name): Image {
Image("\(name)")
}
"""
}
return """
\(isStatic ? "static ": "")var \(name): UIImage {
UIImage(named: "\(name)")!
}
"""