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).
How to do this?
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.
From the frontend side, input is handled like this:
TextField("Enter search", text: $viewModel.query)
where viewModel is a variable that represents struct having a function that allows the screens to change based on the query.
Query itself is a Published var in that struct (Content View Model: Observable Object
)
@Published var query = ""
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