Simple guide to Automatic grammar agreement in Swift
<p>Bet every iOS developer had this embarrassing bug reported at least once in their career and had to deploy a simple fix.</p>
<pre>
count == 1 ? "\(count) Apple" : "\(count) Apples"</pre>
<p>What if there was a more elegant way to handle this? After all, we iOS developers would want our code to look sleek and clean.</p>
<h2>Introducing <strong>Automatic Grammar Agreement</strong></h2>
<p>Using Automatic Grammar Agreement you no longer need to go running around to your localisation files to add plurals wherever necessary in the app. Simply make the following modification.</p>
<pre>
"^[\(count) Apple](inflect: true)"</pre>
<p>Let’s see the following code with SwiftUI in action.</p>
<p><a href="https://isnihal.medium.com/simple-guide-to-automatic-grammar-agreement-in-swift-19f4f1122e1a"><strong>Learn More</strong></a></p>