Thanks for the temp workaround. Just a heads up - that code has a bug when the number is negative.
(-1.5).roundedDecimal(scale: 1) // returns 1.5
The fix is to wrap self in abs(self).
extension Double {
func roundedDecimal(scale: Int = 0, rule: FloatingPointRoundingRule = .toNearestOrEven) -> Decimal {
let significand = Decimal((abs(self) * pow(10, Double(scale))).rounded(rule))
return Decimal(sign: self.sign, exponent: -scale, significand: significand)
}
}
The String Catalog symbol generation feature seems to work correctly in Xcode 26 within packages. The only issue is that the generated symbols are internal and not public. So if the symbols are needed by any external module, you're out of luck.
Thanks for the temp workaround. Just a heads up - that code has a bug when the number is negative.
(-1.5).roundedDecimal(scale: 1) // returns 1.5
The fix is to wrap self in abs(self).
extension Double {
func roundedDecimal(scale: Int = 0, rule: FloatingPointRoundingRule = .toNearestOrEven) -> Decimal {
let significand = Decimal((abs(self) * pow(10, Double(scale))).rounded(rule))
return Decimal(sign: self.sign, exponent: -scale, significand: significand)
}
}
The String Catalog symbol generation feature seems to work correctly in Xcode 26 within packages. The only issue is that the generated symbols are internal and not public. So if the symbols are needed by any external module, you're out of luck.