Retrieving Command-Line Arguments

Up to now, this project has not felt very different from MonsterTown. The application is still dependent on a hardcoded input template. It can read strings from the disk, but there is nothing for the user to do yet.

There are two ways to receive user input in a command-line app. The first is what you saw earlier when you typed commands at the prompt and Terminal performed them. That works well for short, discrete tools that do their work, produce some output, and are done.

The second way to receive user input is to interact with the user while the program is running, allowing them to enter text that the app can react to – possibly in a repeating cycle.

You are going to set wordlasso up for both kinds of user ...

Get Swift Programming: The Big Nerd Ranch Guide, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.