Group Group Group Group Group Group Group Group Group Forums

Learn to Code iOS Apps with Swift Tutorial 3: Arrays, Objects, and Classes

In this third part of this five part series, you will create a simple command-line app to record the names and ages of people.

This is a companion discussion topic for the original entry at

Great tutorial so far, just one thing I can do like this - var response: String = “” - instead of var response: String - and run the code without any problem, but what is the difference in this case?

This line here just adds a default value to the response which is an empty string:

var response: String = ""

This will work fine since that default value will be overwritten later in the code. Essentially, you are adding a value that will never be used which isn’t a big deal.

If you do go down this road, a better way is to just declare the variable like so as the compiler will infer the type:

var response = ""


It works better if in the do…while loop instead of “response = input()” we write : “response = newPerson.input()”

not able to update the properties inside newPerson object:

i downloaded you file still it shows empty .