Issues with custom string interpolation in SwiftUI Text Views

Making a new protocol with the correct required method and extension, and then extending LocalizedStringKeys/String.StringInterpolation with this new protocol seems to work for me:

protocol Formattable {
    mutating func appendInterpolation(_: String)
}

extension Formattable {
    mutating func appendInterpolation(_ value: Double, format: String) {
        appendInterpolation(String(format: format, value))
    }
}

extension LocalizedStringKey.StringInterpolation: Formattable {}
extension String.StringInterpolation: Formattable {}
2 Likes