Handle bundle for Image and Color
Some checks reported warnings
gitea-openium/resgen.swift/pipeline/head This commit is unstable

This commit is contained in:
2025-07-25 10:03:14 +02:00
parent 3510b60e97
commit d7dd37c32d
12 changed files with 116 additions and 63 deletions

View File

@@ -83,20 +83,21 @@ struct ParsedColor {
func getColorProperty(
isStatic: Bool,
isSwiftUI: Bool,
visibility: ExtensionVisibility
visibility: ExtensionVisibility,
assetBundle: AssetBundle
) -> String {
if isSwiftUI {
return """
/// Color \(name) is \(light) (light) or \(dark) (dark)"
\(visibility) \(isStatic ? "static " : "")var \(name): Color {
Color("\(name)")
Color("\(name)", bundle: Bundle.\(assetBundle))
}
"""
}
return """
/// Color \(name) is \(light) (light) or \(dark) (dark)"
\(isStatic ? "" : "@objc ")\(visibility) \(isStatic ? "static " : "")var \(name): UIColor {
UIColor(named: "\(name)")!
UIColor(named: "\(name)", in: Bundle.\(assetBundle), compatibleWith: nil)!
}
"""
}