Normally in Swift 5.5+, Automatic Grammar Agreement allows you to inflect a word based on the quantity of an associated numerical variable, such as the following:
Text("I have ^[\(dogCount) dogs](inflect: true).")
When dogCount = 2, this returns "I have 2 dogs." When dogCount = 1, this returns "I have 1 dog."
When using this within an in-line if statement, I've found that the 'AGA' does not work at all
Text(dogCount == 0 ? "No Dogs?!" : "I have ^[\(dogCount) dogs](inflect: true).")
I've found that the in-line if statement works normally, however the Automatic Grammar Agreement does not.
Textinstead ofprint?printdoesn't work like that.Textworks well for me too. Using Xcode 26.2, tested on iOS 26.1 real devices and on Mac Catalyst.