title: Transform whitespace to + as a result of user input in Swift
body: <p>I am almost finished with my GitHub Repo Search app. I would need that if users' input contained whitespace, it would be changed to + instead (as GitHub's original browser does while changing the input to the part of the URL).</p>
  <p>How to do this?</p>
  <p>The code is quite complicated, has many dependancies and is scattered in several files, so if possible I don't want to copy all the passages.</p>
  <p>From the frontend side, input is handled like this:</p>
  <pre><code> TextField(&quot;Enter search&quot;, text: $viewModel.query)
  </code></pre>
  <p>where viewModel is a variable that represents struct having a function that allows the screens to change based on the query.</p>
  <p>Query itself is a Published var in that struct (<code>Content View Model: Observable Object</code>)</p>
  <pre><code>@Published var query = &quot;&quot;
  </code></pre>
  <p>If you need any more information, please let me know in comments. I can copy whole passages as I said but I don't know if it wouldn't complicate understanding the case further ;P</p>