From abb259951c73b2db930c80025de8fd543a52e707 Mon Sep 17 00:00:00 2001 From: Thibaut Schmitt Date: Wed, 30 Apr 2025 10:21:03 +0200 Subject: [PATCH] Generation de l'architecture compat Swift 6 avec des final class Sendable --- Sources/ResgenSwift/Generate/Model/ConfigurationFile.swift | 2 +- Sources/ResgenSwift/Images/Model/ParsedImage.swift | 2 +- .../ResgenSwift/Strings/Generator/StringsFileGenerator.swift | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Sources/ResgenSwift/Generate/Model/ConfigurationFile.swift b/Sources/ResgenSwift/Generate/Model/ConfigurationFile.swift index dd94e03..e92f9d6 100644 --- a/Sources/ResgenSwift/Generate/Model/ConfigurationFile.swift +++ b/Sources/ResgenSwift/Generate/Model/ConfigurationFile.swift @@ -55,7 +55,7 @@ struct ConfigurationArchitecture: Codable { func getClass(generateStaticProperty: Bool = true) -> String { guard children?.isEmpty == false else { - return "class \(classname) {}" + return "final class \(classname): Sendable {}" } let classDefinition = [ diff --git a/Sources/ResgenSwift/Images/Model/ParsedImage.swift b/Sources/ResgenSwift/Images/Model/ParsedImage.swift index 9383f3e..7c2b3f0 100644 --- a/Sources/ResgenSwift/Images/Model/ParsedImage.swift +++ b/Sources/ResgenSwift/Images/Model/ParsedImage.swift @@ -73,7 +73,7 @@ struct ParsedImage { Images.exit(withError: error) } - return String(data: data, encoding: .utf8) + return String(decoding: data, as: UTF8.self) } func generateImageContent(isVector: Bool) -> AssetContent { diff --git a/Sources/ResgenSwift/Strings/Generator/StringsFileGenerator.swift b/Sources/ResgenSwift/Strings/Generator/StringsFileGenerator.swift index ce26ffb..5467dec 100644 --- a/Sources/ResgenSwift/Strings/Generator/StringsFileGenerator.swift +++ b/Sources/ResgenSwift/Strings/Generator/StringsFileGenerator.swift @@ -137,9 +137,7 @@ class StringsFileGenerator { let json = try encoder.encode(rootObject) - if let jsonString = String(data: json, encoding: .utf8) { - return jsonString - } + return String(decoding: json, as: UTF8.self) } catch { debugPrint("Failed to encode: \(error)") -- 2.39.5