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

@@ -130,17 +130,22 @@ struct ParsedImage {
// MARK: - Extension property
func getImageProperty(isStatic: Bool, isSwiftUI: Bool, visibility: ExtensionVisibility) -> String {
func getImageProperty(
isStatic: Bool,
isSwiftUI: Bool,
visibility: ExtensionVisibility,
assetBundle: AssetBundle
) -> String {
if isSwiftUI {
return """
\(visibility) \(isStatic ? "static " : "")var \(name): Image {
Image("\(name)")
Image("\(name)", bundle: Bundle.\(assetBundle))
}
"""
}
return """
\(visibility) \(isStatic ? "static " : "")var \(name): UIImage {
UIImage(named: "\(name)")!
UIImage(named: "\(name)", in: Bundle.\(assetBundle), with: nil)!
}
"""
}