Localizable macro

This commit is contained in:
Oleksii Zghurskyi 2025-08-16 12:50:28 +03:00
commit c27de77d6c
6 changed files with 315 additions and 1 deletions

View file

@ -0,0 +1,23 @@
import SwiftSyntax
import SwiftDiagnostics
enum LocalizableDiagnostic {
case enumRequired
}
extension LocalizableDiagnostic: DiagnosticMessage {
var message: String {
switch self {
case .enumRequired:
"The @Localizable macro requires a nested enum with localization keys."
}
}
var diagnosticID: MessageID {
.init(domain: "LocalizableMacro", id: "\(self)")
}
var severity: DiagnosticSeverity {
.error
}
}