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

@@ -74,41 +74,20 @@ struct ParsedColor {
// MARK: - UIKit
func getColorProperty() -> String {
"""
func getColorProperty(isStatic: Bool, isSwiftUI: Bool) -> String {
if isSwiftUI {
return """
/// Color \(name) is \(light) (light) or \(dark) (dark)"
\(isStatic ? "static " : "")var \(name): Color {
Color("\(name)")
}
"""
}
return """
/// Color \(name) is \(light) (light) or \(dark) (dark)"
@objc var \(name): UIColor {
\(isStatic ? "static " : "@objc ")var \(name): UIColor {
UIColor(named: "\(name)")!
}
"""
}
func getColorStaticProperty() -> String {
"""
/// Color \(name) is \(light) (light) or \(dark) (dark)"
static var \(name): UIColor {
UIColor(named: "\(name)")!
}
"""
}
// MARK: - SwiftUI
func getSUIColorProperty() -> String {
"""
/// Color \(name) is \(light) (light) or \(dark) (dark)"
var \(name): Color {
Color("\(name)")
}
"""
}
func getSUIColorStaticProperty() -> String {
"""
/// Color \(name) is \(light) (light) or \(dark) (dark)"
static var \(name): Color {
Color("\(name)")!
}
"""
}
}